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IAAI,EAAQ,CAAC,CAAC,CAAL,CAGF,IAAD,KAAU,CACd,EAAyB,EAAY,QAAF,CAAG,CAAQ,EAG5C,EAAW,IAAI,CAAC,CAHM,CAGE,CAAd,GAAkB,CAAL,EAAe,EAAO,GAAT,EACtC,CAAC,CAAC,CACH,CAAC,CAFyD,CAG1D,SCrDL,KACA,cACA,8BACA,KAuBA,EAvBA,GAuBA,EAvBA,EAwBA,kBACA,gCACA,qCACA,2CA1BA,gCACA,kBACA,6BAEA,4CAIA,oBAGA,CAEA,oBACA,CCpBA,cACA,SAAc,mBAAmB,EAAE,WAAW,ECa9C,kBACA,EACA,EACA,0BACA,IACA,GACA,CAAK,EAQL,OAPA,KACA,SACA,IACA,CAAK,EACL,UACA,IACA,CAAK,EACL,CACA,CCtBA,kBACA,gBAEA,OADA,WACA,eACA,WACA,CAAK,CACL,CCXA,OACA,kBACA,oBACA,uBACA,EAEA,GACA,QACA,gBACA,iBACA,iBACA,qBACA,mBACA,kBACA,kBACA,gBACA,sBACA,iBACA,kBACA,UACA,aACA,EAEA,KACA,aACA,KAGA,kBACA,MACA,EAGA,EAA6B,EAAU,GAE9B,IA8CT,CAhDuC,CAgDvC,UACA,MACA,YACA,SACA,kCACA,QACA,uBACA,OACA,YAAyB,YACzB,SAmBA,GACA,yCACA,2BACA,wCACA,oBACA,6BACA,EAzBA,GAiCA,YACA,gCACA,kBACA,+BAjCA,GACA,yBAGA,OANA,uDAQA,CACA,QACA,EA4BA,6BACA,kBACA,WACA,oBACA,yCACA,cACA,iBACA,WACA,SAEA,SACA,gBACA,WAEA,EADA,UACA,MACA,cACA,uCACA,qCACA,gCACA,KACA,eACA,kCACA,iCAEA,SAIA,OAHA,8CACA,qCAEA,GACA,mBACA,eAGA,QACA,MACA,YAEA,GACqB,EAAI,EAEzB,6BACA,MAEA,EACA,YACA,QACA,mBACA,YACA,KACiC,EACjC,wBACA,yBACA,CAAiC,EAEjC,CAAqC,WAIrC,QACA,QACA,iBACA,YACA,IACA,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,EAAK,GAAG,GACpG,MAAgB,EAAE,EAAiB,EAAE,EACrC,IAAc,yBAAoD,EAAU,KAAK,EAAU,GAAG,GAC9F,MAAgB,EAAE,MAAwB,EAG1C,uBACA,WAAY,qCAA0B,4CAA6D,EAAI,EACvG,kBACA,KAEA,UACA,aACA,GACA,QACA,UACA,EAAwB,EAExB,KACA,cAEA,GACA,QACA,4DACA,eAAgC,GAAa,KAC7C,QACA,CAAqB,GACrB,EAAwB,EAExB,KACA,WACA,aAEA,GACA,KACA,wBACA,UACA,GACqB,EAAI,EACzB,CAAwB,WAExB,cACA,IAA8B,UAE9B,KACA,YACA,WACA,oBAEA,kBACA,kCAEA,SACA,YAEA,YACA,YAEA,cACA,0BAEA,UACA,kBAEA,KACA,oBACA,OAAoB,WAAc,EAClC,iBACA,WACA,YACA,YAEA,WACA,oBAEA,kBACA,kCAEA,cACA,0BAEA,UACA,kBAEA,KACA,CACA,eACA,eACA,eACA,WACA,IAA8B,kBAE9B,KACA,oBACA,uGACA,SAEA,yCAAyD,EAAgB,EAEzE,CACA,QACA,CAeA,mBACA,WAAY,GAAS,EACrB,KAiCA,OAhCA,oCACA,iBACA,WACA,MACA,wBAEA,EADA,YACA,eACA,+BAEA,8BACA,0BACA,UACiB,EAEjB,kCACA,EACA,4BACA,UACA,2BACA,eAEA,CACA,+BACA,UAEA,CAAiB,CAEjB,MAEA,MAEA,CAAK,EACL,CACA,CAUA,oBAA0D,EAC1D,WACA,OACA,gCACA,mCAEA,CAOA,mBACA,uBAMA,OAHA,GACA,MAEA,CACA,CCz7BA,eACA,aAEA,OACA,KACA,QAKA,QAEA,CAIA,eACA,YAEA,OACA,KACA,SACA,CAIA,QAEA,CCxBA,+CAEA,YACA,yBACA,sBACA,wBACA,yBACA,kBACA,mBACA,oBACA,iBACA,wBACA,CAAC,YACD,YACA,cACA,SACA,CAAC,CAWD,eACA,SACA,CAAY,QACZ,MACA,CC/BA,UACA,iCA0DA,2BAGA,2BA6BA,MA5BA,aA8MA,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,EAGA,CACA,EAMA,4BACA,wBACA,OACA,KAAY,GAAI,WAChB,sBACA,eACA,CACA,EAAI,EAkBJ,qCAEA,uEAEA,YAA8B,GAAS,KACvC,WADuC,GACvC,EACA,aACA,mCAEA,cACA,uCAEA,YACA,uCAEA,iBACA,0CAEA,aACA,sCAEA,YACA,qCAEA,aACA,4CAEA,iBACA,sCACA,CAGA,wBACA,EAEA,6BACA,iBAAqB,GAAS,mBAAsB,GAAS,aAC7D,EAMA,CAP6D,CAO7D,4BACA,0BACA,gCAEA,EAMA,mCACA,wBACA,0BACA,6BACA,+BACA,YAAmC,GAAS,0CAA6C,GAAS,SAClG,OADkG,KAEtF,GAAI,kBAChB,cACA,aACA,iBACA,eACA,CACA,EAMA,0CACA,wBACA,4BACA,iBAAqB,GAAS,OAC9B,SAD8B,CAC9B,kBACA,OACA,KAAY,GAAI,0BAChB,YACA,OACA,eACA,CACA,EAMA,uCACA,wBACA,0BACA,6BACA,uBACA,2BACA,OACA,KAAY,GAAI,uBAChB,cACA,OACA,aACA,eACA,CACA,EAQA,uCACA,wBACA,0BACA,2BACA,uBACA,mCACA,2BACA,+BACA,OACA,KAAY,GAAI,uBAChB,cACA,OACA,aACA,aACA,SACA,eACA,CACA,EAQA,uCACA,MAEA,6CACA,SAGA,4FACA,SAEA,CAFsB,GAEtB,qBAA+B,GAAS,KAExC,GACA,QAHwC,GAGxC,yBACQ,yBAAgC,GAAS,gBAAmB,GAAS,OAE7E,QACA,CAEA,0BAA8B,GAAS,wBACvC,EAMA,mCACA,YAGA,0FAA8J,GAAS,yCAA8C,GAAS,SAC9N,OAD8N,IAC9N,WAEA,sBAEA,IAGA,kBAA6B,GAAS,kCAAqC,GAAS,QACpF,EAOA,MARoF,gBAQpF,YACA,wBACA,0BACA,mBACA,2BACA,iBAAqB,GAAS,OAC9B,SAD8B,CAC9B,sBACA,2BACA,OACA,KAAY,GAAI,iBAChB,cACA,OACA,YACA,OACA,aACA,eACA,CACA,EAMA,+BACA,yBAA6B,GAAS,gCAAmC,GAAS,QAClF,EAOA,MARkF,cAQlF,YACA,IAKA,EALA,oBACA,0BACA,mBACA,iBAAqB,GAAS,OAC9B,SAD8B,CAC9B,sBAGA,yBAAiC,GAAS,SAC1C,OAD0C,CAC1C,uBAGA,+BACA,OACA,KAAY,GAAI,uBAChB,cACA,OACA,OACA,eACA,aACA,eACA,CACA,EAOA,0CACA,wBACA,0BACA,gCACA,uBACA,mCACA,2BACA,+BACA,OACA,KAAY,GAAI,0BAChB,cACA,OACA,aACA,aACA,SACA,eACA,CACA,EAOA,sCACA,wBACA,0BACA,4BACA,uBACA,2BACA,+BACA,OACA,KAAY,GAAI,sBAChB,cACA,OACA,aACA,QACA,eACA,CACA,EAQA,mCACA,gCAAoC,GAAS,2BAA8B,GAAS,8BAQpF,qCACA,wBACA,0BACA,2BACA,uBACA,2BACA,mCACA,OACA,KAAY,GAAI,qBAChB,cACA,OACA,aACA,SACA,eACA,CACA,EAMA,uCACA,yBAA6B,GAAS,sCAAyC,GAAS,QACxF,EAQA,MATwF,oBASxF,YACA,wBACA,0BACA,mBACA,2BACA,OACA,KAAY,GAAI,sBAChB,cACA,OACA,aACA,eACA,CACA,EAOA,4CACA,wBACA,0BACA,4BACA,uBACA,2BACA,oCACA,OACA,KAAY,GAAI,6BAChB,cACA,OACA,aACA,SACA,eACA,CACA,EAMA,wCACA,yBAA6B,GAAS,gCAAmC,GAAS,QAClF,EAgBA,MAjBkF,oBAiBlF,YACA,8BAEA,YAA8B,GAAS,KACvC,WADuC,GACvC,EACA,aACA,kCAEA,cACA,sCAEA,YACA,sCAEA,iBACA,yCAEA,aACA,qCAEA,YACA,oCAEA,aACA,2CACA,CAGA,wBACA,EAQA,kCACA,wBACA,6BACA,6BACA,+BACA,oBAA2C,GAAS,0CAA6C,GAAS,SAE1G,OAF0G,EAE1G,qBACA,wBAGA,OACA,KAAY,GAAI,iBAChB,aACA,iBACA,eACA,CACA,EAOA,sCACA,wBACA,6BACA,6BACA,uBACA,2BAEA,gBACA,wBAGA,OACA,KAAY,GAAI,sBAChB,OACA,aACA,eACA,CACA,EASA,sCACA,wBACA,6BACA,2BACA,uBACA,mCACA,2BACA,+BAEA,4CACA,wBAGA,OACA,KAAY,GAAI,sBAChB,OACA,aACA,aACA,SACA,eACA,CACA,EASA,yCACA,wBACA,6BACA,gCACA,uBACA,mCACA,2BACA,+BAEA,4CACA,wBAGA,OACA,KAAY,GAAI,yBAChB,OACA,aACA,aACA,SACA,eACA,CACA,EAQA,qCACA,wBACA,6BACA,4BACA,uBACA,2BACA,+BAEA,8BACA,wBAGA,OACA,KAAY,GAAI,qBAChB,OACA,aACA,QACA,eACA,CACA,EAQA,oCACA,wBACA,6BACA,2BACA,uBACA,2BACA,mCAEA,8BACA,wBAGA,OACA,KAAY,GAAI,oBAChB,OACA,aACA,SACA,eACA,CACA,EAQA,2CACA,wBACA,6BACA,4BACA,uBACA,2BACA,oCAEA,8BACA,wBAGA,OACA,KAAY,GAAI,4BAChB,OACA,aACA,SACA,eACA,CACA,EAOA,sCACA,wBACA,0BACA,gCACA,iBAAqB,GAAS,IAC9B,YAD8B,QAC9B,GACA,2BACA,2CACA,yBACA,qCACA,OACA,KAAY,GAAI,qBAChB,cACA,OACA,YACA,aACA,YACA,eACA,CACA,EAQA,qCACA,0BAA8B,GAAS,iCACvC,EA8BA,oCACA,wBACA,mBAEA,GAAyB,SAAjB,EAAiB,UACzB,QAGA,yBACA,EAAI,EAOJ,gBACA,MAEA,mEACA,WAAiB,GAAQ,2CAEzB,EAMA,mBACA,iCACA,EAOA,0BACA,wBAEA,cAGA,OAFA,sBAEA,CAGA,OAAU,GAAW,kFACrB,EAOA,kCACA,wBAEA,cAGA,OAFA,sBAEA,CAIA,EAOA,4BACA,wBAEA,YAAuB,GAAS,kBAChC,2BAEA,MAAY,GAAW,gFAEvB,EAOA,oCACA,+BAEA,SAAuB,GAAS,oBAChC,sBAEA,GAIA,EAMA,yBACA,kCACA,OAAW,GAAW,2DACtB,EAQA,sBACA,oBAGA,IAFA,SAEA,8BACA,qBAGA,QACA,EASA,+BACA,gCACA,SAEA,GACA,2BACQ,8BAER,QACA,CAEA,UASA,uBACA,oBACA,SAEA,GACA,2BACM,8BAEN,QACA,EAQA,8BACA,4BACA,SAEA,GACA,2BACM,6BAEN,QACA,EAEA,CACA,CAAC,GAKD,eACA,cACA,iDACA,CAMA,eACA,OD57CA,IAAkB,GAAS,UAAkB,GAAS,CC47CxB,ED57CH,GAA2B,MAAoB,GAAS,CAA7B,EAA6B,EC47CrD,ID57CsE,GAAS,IAA1B,GAA0B,EC47C/E,ID57CoG,GAArB,OAA8B,MAAqB,GAAS,YAAoB,GAAS,CAA7B,IAA6B,MAAmB,GAAS,EAA5B,IAA4B,MAAoB,GAAS,CAA7B,CAA6B,EC47CjO,ID57CiP,GAAS,KAAzB,IAAyB,MAAuB,CAAvB,EAAgC,WC47C1R,ID57CiT,CAAvB,EAAgC,SC47C1T,ID57C+U,GAArB,IAA8B,EC47CxV,ID57C0W,GAAS,GAA3B,IAA2B,CC47CnX,QD57CmX,EC47CnX,SAC9B,CCngDO,QACP,QACA,yBACA,+EACA,mEACA,kBACA,4BACA,+DACA,0BACA,qCACA,6DACA,2BAEA,mEACA,YACA,cACA,eACA,gBACA,aACA,aACA,qBACA,uBACA,6BACA,+BACA,mBACA,kBACA,qBACA,+DACA,iCACA,yDACA,+EACA,uEACA,+EACA,kFACA,gEACA,gEACA,wDACA,uEACA,mEACA,gDACA,0CACA,gEACA,mEACA,iDACA,iDACA,yDAEO,mBAA4B,EC/C5B,eACP,ODsIO,KCtIO,IDsIP,KACP,gEAGA,SACA,mBACA,MACA,KACA,KACA,SACA,SACA,SACA,KACA,KACA,IAGA,GAEA,IAsGA,EAtGA,iBACA,kBAEA,MAKA,GAJA,oCACA,IACA,UAEA,GACA,KACA,gBACU,CAGV,QAFA,KAEA,qBAA+D,WAA4B,KAC3F,WACA,UAGA,GACA,CAIA,QAFA,IAEA,IAAyB,WAAmB,KAC5C,cACA,UAEA,GACA,OAGA,aACA,cACA,KAEA,MAEA,CACA,CAEA,UACA,SACA,UACA,YACA,UACM,IAIN,GAHA,oBAGA,MAFA,aAGA,SAGA,GACA,SAEA,CAEA,aAEA,sBACA,IAAW,GAAM,SACjB,kCRrNA,GQqN2D,ERrN3D,EQqN2D,QAG3D,eA2HO,OACP,WAEA,MACA,4BAEA,SAGA,wBAEA,wBAEA,QAEA,EAAI,IACJ,wBAEA,MACA,wBAEA,SAGA,WAEA,wBAEA,QAEA,CACA,CACA,EA3JA,YAEA,MAGA,IAFA,yBAEA,GACA,MAGA,UACA,QACA,QACA,QACA,OACU,gBACV,cAEA,KACA,GAAgB,GAAM,KACtB,MACc,CACd,QACA,QACA,EAGA,CACA,CAEA,eACA,cAGA,EACA,SAIA,GACA,UACA,QACA,OACA,QACA,MACA,EAEA,EADA,qBACA,wCACA,KACA,KAEA,GACA,UAGA,IAEA,EAAI,iBAMJ,OAJA,cACA,qBAGA,CACA,EC1Rc,GACd,QACA,CAAG,CACH,CAGA,QACA,iBACA,eACG,CACH,qBACA,iBACG,CAEH,qBACA,oCACA,CAAG,CACH,gCACA,kBACA,SACA,6CACA,uBACA,iBAGA,CAH0C,MAG1C,gDACA,CAAG,CACH,+BACA,iBACA,SACA,iBACA,eACA,6CACA,CAAG,CACH,yBAEA,UADA,aAEA,CAAG,CACH,kBACA,cACA,SACA,cACA,eACA,iBACA,kBACA,2BAMA,OAJA,SA3CA,IAA0B,CA4C1B,oCAGA,uBACA,CAAG,CACH,qBAGA,OAFA,OAEA,KADA,QAEG,CAEH,2BAGA,YAFA,OAEA,UADA,aACA,KACA,CAAG,CACH,2BACA,sBACA,eACA,iBACA,8CACA,CAAG,CACH,+BACA,aACA,kBACA,wBACA,eACA,iBACA,MAEA,2GAEA,CAAG,CAEH,qBAEA,OADA,QAEG,CACH,uBAEA,OADA,QAEG,CACH,0BACA,cAEA,SADA,MJEO,YACP,IIF2C,EJE3C,0DACA,0DACA,uBACA,yBACA,sBACA,uBACA,cACA,KAYA,CAZmB,MAEnB,YACA,YAGA,+BAEA,GACA,UAGA,qCACA,EItB2C,8CAC3C,CAAG,CACH,yBAEA,SADA,MACA,cACA,CAAG,CACH,qBACA,YACA,CAAG,CACH,sBAEA,OADA,QAEG,CACH,sBAEA,aADA,SACA,SACA,CAAG,CACH,wBAEA,QAAa,KADb,SACa,QAA2B,CACxC,CAAG,CACH,wBAGA,OAFA,OAEA,KADA,QAEG,CAEH,sBAGA,UAFA,OAEA,UADA,YACA,UACA,CAAG,CAEH,sBAEA,OADA,OAEG,CACH,qBAEA,UADA,OACA,GACA,CAAG,CACH,wBAEA,OADA,OACA,GACA,CAAG,CAEH,gCACA,mBACA,mBACA,yCACA,CAAG,EACH,oCAGA,OAFA,YAEA,KADA,MAEA,CAAG,CACH,oCAGA,oBAFA,OAEA,GADA,aACA,UACA,CAAG,EACH,oCACA,aACA,eACA,eACA,WACA,uEACA,CAAG,EACH,+BACA,aACA,cACA,SACA,eACA,+FACA,CAAG,EACH,oCACA,aACA,SACA,iBACA,eACA,8CACA,CAAG,EACH,uCACA,aACA,eACA,eACA,WACA,4EACA,CAAG,EACH,mCACA,aACA,eACA,UACA,wEACA,CAAG,EACH,kCACA,aACA,eACA,WACA,yCACA,CAAG,EACH,mCAGA,WAFA,OAEA,GADA,aACA,UACA,CAAG,EACH,yCACA,aACA,eACA,WACA,0CACA,CAAG,EACH,mCACA,aACA,cACA,eACA,cACA,2HACA,CAAG,EACH,4BACA,mBACA,mBACA,gDACA,CAAG,CACH,gCAGA,2BAFA,OAEA,GADA,aACA,UACA,CAAG,CACH,gCACA,aACA,eACA,eACA,WACA,8EACA,CAAG,CACH,mCACA,aACA,eACA,eACA,WACA,mFACA,CAAG,CACH,+BACA,aACA,eACA,UACA,+EACA,CAAG,CACH,8BACA,aACA,eACA,WACA,gDACA,CAAG,CACH,qCACA,aACA,eACA,WACA,iDACA,CACA,EAEA,eACA,mBACA,oCACA,CACA,CAOA,eAGA,IAFA,EA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mB,aAGnB,GAHmB,QAGM,IAC7C,UAD6C,GACE,GAE/C,KACA,MAH+C,MAG/C,EAGA,QAEA,CACA,EACA,gBAA0B,IAAa,iBACvC,qCACA,+BACA,wCACA,sCACA,CAIA,QAQA,OANA,kBAA4B,EAAa,OACzC,mCAA2C,GAAiB,mBAE5D,sDAEA,iCACA,oBACA,wBACA,mCACA,oBACA,qCACA,8BACA,GACA,EACA,mCACA,IACA,EACA,gCAGA,GAEA,CAAS,CACT,CACA,eACA,WAAmB,GAAU,IAC7B,GAD6B,CAC7B,2BACA,SACA,QACA,CACA,OAAmC,GAAY,qDACtB,CACzB,CACiB,EACjB,aACA,MACA,CACA,SACA,EAAmC,KACnC,MAD8C,CAE9C,IACA,KACA,+CACA,UACA,WACA,iBACA,wBACA,CAAqB,EACrB,UACA,qBAA6C,EAAW,iCAAkC,IAAI,EAAI,GAClG,mBACA,CAAqB,EACrB,aACA,IACA,CAAqB,EAErB,EAEA,MAA8C,GAAU,IACxD,GADwD,CACxD,mCACA,CAAa,iBACb,GACA,CAAa,EAEb,OADA,IACA,UACA,oCACA,CACA,CAAS,CACT,CACA,iBACA,oBAAkC,EAAa,OAG/C,IAH+C,EAG/C,yBACA,CACA,mBACA,uBAAkC,EAAa,MAC/C,KAD+C,CAC/C,+CAEA,gCACA,CACA,2BACA,WAAgB,0DAA6D,EAC7E,yBAAgB,GAA0B,MAAQ,GAA4B,GAC9E,sBAD8E,KAC9E,QAA2C,GAAiB,oBAC5D,2CACA,SACA,yBACA,qBACA,SACA,yBACA,CAAS,CACT,CACA,2BACA,MAA+B,KAC/B,MAD0C,mBAC1B,0BAAgD,MAAQ,GAA4B,GACpG,sBADoG,kBACpG,EACA,UACA,iBACA,yBACA,0BACA,uBACA,UACA,CAAS,EACT,2BACA,2BACA,UACA,wBACA,wCACA,wBACA,wDACA,KAEA,yCAEA,qDACA,qDACA,+BACA,CAAiB,EAGjB,8BACA,CACA,CAAS,CACT,CACA,gCAEA,iBAEA,IAEA,gDAC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EACjB,GACA,gBACA,sBACA,IAGA,CACA,CACA,oBACA,uCAA+C,EAAI,GACnD,yBACA,oBACA,gCAEA,kBAA4B,EAAa,MACzC,CACA,IAFyC,UAEzC,CACA,oCACA,iDACA,0CAEA,mCAA2C,GAAiB,OAC5D,CACA,MAF4D,uBAE5D,GACA,0CACA,MACA,IAAoB,gCAA6B,EACjD,MACA,OAEA,oCACA,WACA,QACA,YACA,kBAAmC,EAAmB,OACzC,EACb,QAFsD,SAEtD,GACA,mEAA2E,cAAkB,EAC7F,CACA,CACA,uDAAqC,mEAAsF,EAC3H,uBAAkC,EAAa,MAK/C,KAL+C,EAK/C,yBAEA,GADA,wBAAqC,YAA2B,EAChE,oBAAsC,EAAa,OACnD,IADmD,IAEnD,cAAwC,EAAa,eAGrD,QAA6C,GAA0B,CACvE,qBACA,CAFuE,OADvE,GAA6C,EAI7C,+BACA,SACA,yBACA,SACA,yBACA,CAAqB,EACrB,yBAEA,EAA0C,IAAa,YACvD,WACA,cACA,CAAqB,EACrB,YAA2D,EAAc,EACzE,EAAwC,GAA4B,GACpE,EAA2C,GAA0B,IACrE,aAFoE,MACC,sBACrE,MACA,gCAAiD,EAAK,IACtD,qDACA,GACA,CAAqB,EACrB,kBAAwC,EAAa,MACrD,qBAEA,SACA,8CACA,gCAAiD,EAAK,IACtD,IACA,CAAqB,EACrB,qBACA,wBACA,oDACA,mCAEA,8BACA,kBAAwC,EAAa,MACrD,CAEA,CAAS,CACT,CACA,CALqD,KAKrD,mCACA,uDACA,MAAc,GAAwB,2C9B9iBtC,C8B8iB4G,GAC5G,CACA,QAFwH,cAExH,KACA,2BACA,+BACA,oBACA,EACA,CACA,gBACA,+CACA,EACA,eACA,oBACA,sCACA,EACA,cACA,yBACA,GACA,CACA,CAAS,CACT,CACA,sBACA,yBACA,CACA,2BACA,2BACA,4BACA,wCACA,MACA,CACA,QACA,oCACA,qCAAqD,kBAAsB,EAC3E,EACA,mCACA,sCAAsD,SAAa,GACnE,oBACA,2BACA,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9B,iFAEA,gBAAmB,GAAU,KAA0B,EAA1B,CAAkC,CAC/D,IAD+D,EAC/D,8GAEA,CAqBA,MApBA,GAAgB,GAAU,GnGzC1B,ImGyC0B,CnGzC1B,ImG0C8B,EAClB,GAAiB,IAA2B,IAexD,MAf6B,CAkB7B,CAlBoE,ECpCzC,CAC3B,QAAyB,CACzB,QAAiB,IAAO,CACnB,CACL","sources":["webpack://_N_E/./node_modules/@aws-amplify/data-schema-types/dist/esm/client/symbol.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema-types/dist/esm/index.mjs","webpack://_N_E/../../../../src/internal/util/isFunction.ts","webpack://_N_E/../../../../src/internal/util/lift.ts","webpack://_N_E/../../../../src/internal/util/createErrorClass.ts","webpack://_N_E/../../../../src/internal/util/UnsubscriptionError.ts","webpack://_N_E/../../../../src/internal/util/arrRemove.ts","webpack://_N_E/../../../src/internal/Subscription.ts","webpack://_N_E/../../../src/internal/config.ts","webpack://_N_E/../../../../src/internal/scheduler/timeoutProvider.ts","webpack://_N_E/../../../../src/internal/util/reportUnhandledError.ts","webpack://_N_E/../../../../src/internal/util/noop.ts","webpack://_N_E/../../../src/internal/NotificationFactories.ts","webpack://_N_E/../../../../src/internal/util/errorContext.ts","webpack://_N_E/../../../src/internal/Subscriber.ts","webpack://_N_E/../../../../src/internal/operators/OperatorSubscriber.ts","webpack://_N_E/../../../../src/internal/operators/map.ts","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/utils/resolveOwnerFields.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/utils/stringTransformation.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/utils/selfAwareAsync.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/cancellation.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/APIClient.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/operations/utils.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/getCustomUserAgentDetails.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/operations/custom.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/generateCustomOperationsProperty.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/operations/get.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/operations/list.mjs","webpack://_N_E/./node_modules/@smithy/util-base64/dist-es/constants.browser.js","webpack://_N_E/./node_modules/@smithy/util-base64/dist-es/fromBase64.browser.js","webpack://_N_E/./node_modules/@smithy/util-base64/node_modules/@smithy/util-utf8/dist-es/fromUtf8.browser.js","webpack://_N_E/./node_modules/@smithy/util-base64/dist-es/toBase64.browser.js","webpack://_N_E/./node_modules/@smithy/util-base64/dist-es/index.js","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/conversationMessageDeserializers.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/convertItemToConversationMessage.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createListMessagesFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/conversationStreamEventDeserializers.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createOnStreamEventFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/conversationMessageSerializers.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createSendMessageFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/convertItemToConversation.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createCreateConversationFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createGetConversationFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createListConversationsFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createDeleteConversationFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/ai/createUpdateConversationFunction.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/utils/clientProperties/generateConversationsProperty.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/utils/clientProperties/generateGenerationsProperty.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/utils/clientProperties/generateEnumsProperty.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/operations/indexQuery.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/operations/subscription.mjs","webpack://_N_E/../../../../src/internal/symbol/observable.ts","webpack://_N_E/../../../../src/internal/util/identity.ts","webpack://_N_E/../../../../src/internal/util/pipe.ts","webpack://_N_E/../../../src/internal/Observable.ts","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/utils/resolvePKFields.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/utils/findIndexByFields.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/operations/observeQuery.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/clientUtils.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/utils/clientProperties/generateModelsProperty.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/addSchemaToClient.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/internals/server/generateModelsProperty.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/addSchemaToClientWithInstance.mjs","webpack://_N_E/./node_modules/@aws-amplify/data-schema/dist/esm/runtime/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/types/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/internals/utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs","webpack://_N_E/./node_modules/graphql/jsutils/isObjectLike.mjs","webpack://_N_E/./node_modules/graphql/polyfills/symbols.mjs","webpack://_N_E/./node_modules/graphql/language/location.mjs","webpack://_N_E/./node_modules/graphql/language/printLocation.mjs","webpack://_N_E/./node_modules/graphql/error/GraphQLError.mjs","webpack://_N_E/./node_modules/graphql/error/syntaxError.mjs","webpack://_N_E/./node_modules/graphql/language/kinds.mjs","webpack://_N_E/./node_modules/graphql/jsutils/invariant.mjs","webpack://_N_E/./node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs","webpack://_N_E/./node_modules/graphql/jsutils/defineInspect.mjs","webpack://_N_E/./node_modules/graphql/language/ast.mjs","webpack://_N_E/./node_modules/graphql/language/tokenKind.mjs","webpack://_N_E/./node_modules/graphql/jsutils/inspect.mjs","webpack://_N_E/./node_modules/graphql/jsutils/devAssert.mjs","webpack://_N_E/./node_modules/graphql/jsutils/instanceOf.mjs","webpack://_N_E/./node_modules/graphql/language/source.mjs","webpack://_N_E/./node_modules/graphql/language/directiveLocation.mjs","webpack://_N_E/./node_modules/graphql/language/blockString.mjs","webpack://_N_E/./node_modules/graphql/language/lexer.mjs","webpack://_N_E/./node_modules/graphql/language/parser.mjs","webpack://_N_E/./node_modules/graphql/language/visitor.mjs","webpack://_N_E/./node_modules/graphql/language/printer.mjs","webpack://_N_E/../../../../src/internal/util/isArrayLike.ts","webpack://_N_E/../../../../src/internal/util/isPromise.ts","webpack://_N_E/../../../../src/internal/util/isInteropObservable.ts","webpack://_N_E/../../../../src/internal/util/isAsyncIterable.ts","webpack://_N_E/../../../../src/internal/util/throwUnobservableError.ts","webpack://_N_E/../../../../src/internal/symbol/iterator.ts","webpack://_N_E/../../../../src/internal/util/isIterable.ts","webpack://_N_E/../../../../src/internal/util/isReadableStreamLike.ts","webpack://_N_E/../../../../src/internal/observable/innerFrom.ts","webpack://_N_E/../../../../src/internal/operators/catchError.ts","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/errors/APIError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/errors/RestApiError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/errors/CanceledError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/errors/validation.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/serviceError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/logger.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/createCancellableOperation.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/errors/assertValidatonError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/resolveApiUrl.mjs","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/clients/handlers/authenticated.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/constants.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/parseSigningInfo.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/resolveHeaders.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/apis/common/handler.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/apis/common/publicApis.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/apis/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/utils/isIamAuthApplicable.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/apis/common/internalPost.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-rest/dist/esm/internals/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/Providers/constants.mjs","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/utils/retry/NonRetryableError.mjs","webpack://_N_E/./node_modules/uuid/dist/esm-browser/native.js","webpack://_N_E/./node_modules/uuid/dist/esm-browser/rng.js","webpack://_N_E/./node_modules/uuid/dist/esm-browser/stringify.js","webpack://_N_E/./node_modules/uuid/dist/esm-browser/v4.js","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/utils/amplifyUuid/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/utils/retry/isNonRetryableError.mjs","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/utils/retry/retry.mjs","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/utils/retry/jitteredExponentialRetry.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/types/PubSub.mjs","webpack://_N_E/../../../../src/internal/operators/filter.ts","webpack://_N_E/../../../../src/internal/util/executeSchedule.ts","webpack://_N_E/../../../../src/internal/operators/observeOn.ts","webpack://_N_E/../../../../src/internal/operators/subscribeOn.ts","webpack://_N_E/../../../../src/internal/scheduled/scheduleObservable.ts","webpack://_N_E/../../../../src/internal/scheduled/schedulePromise.ts","webpack://_N_E/../../../../src/internal/scheduled/scheduleArray.ts","webpack://_N_E/../../../../src/internal/scheduled/scheduleIterable.ts","webpack://_N_E/../../../../src/internal/scheduled/scheduleAsyncIterable.ts","webpack://_N_E/../../../../src/internal/scheduled/scheduleReadableStreamLike.ts","webpack://_N_E/../../../../src/internal/scheduled/scheduled.ts","webpack://_N_E/../../../../src/internal/observable/from.ts","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/utils/isWebWorker.mjs","webpack://_N_E/./node_modules/@aws-amplify/core/dist/esm/Reachability/Reachability.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/ReachabilityMonitor/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/ConnectionStateMonitor.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/ReconnectionMonitor.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/Providers/AWSWebSocketProvider/appsyncUrl.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/Providers/AWSWebSocketProvider/authHeaders.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/Providers/AWSWebSocketProvider/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/Providers/AWSAppSyncRealTimeProvider/index.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/errors/GraphQLApiError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/errors/validation.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/errors/assertValidationError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/resolveConfig.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/resolveLibraryOptions.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/errors/repackageAuthError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/errors/constants.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/utils/errors/createGraphQLResultWithError.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/internals/utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/internals/graphqlAuth.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/internals/InternalGraphQLAPI.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/GraphQLAPI.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/internals/v6.mjs","webpack://_N_E/./node_modules/@aws-amplify/api-graphql/dist/esm/internals/generateClient.mjs","webpack://_N_E/./node_modules/@aws-amplify/api/dist/esm/API.mjs"],"sourcesContent":["const __modelMeta__ = Symbol();\n\nexport { __modelMeta__ };\n//# sourceMappingURL=symbol.mjs.map\n","export { __modelMeta__ } from './client/symbol.mjs';\n//# sourceMappingURL=index.mjs.map\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/**\n * Given an introspection schema model, returns all owner fields.\n *\n * @param model Model from an introspection schema\n * @returns List of owner field names\n */\nfunction resolveOwnerFields(model) {\n const ownerFields = new Set();\n for (const attr of model.attributes || []) {\n if (isAuthAttribute(attr)) {\n for (const rule of attr.properties.rules) {\n if (rule.allow === 'owner') {\n ownerFields.add(rule.ownerField || 'owner');\n }\n else if (rule.allow === 'groups' && rule.groupsField !== undefined) {\n // only valid for dynamic group(s)\n // static group auth will have an array of predefined groups in the attribute, groups: string[]\n // but `groupsField` will be undefined\n ownerFields.add(rule.groupsField);\n }\n }\n }\n }\n return Array.from(ownerFields);\n}\n/**\n * Type guard that identifies an auth attribute with an attached rules list that\n * specifies an `allow` attribute at a minimum.\n *\n * @param attribute Any object. Ideally a model introspection schema model attribute\n * @returns True if given object is an auth attribute\n */\nfunction isAuthAttribute(attribute) {\n if (attribute?.type === 'auth') {\n if (typeof attribute?.properties === 'object') {\n if (Array.isArray(attribute?.properties?.rules)) {\n return (attribute?.properties?.rules).every((rule) => !!rule.allow);\n }\n }\n }\n return false;\n}\n\nexport { resolveOwnerFields };\n//# sourceMappingURL=resolveOwnerFields.mjs.map\n","/**\n * @param s string to capitalize\n * @returns capitalized string\n */\nfunction capitalize(s) {\n return `${s[0].toUpperCase()}${s.slice(1)}`;\n}\n\nexport { capitalize };\n//# sourceMappingURL=stringTransformation.mjs.map\n","/**\n * Executes an `async` resolver function, providing the `Promise`-to-be-returned as the\n * first argument to the resolver so that the resolver can refer to the `Promise` that\n * external callers will see.\n *\n * ```ts\n * const outer = selfAwareAsync(async inner => {\n * console.log(outer === inner); // true\n * });\n * ```\n *\n * This utility exists to reduce boilerplate in cases where promise resolving code needs\n * to track or register its \"own\" `Promise` *as seen by the caller* in some way. E.g.,\n * when mapping `Promise` chains for `client.cancel()`.\n *\n * @param resolver\n * @returns\n */\nfunction selfAwareAsync(resolver) {\n let resolve;\n let reject;\n const resultPromise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n resolver(resultPromise)\n .then((result) => {\n resolve(result);\n })\n .catch((error) => {\n reject(error);\n });\n return resultPromise;\n}\n\nexport { selfAwareAsync };\n//# sourceMappingURL=selfAwareAsync.mjs.map\n","/**\n * A map of cancellable promise \"extensions\".\n *\n * Each entry value must either be a directly `cancel()`-able promise, or must\n * refer to another entry.\n *\n * When cancellation of a promise is requested, cancel\n * will check to see if the promise exists in the map. If it does, it pulls\n * the value and repeats the check. If not, it will perform the underlying\n * cancel operation.\n */\nconst promiseMap = new WeakMap();\nfunction extendCancellability(existingCancellablePromise, newPromiseToRegister) {\n promiseMap.set(newPromiseToRegister, existingCancellablePromise);\n return existingCancellablePromise.finally(() => {\n promiseMap.delete(newPromiseToRegister);\n });\n}\n/**\n * Wraps the existing `cancel()` method with logic to iteratively search for\n * the corresponding base level promise, if needed, that the core graphql client\n * knows how to cancel.\n *\n * @param client\n */\nfunction upgradeClientCancellation(client) {\n const innerCancel = client.cancel.bind(client);\n client.cancel = function (promise, message) {\n const visited = new Set();\n let targetPromise = promise;\n while (targetPromise && promiseMap.has(targetPromise)) {\n if (visited.has(targetPromise))\n throw new Error('A cycle was detected in the modeled graphql cancellation chain. This is a bug. Please report it!');\n visited.add(targetPromise);\n targetPromise = promiseMap.get(targetPromise);\n }\n // call `innerCancel` with `targetPromise!` to defer to existing implementation\n // on how to handle `null | undefined` or otherwise \"non-cancellable\" objects.\n return innerCancel(targetPromise, message);\n };\n}\n\nexport { extendCancellability, upgradeClientCancellation };\n//# sourceMappingURL=cancellation.mjs.map\n","import { resolveOwnerFields } from '../utils/resolveOwnerFields.mjs';\nimport { capitalize } from '../utils/stringTransformation.mjs';\nimport { selfAwareAsync } from '../utils/selfAwareAsync.mjs';\nimport { extendCancellability } from './cancellation.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\nconst connectionType = {\n HAS_ONE: 'HAS_ONE',\n HAS_MANY: 'HAS_MANY',\n BELONGS_TO: 'BELONGS_TO',\n};\n// When generating an SK's KeyConditionInput name, string-like types map to String\nconst skGraphQlFieldTypeMap = {\n ID: 'ID',\n String: 'String',\n AWSDate: 'String',\n AWSTime: 'String',\n AWSDateTime: 'String',\n AWSTimestamp: 'Int',\n AWSEmail: 'String',\n AWSPhone: 'String',\n AWSURL: 'String',\n AWSIPAddress: 'String',\n AWSJSON: 'String',\n Boolean: 'Boolean',\n Int: 'Int',\n Float: 'Float',\n};\n// move to util\nconst resolvedSkName = (sk) => {\n if (sk.length === 1) {\n return sk[0];\n }\n else {\n return sk.reduce((acc, curr, idx) => {\n if (idx === 0) {\n return curr;\n }\n else {\n return acc + capitalize(curr);\n }\n }, '');\n }\n};\n/**\n * Crawls a model tree, starting with a given **individual** model instance record, looking\n * for related hasMany children to extract from their `items` containers.\n *\n * E.g., if we have a record like this:\n *\n * ```js\n * {\n * id: 'some-id',\n * children: {\n * items: [\n * { name: 'a' }\n * { name: 'b' }\n * { name: 'c' }\n * ]\n * }\n * }\n * ```\n *\n * And if `children` refers to *an array of another model* (as opposed to a custom type),\n * the `items` will be extracted. We do this because `items` is just the mechanism for nesting\n * child records -- we don't want customers to have to dig the items out in application code.\n * Ultimately, we return this \"flattened\" structure:\n *\n * ```js\n * {\n * id: 'some-id',\n * children: [\n * { name: 'a' }\n * { name: 'b' }\n * { name: 'c' }\n * ]\n * }\n * ```\n *\n * Notably, an identical record could be the result of a nested custom type that contains an\n * `items` property. This will *not* be flattened, because in that case the `items` property is\n * actually part of the customer's schema. Similarly if a model contains an explicit `items` field.\n *\n * @param modelIntrospection Top-level model introspection schema.\n * @param modelName The name of the model. Can be `undefined`. E.g., for customOperation return types.\n * @param modelRecord The individual \"model instance record\" to normalize.\n */\nconst flattenItems = (modelIntrospection, modelName, modelRecord) => {\n if (!modelRecord)\n return null;\n const mapped = {};\n for (const [fieldName, value] of Object.entries(modelRecord)) {\n const fieldDef = modelName\n ? modelIntrospection.models[modelName]?.fields[fieldName]\n : undefined;\n const dvPair = { fieldDef, value };\n if (isRelatedModelItemsArrayPair(dvPair)) {\n mapped[fieldName] = dvPair.value.items.map((itemValue) => flattenItems(modelIntrospection, dvPair.fieldDef.type.model, itemValue));\n }\n else if (isRelatedModelProperty(fieldDef)) {\n mapped[fieldName] = flattenItems(modelIntrospection, fieldDef.type.model, value);\n }\n else {\n mapped[fieldName] = value;\n }\n }\n return mapped;\n};\n/**\n * Determines whether the given field definition and associated result value\n * represent a related model array from a HasMany-type relationship.\n *\n * @param dv Pair of field definition and associated result value\n * @returns\n */\nfunction isRelatedModelItemsArrayPair(dv) {\n return (typeof dv.fieldDef?.type === 'object' &&\n 'model' in dv.fieldDef.type &&\n typeof dv.fieldDef.type.model === 'string' &&\n dv.fieldDef.isArray &&\n Array.isArray(dv.value?.items));\n}\n/**\n * Determines whether the given field definition represents a relationship\n * to another model.\n *\n * @param fieldDef\n * @returns\n */\nfunction isRelatedModelProperty(fieldDef) {\n return (typeof fieldDef?.type === 'object' &&\n 'model' in fieldDef.type &&\n typeof fieldDef.type.model === 'string');\n}\n// TODO: this should accept single result to support CRUD methods; create helper for array/list\nfunction initializeModel(client, modelName, result, modelIntrospection, authMode, authToken, context = false) {\n const introModel = modelIntrospection.models[modelName];\n const introModelFields = introModel.fields;\n const modelFields = Object.entries(introModelFields)\n .filter(([_, field]) => field?.type?.model !== undefined)\n .map(([fieldName]) => fieldName);\n return result.map((record) => {\n if (record === null || record === undefined) {\n return record;\n }\n const initializedRelationshipFields = {};\n for (const fieldName of modelFields) {\n const modelField = introModelFields[fieldName];\n const modelFieldType = modelField?.type;\n const relatedModelName = modelFieldType.model;\n const relatedModel = modelIntrospection.models[relatedModelName];\n const relatedModelPKFieldName = relatedModel.primaryKeyInfo.primaryKeyFieldName;\n const relatedModelSKFieldNames = relatedModel.primaryKeyInfo.sortKeyFieldNames;\n const relationType = modelField.association?.connectionType;\n let connectionFields = [];\n if (modelField.association &&\n 'associatedWith' in modelField.association) {\n connectionFields = modelField.association.associatedWith;\n }\n const targetNames = [];\n if (modelField.association && 'targetNames' in modelField.association) {\n targetNames.push(...modelField.association.targetNames);\n }\n switch (relationType) {\n case connectionType.BELONGS_TO: {\n const sortKeyValues = relatedModelSKFieldNames.reduce(\n // TODO(Eslint): is this implementation correct?\n // eslint-disable-next-line array-callback-return\n (acc, curVal) => {\n if (record[curVal]) {\n acc[curVal] = record[curVal];\n }\n return acc;\n }, {});\n // if get is disabled on the related model\n if (client.models[relatedModelName]?.get === undefined) {\n break;\n }\n if (context) {\n initializedRelationshipFields[fieldName] = (contextSpec, options) => {\n if (record[targetNames[0]]) {\n return client.models[relatedModelName].get(contextSpec, {\n [relatedModelPKFieldName]: record[targetNames[0]],\n ...sortKeyValues,\n }, {\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return { data: null };\n };\n }\n else {\n initializedRelationshipFields[fieldName] = (options) => {\n if (record[targetNames[0]]) {\n return client.models[relatedModelName].get({\n [relatedModelPKFieldName]: record[targetNames[0]],\n ...sortKeyValues,\n }, {\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n }\n return { data: null };\n };\n }\n break;\n }\n case connectionType.HAS_ONE:\n case connectionType.HAS_MANY: {\n /**\n * If the loader is a HAS_ONE, we just need to attempt to grab the first item\n * from the result.\n */\n const mapResult = relationType === connectionType.HAS_ONE\n ? (result) => {\n return {\n data: result?.data.shift() || null,\n errors: result.errors,\n extensions: result.extensions,\n };\n }\n : (result) => result;\n const parentPk = introModel.primaryKeyInfo.primaryKeyFieldName;\n const parentSK = introModel.primaryKeyInfo.sortKeyFieldNames;\n // M:N check - TODO: refactor\n const relatedModelField = relatedModel.fields[connectionFields[0]];\n const relatedModelFieldType = relatedModelField.type;\n if (relatedModelFieldType.model) {\n let relatedTargetNames = [];\n if (relatedModelField.association &&\n 'targetNames' in relatedModelField.association) {\n relatedTargetNames = relatedModelField.association?.targetNames;\n }\n const hasManyFilter = relatedTargetNames.map((field, idx) => {\n if (idx === 0) {\n return { [field]: { eq: record[parentPk] } };\n }\n return { [field]: { eq: record[parentSK[idx - 1]] } };\n });\n // if list is disabled on the related model\n if (client.models[relatedModelName]?.list === undefined) {\n break;\n }\n if (context) {\n initializedRelationshipFields[fieldName] = (contextSpec, options) => {\n if (record[parentPk]) {\n return selfAwareAsync(async (resultPromise) => {\n const basePromise = client.models[relatedModelName].list(contextSpec, {\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n const extendedBase = extendCancellability(basePromise, resultPromise);\n return mapResult((await extendedBase));\n });\n }\n return [];\n };\n }\n else {\n initializedRelationshipFields[fieldName] = (options) => {\n if (record[parentPk]) {\n return selfAwareAsync(async (resultPromise) => {\n const basePromise = client.models[relatedModelName].list({\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n const extendedBase = extendCancellability(basePromise, resultPromise);\n return mapResult((await extendedBase));\n });\n }\n return [];\n };\n }\n break;\n }\n const hasManyFilter = connectionFields.map((field, idx) => {\n if (idx === 0) {\n return { [field]: { eq: record[parentPk] } };\n }\n return { [field]: { eq: record[parentSK[idx - 1]] } };\n });\n // if list is disabled on the related model\n if (client.models[relatedModelName]?.list === undefined) {\n break;\n }\n if (context) {\n initializedRelationshipFields[fieldName] = (contextSpec, options) => {\n if (record[parentPk]) {\n return selfAwareAsync(async (resultPromise) => {\n const basePromise = client.models[relatedModelName].list(contextSpec, {\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n const extendedBase = extendCancellability(basePromise, resultPromise);\n return mapResult((await extendedBase));\n });\n }\n return [];\n };\n }\n else {\n initializedRelationshipFields[fieldName] = (options) => {\n if (record[parentPk]) {\n return selfAwareAsync(async (resultPromise) => {\n const basePromise = client.models[relatedModelName].list({\n filter: { and: hasManyFilter },\n limit: options?.limit,\n nextToken: options?.nextToken,\n authMode: options?.authMode || authMode,\n authToken: options?.authToken || authToken,\n });\n const extendedBase = extendCancellability(basePromise, resultPromise);\n return mapResult((await extendedBase));\n });\n }\n return [];\n };\n }\n break;\n }\n }\n }\n return { ...record, ...initializedRelationshipFields };\n });\n}\nconst graphQLOperationsInfo = {\n CREATE: { operationPrefix: 'create', usePlural: false },\n GET: { operationPrefix: 'get', usePlural: false },\n UPDATE: { operationPrefix: 'update', usePlural: false },\n DELETE: { operationPrefix: 'delete', usePlural: false },\n LIST: { operationPrefix: 'list', usePlural: true },\n INDEX_QUERY: { operationPrefix: '', usePlural: false },\n ONCREATE: { operationPrefix: 'onCreate', usePlural: false },\n ONUPDATE: { operationPrefix: 'onUpdate', usePlural: false },\n ONDELETE: { operationPrefix: 'onDelete', usePlural: false },\n OBSERVEQUERY: { operationPrefix: 'observeQuery', usePlural: false },\n};\nconst SELECTION_SET_WILDCARD = '*';\nconst getDefaultSelectionSetForNonModelWithIR = (nonModelDefinition, modelIntrospection) => {\n const { fields } = nonModelDefinition;\n const mappedFields = Object.values(fields)\n .map(({ type, name }) => {\n if (typeof type.enum === 'string') {\n return [name, FIELD_IR];\n }\n if (typeof type.nonModel === 'string') {\n return [\n name,\n getDefaultSelectionSetForNonModelWithIR(modelIntrospection.nonModels[type.nonModel], modelIntrospection),\n ];\n }\n if (typeof type === 'string') {\n return [name, FIELD_IR];\n }\n return undefined;\n })\n .filter((pair) => pair !== undefined);\n return Object.fromEntries(mappedFields);\n};\nconst getDefaultSelectionSetForModelWithIR = (modelDefinition, modelIntrospection) => {\n const { fields } = modelDefinition;\n const mappedFields = Object.values(fields)\n .map(({ type, name }) => {\n if (typeof type.enum === 'string' ||\n typeof type === 'string') {\n return [name, FIELD_IR];\n }\n if (typeof type.nonModel === 'string') {\n return [\n name,\n getDefaultSelectionSetForNonModelWithIR(modelIntrospection.nonModels[type.nonModel], modelIntrospection),\n ];\n }\n return undefined;\n })\n .filter((pair) => pair !== undefined);\n const ownerFields = resolveOwnerFields(modelDefinition).map((field) => [\n field,\n FIELD_IR,\n ]);\n return Object.fromEntries(mappedFields.concat(ownerFields));\n};\nfunction defaultSelectionSetForModel(modelDefinition) {\n // fields that are explicitly part of the graphql schema; not\n // inferred from owner auth rules.\n const { fields } = modelDefinition;\n const explicitFields = Object.values(fields)\n // Default selection set omits model fields\n .map(({ type, name }) => {\n if (typeof type === 'string')\n return name;\n if (typeof type === 'object') {\n if (typeof type?.enum === 'string') {\n return name;\n }\n else if (typeof type?.nonModel === 'string') {\n return `${name}.${SELECTION_SET_WILDCARD}`;\n }\n }\n return undefined;\n })\n .filter(Boolean);\n // fields used for owner auth rules that may or may not also\n // be explicit on the model.\n const ownerFields = resolveOwnerFields(modelDefinition);\n return Array.from(new Set(explicitFields.concat(ownerFields)));\n}\nconst FIELD_IR = '';\n/**\n * Generates nested Custom Selection Set IR from path\n *\n * @param modelDefinitions\n * @param modelName\n * @param selectionSet - array of object paths\n * @example\n * ### Given\n * `selectionSet = ['id', 'comments.post.id']`\n * ### Returns\n * ```ts\n * {\n * id: '',\n * comments: {\n * items: { post: { id: '' } }\n * }\n * }\n * ```\n */\nfunction customSelectionSetToIR(modelIntrospection, modelName, selectionSet) {\n const dotNotationToObject = (path, modelOrNonModelName) => {\n const [fieldName, ...rest] = path.split('.');\n const nested = rest[0];\n const modelOrNonModelDefinition = modelIntrospection.models[modelOrNonModelName] ??\n modelIntrospection.nonModels[modelOrNonModelName];\n const modelOrNonModelFields = modelOrNonModelDefinition?.fields;\n const relatedModel = modelOrNonModelFields?.[fieldName]?.type?.model;\n const relatedModelDefinition = modelIntrospection.models[relatedModel];\n const relatedNonModel = modelOrNonModelFields?.[fieldName]?.type?.nonModel;\n const relatedNonModelDefinition = modelIntrospection.nonModels[relatedNonModel];\n const isModelOrNonModelOrFieldType = relatedModelDefinition\n ? 'model'\n : relatedNonModelDefinition\n ? 'nonModel'\n : 'field';\n if (isModelOrNonModelOrFieldType === 'nonModel') {\n let result = {};\n if (!nested) {\n throw Error(`${fieldName} must declare a wildcard (*) or a field of custom type ${relatedNonModel}`);\n }\n if (nested === SELECTION_SET_WILDCARD) {\n result = {\n [fieldName]: getDefaultSelectionSetForNonModelWithIR(relatedNonModelDefinition, modelIntrospection),\n };\n }\n else {\n result = {\n [fieldName]: dotNotationToObject(rest.join('.'), relatedNonModel),\n };\n }\n return result;\n }\n else if (isModelOrNonModelOrFieldType === 'model') {\n let result = {};\n if (!nested) {\n throw Error(`${fieldName} must declare a wildcard (*) or a field of model ${relatedModel}`);\n }\n if (nested === SELECTION_SET_WILDCARD) {\n const nestedRelatedModelDefinition = modelIntrospection.models[relatedModel];\n result = {\n [fieldName]: getDefaultSelectionSetForModelWithIR(nestedRelatedModelDefinition, modelIntrospection),\n };\n }\n else {\n result = {\n [fieldName]: dotNotationToObject(rest.join('.'), relatedModel),\n };\n }\n if (modelOrNonModelFields[fieldName]?.isArray) {\n result = {\n [fieldName]: {\n items: result[fieldName],\n },\n };\n }\n return result;\n }\n else {\n const modelField = modelOrNonModelFields?.[fieldName];\n const nonModelDefinition = modelIntrospection.nonModels[modelOrNonModelName];\n const nonModelField = nonModelDefinition?.fields?.[fieldName];\n if (!nonModelDefinition) {\n const isOwnerField = resolveOwnerFields(modelOrNonModelDefinition).includes(fieldName);\n if (!modelField && !isOwnerField) {\n throw Error(`${fieldName} is not a field of model ${modelOrNonModelName}`);\n }\n }\n else {\n if (!nonModelField) {\n throw Error(`${fieldName} is not a field of custom type ${modelOrNonModelName}`);\n }\n }\n return { [fieldName]: FIELD_IR };\n }\n };\n return selectionSet.reduce((resultObj, path) => deepMergeSelectionSetObjects(dotNotationToObject(path, modelName), resultObj), {});\n}\n/**\n * Stringifies selection set IR\n * * @example\n * ### Given\n * ```ts\n * {\n * id: '',\n * comments: {\n * items: { post: { id: '' } }\n * }\n * }\n * ```\n * ### Returns\n * `'id comments { items { post { id } } }'`\n */\nfunction selectionSetIRToString(obj) {\n const res = [];\n Object.entries(obj).forEach(([fieldName, value]) => {\n if (value === FIELD_IR) {\n res.push(fieldName);\n }\n else if (typeof value === 'object' && value !== null) {\n if (value?.items) {\n res.push(fieldName, '{', 'items', '{', selectionSetIRToString(value.items), '}', '}');\n }\n else {\n res.push(fieldName, '{', selectionSetIRToString(value), '}');\n }\n }\n });\n return res.join(' ');\n}\n/**\n * Recursively merges selection set objects from `source` onto `target`.\n *\n * `target` will be updated. `source` will be left alone.\n *\n * @param source The object to merge into target.\n * @param target The object to be mutated.\n */\nfunction deepMergeSelectionSetObjects(source, target) {\n const isObject = (obj) => obj && typeof obj === 'object';\n for (const key in source) {\n // This verification avoids 'Prototype Pollution' issue\n if (!Object.prototype.hasOwnProperty.call(source, key))\n continue;\n if (Object.prototype.hasOwnProperty.call(target, key) &&\n isObject(target[key])) {\n deepMergeSelectionSetObjects(source[key], target[key]);\n }\n else {\n target[key] = source[key];\n }\n }\n return target;\n}\nfunction generateSelectionSet(modelIntrospection, modelName, selectionSet) {\n const modelDefinition = modelIntrospection.models[modelName];\n const selSetIr = customSelectionSetToIR(modelIntrospection, modelName, selectionSet ?? defaultSelectionSetForModel(modelDefinition));\n const selSetString = selectionSetIRToString(selSetIr);\n return selSetString;\n}\nfunction generateGraphQLDocument(modelIntrospection, modelDefinition, modelOperation, listArgs, indexMeta) {\n const { name, pluralName, fields, primaryKeyInfo: { isCustomPrimaryKey, primaryKeyFieldName, sortKeyFieldNames, }, attributes, } = modelDefinition;\n // Use pascal case of the model name to generate the operations and the arguments.\n // This is required to be in sync with the resources generated by the GraphQL transformers.\n const namePascalCase = name.charAt(0).toUpperCase() + name.slice(1);\n const pluralNamePascalCase = pluralName.charAt(0).toUpperCase() + pluralName.slice(1);\n const { operationPrefix, usePlural } = graphQLOperationsInfo[modelOperation];\n const { selectionSet } = listArgs || {};\n let graphQLFieldName;\n let indexQueryArgs;\n if (operationPrefix) {\n graphQLFieldName = `${operationPrefix}${usePlural ? pluralNamePascalCase : namePascalCase}`;\n }\n else if (indexMeta) {\n const { queryField, pk, sk = [] } = indexMeta;\n graphQLFieldName = queryField;\n /**\n * **a. Single field SK** -> single arg where name is the field name and the type is `Model${gqlFieldType}KeyConditionInput` (nullable)\n * Note: string-like data types e.g., AWSDateTime, AWSEmail, AWSPhone, etc. should map to String. See `skGraphQlFieldTypeMap` above\n * @example\n * ```\n * sk1: ModelStringKeyConditionInput\n * ```\n *\n * **b. Composite SK** -> single arg where the name is camelCase concatenation of all the field names that comprise the SK\n * and the type is `Model${modelName}${keyAttributeName}CompositeKeyConditionInput` (nullable)\n * @example\n * ```\n * sk1Sk2: ModelMyModelMyModelByPkAndSk1AndSk2CompositeKeyConditionInput\n */\n let skQueryArgs = {};\n if (sk.length === 1) {\n const [skField] = sk;\n const type = (typeof fields[skField].type === 'string'\n ? fields[skField].type\n : 'String');\n const normalizedType = skGraphQlFieldTypeMap[type];\n skQueryArgs = {\n [skField]: `Model${normalizedType}KeyConditionInput`,\n };\n }\n else if (sk.length > 1) {\n const compositeSkArgName = resolvedSkName(sk);\n const keyName = attributes?.find((attr) => attr?.properties?.queryField === queryField)?.properties?.name;\n skQueryArgs = {\n [compositeSkArgName]: `Model${capitalize(name)}${capitalize(keyName)}CompositeKeyConditionInput`,\n };\n }\n indexQueryArgs = {\n [pk]: `${Object.prototype.hasOwnProperty.call(fields[pk].type, 'enum')\n ? fields[pk].type.enum // AppSync schema sets enum type as the type of the enum fields that's used as PK\n : fields[pk].type}!`,\n ...skQueryArgs,\n };\n }\n else {\n throw new Error('Error generating GraphQL Document - invalid operation name');\n }\n let graphQLOperationType;\n let graphQLSelectionSet;\n let graphQLArguments;\n const selectionSetFields = generateSelectionSet(modelIntrospection, name, selectionSet);\n // default PK args for get and list operations\n // modified below for CPK\n const getPkArgs = {\n [primaryKeyFieldName]: `${fields[primaryKeyFieldName].type}!`,\n };\n const listPkArgs = {};\n /**\n * Generate query field args for the SK if it's defined\n *\n * **1. Get queries** require each SK field to be present as a separate arg where the type is the field's GraphQL scalar type (non-nullable)\n * @example\n * ```\n * sk1: String!, sk2: Int!\n * ```\n *\n * **2. List queries**\n *\n * **a. Single field SK** -> single arg where name is the field name and the type is `Model${gqlFieldType}KeyConditionInput` (nullable)\n * Note: string-like data types e.g., AWSDateTime, AWSEmail, AWSPhone, etc. should map to String. See `skGraphQlFieldTypeMap` above\n * @example\n * ```\n * sk1: ModelStringKeyConditionInput\n * ```\n *\n * **b. Composite SK** -> single arg where the name is camelCase concatenation of all the field names that comprise the SK\n * and the type is `Model${modelName}PrimaryCompositeKeyConditionInput` (nullable)\n * @example\n * ```\n * sk1Sk2: ModelMyModelPrimaryCompositeKeyConditionInput\n * ```\n */\n const generateSkArgs = (op) => {\n if (sortKeyFieldNames.length === 0)\n return {};\n if (op === 'get') {\n return sortKeyFieldNames.reduce((acc, fieldName) => {\n const fieldType = fields[fieldName].type;\n if (op === 'get') {\n acc[fieldName] = `${fieldType}!`; // ! - SK args are non-nullable in Get queries\n }\n return acc;\n }, {});\n }\n else {\n // list SK\n if (sortKeyFieldNames.length === 1) {\n // Single SK\n const [sk] = sortKeyFieldNames;\n const type = (typeof fields[sk].type === 'string' ? fields[sk].type : 'String');\n const normalizedType = skGraphQlFieldTypeMap[type];\n return {\n [sk]: `Model${normalizedType}KeyConditionInput`,\n };\n }\n else {\n // Composite SK\n const compositeSkArgName = resolvedSkName(sortKeyFieldNames);\n return {\n [compositeSkArgName]: `Model${capitalize(name)}PrimaryCompositeKeyConditionInput`,\n };\n }\n }\n };\n if (isCustomPrimaryKey) {\n Object.assign(getPkArgs, generateSkArgs('get'));\n Object.assign(listPkArgs, {\n // PK is only included in list query field args in the generated GQL\n // when explicitly specifying PK with .identifier(['fieldName']) or @primaryKey in the schema definition\n [primaryKeyFieldName]: `${fields[primaryKeyFieldName].type}`, // PK is always a nullable arg for list (no `!` after the type)\n sortDirection: 'ModelSortDirection',\n }, generateSkArgs('list'));\n }\n switch (modelOperation) {\n case 'CREATE':\n case 'UPDATE':\n case 'DELETE':\n graphQLArguments ??\n (graphQLArguments = {\n input: `${operationPrefix.charAt(0).toLocaleUpperCase() +\n operationPrefix.slice(1)}${namePascalCase}Input!`,\n });\n graphQLOperationType ?? (graphQLOperationType = 'mutation');\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'GET':\n graphQLArguments ?? (graphQLArguments = getPkArgs);\n graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'LIST':\n graphQLArguments ??\n (graphQLArguments = {\n ...listPkArgs,\n // eslint doesn't like the ts-ignore, because it thinks it's unnecessary.\n // But TS doesn't like the `filter: ...` because it think it will always be\n // overwritten. (it won't be.) so, we need to ignore the TS error and then\n // ignore the eslint error on the ts-ignore.\n // eslint-disable-next-line\n // @ts-ignore\n filter: `Model${namePascalCase}FilterInput`,\n limit: 'Int',\n nextToken: 'String',\n });\n graphQLOperationType ?? (graphQLOperationType = 'query');\n graphQLSelectionSet ??\n (graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'INDEX_QUERY':\n graphQLArguments ??\n (graphQLArguments = {\n ...indexQueryArgs,\n filter: `Model${namePascalCase}FilterInput`,\n sortDirection: 'ModelSortDirection',\n limit: 'Int',\n nextToken: 'String',\n });\n graphQLOperationType ?? (graphQLOperationType = 'query');\n graphQLSelectionSet ??\n (graphQLSelectionSet = `items { ${selectionSetFields} } nextToken __typename`);\n // TODO(Eslint): this this case clause correct without the break statement?\n // eslint-disable-next-line no-fallthrough\n case 'ONCREATE':\n case 'ONUPDATE':\n case 'ONDELETE':\n graphQLArguments ??\n (graphQLArguments = {\n filter: `ModelSubscription${namePascalCase}FilterInput`,\n });\n graphQLOperationType ?? (graphQLOperationType = 'subscription');\n graphQLSelectionSet ?? (graphQLSelectionSet = selectionSetFields);\n break;\n case 'OBSERVEQUERY':\n default:\n throw new Error('Internal error: Attempted to generate graphql document for observeQuery. Please report this error.');\n }\n const graphQLDocument = `${graphQLOperationType}${graphQLArguments\n ? `(${Object.entries(graphQLArguments).map(([fieldName, type]) => `$${fieldName}: ${type}`)})`\n : ''} { ${graphQLFieldName}${graphQLArguments\n ? `(${Object.keys(graphQLArguments).map((fieldName) => `${fieldName}: $${fieldName}`)})`\n : ''} { ${graphQLSelectionSet} } }`;\n return graphQLDocument;\n}\nfunction buildGraphQLVariables(modelDefinition, operation, arg, modelIntrospection, indexMeta) {\n const { fields, primaryKeyInfo: { isCustomPrimaryKey, primaryKeyFieldName, sortKeyFieldNames, }, } = modelDefinition;\n const skName = sortKeyFieldNames?.length && resolvedSkName(sortKeyFieldNames);\n let variables = {};\n // TODO: process input\n switch (operation) {\n case 'CREATE':\n variables = {\n input: arg\n ? normalizeMutationInput(arg, modelDefinition, modelIntrospection)\n : {},\n };\n break;\n case 'UPDATE':\n // readonly fields are not updated\n variables = {\n input: arg\n ? Object.fromEntries(Object.entries(normalizeMutationInput(arg, modelDefinition, modelIntrospection)).filter(([fieldName]) => {\n const { isReadOnly } = fields[fieldName];\n return !isReadOnly;\n }))\n : {},\n };\n break;\n case 'GET':\n case 'DELETE':\n // only identifiers are sent\n if (arg) {\n variables = isCustomPrimaryKey\n ? [primaryKeyFieldName, ...sortKeyFieldNames].reduce((acc, fieldName) => {\n acc[fieldName] = arg[fieldName];\n return acc;\n }, {})\n : { [primaryKeyFieldName]: arg[primaryKeyFieldName] };\n }\n if (operation === 'DELETE') {\n variables = { input: variables };\n }\n break;\n case 'LIST':\n if (arg?.filter) {\n variables.filter = arg.filter;\n }\n if (arg?.sortDirection) {\n variables.sortDirection = arg.sortDirection;\n }\n if (arg && arg[primaryKeyFieldName]) {\n variables[primaryKeyFieldName] = arg[primaryKeyFieldName];\n }\n if (skName && arg && arg[skName]) {\n variables[skName] = arg[skName];\n }\n if (arg?.nextToken) {\n variables.nextToken = arg.nextToken;\n }\n if (arg?.limit) {\n variables.limit = arg.limit;\n }\n break;\n case 'INDEX_QUERY': {\n const { pk, sk = [] } = indexMeta;\n const indexQuerySkName = sk?.length && resolvedSkName(sk);\n variables[pk] = arg[pk];\n if (indexQuerySkName && arg && arg[indexQuerySkName]) {\n variables[indexQuerySkName] = arg[indexQuerySkName];\n }\n if (arg?.filter) {\n variables.filter = arg.filter;\n }\n if (arg?.sortDirection) {\n variables.sortDirection = arg.sortDirection;\n }\n if (arg?.nextToken) {\n variables.nextToken = arg.nextToken;\n }\n if (arg?.limit) {\n variables.limit = arg.limit;\n }\n break;\n }\n case 'ONCREATE':\n case 'ONUPDATE':\n case 'ONDELETE':\n if (arg?.filter) {\n variables = { filter: arg.filter };\n }\n break;\n case 'OBSERVEQUERY':\n throw new Error('Internal error: Attempted to build variables for observeQuery. Please report this error.');\n default: {\n const exhaustiveCheck = operation;\n throw new Error(`Unhandled operation case: ${exhaustiveCheck}`);\n }\n }\n return variables;\n}\n/**\n * Iterates over mutation input values and resolves any model inputs to their corresponding join fields/values\n *\n * @example\n * ### Usage\n * ```ts\n * const result = normalizeMutationInput({ post: post }, model, modelDefinition);\n * ```\n * ### Result\n * ```ts\n * { postId: \"abc123\" }\n * ```\n *\n */\nfunction normalizeMutationInput(mutationInput, model, modelIntrospection) {\n const { fields } = model;\n const normalized = {};\n Object.entries(mutationInput).forEach(([inputFieldName, inputValue]) => {\n const fieldType = fields[inputFieldName]?.type;\n const relatedModelName = fieldType?.model;\n if (relatedModelName) {\n const association = fields[inputFieldName]?.association;\n const relatedModelDef = modelIntrospection.models[relatedModelName];\n const relatedModelPkInfo = relatedModelDef.primaryKeyInfo;\n if (association?.connectionType === connectionType.HAS_ONE) {\n const associationHasOne = association;\n associationHasOne.targetNames.forEach((targetName, idx) => {\n const associatedFieldName = associationHasOne.associatedWith[idx];\n normalized[targetName] = inputValue[associatedFieldName];\n });\n }\n if (association?.connectionType === connectionType.BELONGS_TO) {\n const associationBelongsTo = association;\n associationBelongsTo.targetNames.forEach((targetName, idx) => {\n if (idx === 0) {\n const associatedFieldName = relatedModelPkInfo.primaryKeyFieldName;\n normalized[targetName] = inputValue[associatedFieldName];\n }\n else {\n const associatedFieldName = relatedModelPkInfo.sortKeyFieldNames[idx - 1];\n normalized[targetName] = inputValue[associatedFieldName];\n }\n });\n }\n }\n else {\n normalized[inputFieldName] = inputValue;\n }\n });\n return normalized;\n}\n/**\n * Produces a parameter object that can contains auth mode/token overrides\n * only if present in either `options` (first) or configured on the `client`\n * as a fallback.\n *\n * @param client Configured client from `generateClient`\n * @param options Args/Options object from call site.\n * @returns\n */\nfunction authModeParams(client, getInternals, options = {}) {\n const internals = getInternals(client);\n return {\n authMode: options.authMode || internals.authMode,\n authToken: options.authToken || internals.authToken,\n };\n}\n/**\n * Retrieves custom headers from either the client or request options.\n * @param client V6Client | V6ClientSSRRequest | V6ClientSSRCookies - for extracting client headers\n * @param requestHeaders {@link CustomHeaders} - request headers\n * @returns custom headers as {@link CustomHeaders}\n */\nfunction getCustomHeaders(client, getInternals, requestHeaders) {\n let headers = getInternals(client).headers || {};\n // Individual request headers will take precedence over client headers.\n // We intentionally do *not* merge client and request headers.\n if (requestHeaders) {\n headers = requestHeaders;\n }\n return headers;\n}\n\nexport { authModeParams, buildGraphQLVariables, customSelectionSetToIR, flattenItems, generateGraphQLDocument, generateSelectionSet, getCustomHeaders, getDefaultSelectionSetForNonModelWithIR, graphQLOperationsInfo, initializeModel, normalizeMutationInput, selectionSetIRToString };\n//# sourceMappingURL=APIClient.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n// import { GraphQLFormattedError } from '@aws-amplify/data-schema-types';\n/**\n * Handle errors for list return types (list and index query operations)\n */\nfunction handleListGraphQlError(error) {\n if (error?.errors) {\n // graphql errors pass through\n return {\n ...error,\n data: [],\n };\n }\n else {\n // non-graphql errors are re-thrown\n throw error;\n }\n}\n/**\n * Handle errors for singular return types (create, get, update, delete operations)\n */\nfunction handleSingularGraphQlError(error) {\n if (error.errors) {\n // graphql errors pass through\n return {\n ...error,\n data: null,\n };\n }\n else {\n // non-graphql errors are re-thrown\n throw error;\n }\n}\n\nexport { handleListGraphQlError, handleSingularGraphQlError };\n//# sourceMappingURL=utils.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Symbol used for internal user agent overrides.\n *\n * @internal\n * This symbol is intended for internal use within the Amplify library.\n * It may change or be removed in future versions without notice.\n * External usage of this symbol is discouraged and may lead to unexpected behavior.\n */\nconst INTERNAL_USER_AGENT_OVERRIDE = Symbol('INTERNAL_USER_AGENT_OVERRIDE');\nvar AiAction;\n(function (AiAction) {\n AiAction[\"CreateConversation\"] = \"1\";\n AiAction[\"GetConversation\"] = \"2\";\n AiAction[\"ListConversations\"] = \"3\";\n AiAction[\"DeleteConversation\"] = \"4\";\n AiAction[\"SendMessage\"] = \"5\";\n AiAction[\"ListMessages\"] = \"6\";\n AiAction[\"OnStreamEvent\"] = \"7\";\n AiAction[\"Generation\"] = \"8\";\n AiAction[\"UpdateConversation\"] = \"9\";\n})(AiAction || (AiAction = {}));\nconst getCustomUserAgentDetails = (action) => ({\n category: 'ai',\n action,\n});\n/**\n * Creates a user agent override object based on custom details.\n *\n * @internal\n * This function is intended for internal use within the Amplify library.\n * It may change or be removed in future versions without notice.\n *\n * @param customUserAgentDetails - Optional custom user agent details\n * @returns An object with INTERNAL_USER_AGENT_OVERRIDE symbol as key and customUserAgentDetails as value, or undefined if no details provided\n */\nfunction createUserAgentOverride(customUserAgentDetails) {\n return customUserAgentDetails\n ? { [INTERNAL_USER_AGENT_OVERRIDE]: customUserAgentDetails }\n : undefined;\n}\n\nexport { AiAction, INTERNAL_USER_AGENT_OVERRIDE, createUserAgentOverride, getCustomUserAgentDetails };\n//# sourceMappingURL=getCustomUserAgentDetails.mjs.map\n","import { map } from 'rxjs';\nimport { authModeParams, getCustomHeaders, initializeModel, selectionSetIRToString, getDefaultSelectionSetForNonModelWithIR, generateSelectionSet } from '../APIClient.mjs';\nimport { handleSingularGraphQlError } from './utils.mjs';\nimport { selfAwareAsync } from '../../utils/selfAwareAsync.mjs';\nimport { extendCancellability } from '../cancellation.mjs';\nimport { createUserAgentOverride } from '../ai/getCustomUserAgentDetails.mjs';\n\n/**\n * Type guard for checking whether a Custom Operation argument is a contextSpec object\n */\nconst argIsContextSpec = (arg) => {\n return typeof arg?.token?.value === 'symbol';\n};\n/**\n * Builds an operation function, embedded with all client and context data, that\n * can be attached to a client as a custom query or mutation.\n *\n * If we have this source schema:\n *\n * ```typescript\n * a.schema({\n * echo: a.query()\n * .arguments({input: a.string().required()})\n * .returns(a.string())\n * })\n * ```\n *\n * Our model intro schema will contain an entry like this:\n *\n * ```ts\n * {\n * queries: {\n * echo: {\n * name: \"echo\",\n * isArray: false,\n * type: 'String',\n * isRequired: false,\n * arguments: {\n * input: {\n * name: 'input',\n * isArray: false,\n * type: String,\n * isRequired: true\n * }\n * }\n * }\n * }\n * }\n * ```\n *\n * The `echo` object is used to build the `echo' method that goes here:\n *\n * ```typescript\n * const client = generateClent()\n * const { data } = await client.queries.echo({input: 'a string'});\n * // ^\n * // |\n * // +-- This one right here.\n * //\n * ```\n *\n *\n * @param client The client to run graphql queries through.\n * @param modelIntrospection The model introspection schema the op comes from.\n * @param operationType The broad category of graphql operation.\n * @param operation The operation definition from the introspection schema.\n * @param useContext Whether the function needs to accept an SSR context.\n * @returns The operation function to attach to query, mutations, etc.\n */\nfunction customOpFactory(client, modelIntrospection, operationType, operation, useContext, getInternals, customUserAgentDetails) {\n // .arguments() are defined for the custom operation in the schema builder\n // and are present in the model introspection schema\n const argsDefined = operation.arguments !== undefined;\n const op = (...args) => {\n // options is always the last argument\n const options = args[args.length - 1];\n let contextSpec;\n let arg;\n if (useContext) {\n if (argIsContextSpec(args[0])) {\n contextSpec = args[0];\n }\n else {\n throw new Error(`Invalid first argument passed to ${operation.name}. Expected contextSpec`);\n }\n }\n if (argsDefined) {\n if (useContext) {\n arg = args[1];\n }\n else {\n arg = args[0];\n }\n }\n if (operationType === 'subscription') {\n return _opSubscription(\n // subscriptions are only enabled on the clientside\n client, modelIntrospection, operation, getInternals, arg, options, customUserAgentDetails);\n }\n return _op(client, modelIntrospection, operationType, operation, getInternals, arg, options, contextSpec, customUserAgentDetails);\n };\n return op;\n}\n/**\n * Runtime test and type guard to check whether `o[field]` is a `String`.\n *\n * ```typescript\n * if (hasStringField(o, 'prop')) {\n * const s = o.prop;\n * // ^? const s: string\n * }\n * ```\n *\n * @param o Object to inspect\n * @param field Field to look for\n * @returns Boolean: `true` if the `o[field]` is a `string`\n */\nfunction hasStringField(o, field) {\n return typeof o[field] === 'string';\n}\nfunction isEnumType(type) {\n return type instanceof Object && 'enum' in type;\n}\nfunction isInputType(type) {\n return type instanceof Object && 'input' in type;\n}\n/**\n * @param argDef A single argument definition from a custom operation\n * @returns A string naming the base type including the `!` if the arg is required.\n */\nfunction argumentBaseTypeString({ type, isRequired }) {\n const requiredFlag = isRequired ? '!' : '';\n if (isEnumType(type)) {\n return `${type.enum}${requiredFlag}`;\n }\n if (isInputType(type)) {\n return `${type.input}${requiredFlag}`;\n }\n return `${type}${requiredFlag}`;\n}\n/**\n * Generates \"outer\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n * echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the top/outer level arguments as a string:\n *\n * ```json\n * \"InputString: String!\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction outerArguments(operation) {\n if (operation.arguments === undefined) {\n return '';\n }\n const args = Object.entries(operation.arguments)\n .map(([k, argument]) => {\n const baseType = argumentBaseTypeString(argument);\n const finalType = argument.isArray\n ? `[${baseType}]${argument.isArrayNullable ? '' : '!'}`\n : baseType;\n return `$${k}: ${finalType}`;\n })\n .join(', ');\n return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Generates \"inner\" arguments string for a custom operation. For example,\n * in this operation:\n *\n * ```graphql\n * query MyQuery(InputString: String!) {\n * echoString(InputString: $InputString)\n * }\n * ```\n *\n * This function returns the inner arguments as a string:\n *\n * ```json\n * \"InputString: $InputString\"\n * ```\n *\n * @param operation Operation object from model introspection schema.\n * @returns \"outer\" arguments string\n */\nfunction innerArguments(operation) {\n if (operation.arguments === undefined) {\n return '';\n }\n const args = Object.keys(operation.arguments)\n .map((k) => `${k}: $${k}`)\n .join(', ');\n return args.length > 0 ? `(${args})` : '';\n}\n/**\n * Generates the selection set string for a custom operation. This is slightly\n * different than the selection set generation for models. If the custom op returns\n * a primitive or enum types, it doesn't require a selection set at all.\n *\n * E.g., the graphql might look like this:\n *\n * ```graphql\n * query MyQuery {\n * echoString(inputString: \"whatever\")\n * }\n * # ^\n * # |\n * # +-- no selection set\n * ```\n *\n * Non-primitive return type selection set generation will be similar to other\n * model operations.\n *\n * @param modelIntrospection The full code-generated introspection schema.\n * @param operation The operation object from the schema.\n * @returns The selection set as a string.\n */\nfunction operationSelectionSet(modelIntrospection, operation) {\n if (hasStringField(operation, 'type') ||\n hasStringField(operation.type, 'enum')) {\n return '';\n }\n else if (hasStringField(operation.type, 'nonModel')) {\n const nonModel = modelIntrospection.nonModels[operation.type.nonModel];\n return `{${selectionSetIRToString(getDefaultSelectionSetForNonModelWithIR(nonModel, modelIntrospection))}}`;\n }\n else if (hasStringField(operation.type, 'model')) {\n return `{${generateSelectionSet(modelIntrospection, operation.type.model)}}`;\n }\n else {\n return '';\n }\n}\n/**\n * Maps an arguments objec to graphql variables, removing superfluous args and\n * screaming loudly when required args are missing.\n *\n * @param operation The operation to construct graphql request variables for.\n * @param args The arguments to map variables from.\n * @returns The graphql variables object.\n */\nfunction operationVariables(operation, args = {}) {\n const variables = {};\n if (operation.arguments === undefined) {\n return variables;\n }\n for (const argDef of Object.values(operation.arguments)) {\n if (typeof args[argDef.name] !== 'undefined') {\n variables[argDef.name] = args[argDef.name];\n }\n else if (argDef.isRequired) {\n // At this point, the variable is both required and missing: We don't need\n // to continue. The operation is expected to fail.\n throw new Error(`${operation.name} requires arguments '${argDef.name}'`);\n }\n }\n return variables;\n}\n/**\n * Executes an operation from the given model intro schema against a client, returning\n * a fully instantiated model when relevant.\n *\n * @param client The client to operate `graphql()` calls through.\n * @param modelIntrospection The model intro schema to construct requests from.\n * @param operationType The high level graphql operation type.\n * @param operation The specific operation name, args, return type details.\n * @param args The arguments to provide to the operation as variables.\n * @param options Request options like headers, etc.\n * @param context SSR context if relevant.\n * @returns Result from the graphql request, model-instantiated when relevant.\n */\nfunction _op(client, modelIntrospection, operationType, operation, getInternals, args, options, context, customUserAgentDetails) {\n return selfAwareAsync(async (resultPromise) => {\n const { name: operationName } = operation;\n const auth = authModeParams(client, getInternals, options);\n const headers = getCustomHeaders(client, getInternals, options?.headers);\n const outerArgsString = outerArguments(operation);\n const innerArgsString = innerArguments(operation);\n const selectionSet = operationSelectionSet(modelIntrospection, operation);\n const returnTypeModelName = hasStringField(operation.type, 'model')\n ? operation.type.model\n : undefined;\n const query = `\n ${operationType.toLocaleLowerCase()}${outerArgsString} {\n ${operationName}${innerArgsString} ${selectionSet}\n }\n `;\n const variables = operationVariables(operation, args);\n const userAgentOverride = createUserAgentOverride(customUserAgentDetails);\n try {\n const basePromise = context\n ? client.graphql(context, {\n ...auth,\n query,\n variables,\n }, headers)\n : client.graphql({\n ...auth,\n query,\n variables,\n ...userAgentOverride,\n }, headers);\n const extendedPromise = extendCancellability(basePromise, resultPromise);\n const { data, extensions } = await extendedPromise;\n // flatten response\n if (data) {\n const [key] = Object.keys(data);\n const isArrayResult = Array.isArray(data[key]);\n // TODO: when adding support for custom selection set, flattening will need\n // to occur recursively. For now, it's expected that related models are not\n // present in the result. Only FK's are present. Any related model properties\n // should be replaced with lazy loaders under the current implementation.\n const flattenedResult = isArrayResult\n ? data[key].filter((x) => x)\n : data[key];\n // TODO: custom selection set. current selection set is default selection set only\n // custom selection set requires data-schema-type + runtime updates above.\n const initialized = returnTypeModelName\n ? initializeModel(client, returnTypeModelName, isArrayResult ? flattenedResult : [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)\n : flattenedResult;\n return {\n data: !isArrayResult && Array.isArray(initialized)\n ? initialized.shift()\n : initialized,\n extensions,\n };\n }\n else {\n return { data: null, extensions };\n }\n }\n catch (error) {\n /**\n * The `data` type returned by `error` here could be:\n * 1) `null`\n * 2) an empty object\n * 3) \"populated\" but with a `null` value `{ getPost: null }`\n * 4) an actual record `{ getPost: { id: '1', title: 'Hello, World!' } }`\n */\n const { data, errors } = error;\n /**\n * `data` is not `null`, and is not an empty object:\n */\n if (data && Object.keys(data).length !== 0 && errors) {\n const [key] = Object.keys(data);\n const isArrayResult = Array.isArray(data[key]);\n // TODO: when adding support for custom selection set, flattening will need\n // to occur recursively. For now, it's expected that related models are not\n // present in the result. Only FK's are present. Any related model properties\n // should be replaced with lazy loaders under the current implementation.\n const flattenedResult = isArrayResult\n ? data[key].filter((x) => x)\n : data[key];\n /**\n * `flattenedResult` could be `null` here (e.g. `data: { getPost: null }`)\n * if `flattenedResult`, result is an actual record:\n */\n if (flattenedResult) {\n // TODO: custom selection set. current selection set is default selection set only\n // custom selection set requires data-schema-type + runtime updates above.\n const initialized = returnTypeModelName\n ? initializeModel(client, returnTypeModelName, isArrayResult ? flattenedResult : [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context)\n : flattenedResult;\n return {\n data: !isArrayResult && Array.isArray(initialized)\n ? initialized.shift()\n : initialized,\n errors,\n };\n }\n else {\n // was `data: { getPost: null }`)\n return handleSingularGraphQlError(error);\n }\n }\n else {\n // `data` is `null`:\n return handleSingularGraphQlError(error);\n }\n }\n });\n}\n/**\n * Executes an operation from the given model intro schema against a client, returning\n * a fully instantiated model when relevant.\n *\n * @param client The client to operate `graphql()` calls through.\n * @param modelIntrospection The model intro schema to construct requests from.\n * @param operation The specific operation name, args, return type details.\n * @param args The arguments to provide to the operation as variables.\n * @param options Request options like headers, etc.\n * @returns Result from the graphql request, model-instantiated when relevant.\n */\nfunction _opSubscription(client, modelIntrospection, operation, getInternals, args, options, customUserAgentDetails) {\n const operationType = 'subscription';\n const { name: operationName } = operation;\n const auth = authModeParams(client, getInternals, options);\n const headers = getCustomHeaders(client, getInternals, options?.headers);\n const outerArgsString = outerArguments(operation);\n const innerArgsString = innerArguments(operation);\n const selectionSet = operationSelectionSet(modelIntrospection, operation);\n const returnTypeModelName = hasStringField(operation.type, 'model')\n ? operation.type.model\n : undefined;\n const query = `\n ${operationType.toLocaleLowerCase()}${outerArgsString} {\n ${operationName}${innerArgsString} ${selectionSet}\n }\n `;\n const variables = operationVariables(operation, args);\n const userAgentOverride = createUserAgentOverride(customUserAgentDetails);\n const observable = client.graphql({\n ...auth,\n query,\n variables,\n ...userAgentOverride,\n }, headers);\n return observable.pipe(map((value) => {\n const [key] = Object.keys(value.data);\n const data = value.data[key];\n const [initialized] = returnTypeModelName\n ? initializeModel(client, returnTypeModelName, [data], modelIntrospection, auth.authMode, auth.authToken)\n : [data];\n return initialized;\n }));\n}\n\nexport { customOpFactory };\n//# sourceMappingURL=custom.mjs.map\n","import { customOpFactory } from './operations/custom.mjs';\n\nconst operationTypeMap = {\n queries: 'query',\n mutations: 'mutation',\n subscriptions: 'subscription',\n};\nfunction generateCustomOperationsProperty(client, config, operationsType, getInternals) {\n // some bundlers end up with `Amplify.configure` being called *after* generate client.\n // if that occurs, we need to *not error* while we wait. handling for late configuration\n // occurs in `generateClient()`. we do not need to subscribe to Hub events here.\n if (!config) {\n return {};\n }\n const modelIntrospection = config.modelIntrospection;\n // model intro schema might be absent if there's not actually a configured GraphQL API\n if (!modelIntrospection) {\n return {};\n }\n // custom operations will be absent from model intro schema if no custom ops\n // are present on the source schema.\n const operations = modelIntrospection[operationsType];\n if (!operations) {\n return {};\n }\n const ops = {};\n const useContext = getInternals(client).amplify === null;\n for (const operation of Object.values(operations)) {\n ops[operation.name] = customOpFactory(client, modelIntrospection, operationTypeMap[operationsType], operation, useContext, getInternals);\n }\n return ops;\n}\nfunction generateCustomMutationsProperty(client, config, getInternals) {\n return generateCustomOperationsProperty(client, config, 'mutations', getInternals);\n}\nfunction generateCustomQueriesProperty(client, config, getInternals) {\n return generateCustomOperationsProperty(client, config, 'queries', getInternals);\n}\nfunction generateCustomSubscriptionsProperty(client, config, getInternals) {\n return generateCustomOperationsProperty(client, config, 'subscriptions', getInternals);\n}\n\nexport { generateCustomMutationsProperty, generateCustomOperationsProperty, generateCustomQueriesProperty, generateCustomSubscriptionsProperty };\n//# sourceMappingURL=generateCustomOperationsProperty.mjs.map\n","import { generateGraphQLDocument, buildGraphQLVariables, authModeParams, getCustomHeaders, flattenItems, initializeModel } from '../APIClient.mjs';\nimport { handleSingularGraphQlError } from './utils.mjs';\nimport { selfAwareAsync } from '../../utils/selfAwareAsync.mjs';\nimport { extendCancellability } from '../cancellation.mjs';\nimport { createUserAgentOverride } from '../ai/getCustomUserAgentDetails.mjs';\n\nfunction getFactory(client, modelIntrospection, model, operation, getInternals, useContext = false, customUserAgentDetails) {\n const getWithContext = (contextSpec, arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, getInternals, contextSpec, customUserAgentDetails);\n };\n const get = (arg, options) => {\n return _get(client, modelIntrospection, model, arg, options, operation, getInternals, undefined, customUserAgentDetails);\n };\n return useContext ? getWithContext : get;\n}\nfunction _get(client, modelIntrospection, model, arg, options, operation, getInternals, context, customUserAgentDetails) {\n return selfAwareAsync(async (resultPromise) => {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection, model, operation, options);\n const variables = buildGraphQLVariables(model, operation, arg, modelIntrospection);\n const auth = authModeParams(client, getInternals, options);\n const headers = getCustomHeaders(client, getInternals, options?.headers);\n const userAgentOverride = createUserAgentOverride(customUserAgentDetails);\n try {\n const basePromise = context\n ? client.graphql(context, {\n ...auth,\n query,\n variables,\n }, headers)\n : client.graphql({\n ...auth,\n query,\n variables,\n ...userAgentOverride,\n }, headers);\n const extendedPromise = extendCancellability(basePromise, resultPromise);\n const { data, extensions } = await extendedPromise;\n // flatten response\n if (data) {\n const [key] = Object.keys(data);\n const flattenedResult = flattenItems(modelIntrospection, name, data[key]);\n if (flattenedResult === null) {\n return { data: null, extensions };\n }\n else if (options?.selectionSet) {\n return { data: flattenedResult, extensions };\n }\n else {\n // TODO: refactor to avoid destructuring here\n const [initialized] = initializeModel(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context);\n return { data: initialized, extensions };\n }\n }\n else {\n return { data: null, extensions };\n }\n }\n catch (error) {\n /**\n * The `data` type returned by `error` here could be:\n * 1) `null`\n * 2) an empty object\n * 3) \"populated\" but with a `null` value `{ getPost: null }`\n * 4) an actual record `{ getPost: { id: '1', title: 'Hello, World!' } }`\n */\n const { data, errors } = error;\n /**\n * `data` is not `null`, and is not an empty object:\n */\n if (data && Object.keys(data).length !== 0 && errors) {\n const [key] = Object.keys(data);\n const flattenedResult = flattenItems(modelIntrospection, name, data[key]);\n /**\n * `flattenedResult` could be `null` here (e.g. `data: { getPost: null }`)\n * if `flattenedResult`, result is an actual record:\n */\n if (flattenedResult) {\n if (options?.selectionSet) {\n return { data: flattenedResult, errors };\n }\n else {\n // TODO: refactor to avoid destructuring here\n const [initialized] = initializeModel(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken, !!context);\n return { data: initialized, errors };\n }\n }\n else {\n // was `data: { getPost: null }`)\n return handleSingularGraphQlError(error);\n }\n }\n else {\n // `data` is `null`:\n return handleSingularGraphQlError(error);\n }\n }\n });\n}\n\nexport { getFactory };\n//# sourceMappingURL=get.mjs.map\n","import { generateGraphQLDocument, buildGraphQLVariables, authModeParams, getCustomHeaders, flattenItems, initializeModel } from '../APIClient.mjs';\nimport { handleListGraphQlError } from './utils.mjs';\nimport { selfAwareAsync } from '../../utils/selfAwareAsync.mjs';\nimport { extendCancellability } from '../cancellation.mjs';\nimport { createUserAgentOverride } from '../ai/getCustomUserAgentDetails.mjs';\n\nfunction listFactory(client, modelIntrospection, model, getInternals, context = false, customUserAgentDetails) {\n const listWithContext = (contextSpec, args) => {\n return _list(client, modelIntrospection, model, getInternals, args, contextSpec, customUserAgentDetails);\n };\n const list = (args) => {\n return _list(client, modelIntrospection, model, getInternals, args, undefined, customUserAgentDetails);\n };\n return context ? listWithContext : list;\n}\nfunction _list(client, modelIntrospection, model, getInternals, args, contextSpec, customUserAgentDetails) {\n return selfAwareAsync(async (resultPromise) => {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection, model, 'LIST', args);\n const variables = buildGraphQLVariables(model, 'LIST', args, modelIntrospection);\n const auth = authModeParams(client, getInternals, args);\n const headers = getCustomHeaders(client, getInternals, args?.headers);\n const userAgentOverride = createUserAgentOverride(customUserAgentDetails);\n try {\n const basePromise = contextSpec\n ? client.graphql(contextSpec, {\n ...auth,\n query,\n variables,\n }, headers)\n : client.graphql({\n ...auth,\n query,\n variables,\n ...userAgentOverride,\n }, headers);\n const extendedPromise = extendCancellability(basePromise, resultPromise);\n const { data, extensions } = await extendedPromise;\n // flatten response\n if (data !== undefined) {\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = data[key].items.map((value) => flattenItems(modelIntrospection, name, value));\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n else {\n const initialized = initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n return {\n data: initialized,\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n }\n catch (error) {\n /**\n * The `data` type returned by `error` here could be:\n * 1) `null`\n * 2) an empty object\n * 3) \"populated\" but with a `null` value `data: { listPosts: null }`\n * 4) actual records `data: { listPosts: items: [{ id: '1', ...etc }] }`\n */\n const { data, errors } = error;\n // `data` is not `null`, and is not an empty object:\n if (data !== undefined &&\n data !== null &&\n Object.keys(data).length !== 0 &&\n errors) {\n const [key] = Object.keys(data);\n if (data[key]?.items) {\n const flattenedResult = data[key].items.map((value) => flattenItems(modelIntrospection, name, value));\n /**\n * Check exists since `flattenedResult` could be `null`.\n * if `flattenedResult` exists, result is an actual record.\n */\n if (flattenedResult) {\n // don't init if custom selection set\n if (args?.selectionSet) {\n return {\n data: flattenedResult,\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n else {\n const initialized = initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n // data is full record w/out selection set:\n return {\n data: initialized,\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n }\n return {\n data: data[key],\n nextToken: data[key]?.nextToken,\n errors,\n };\n }\n else {\n // response is of type `data: { getPost: null }`)\n return handleListGraphQlError(error);\n }\n }\n else {\n // `data` is `null` or an empty object:\n return handleListGraphQlError(error);\n }\n }\n });\n}\n\nexport { listFactory };\n//# sourceMappingURL=list.mjs.map\n","const alphabetByEncoding = {};\nconst alphabetByValue = new Array(64);\nfor (let i = 0, start = \"A\".charCodeAt(0), limit = \"Z\".charCodeAt(0); i + start <= limit; i++) {\n const char = String.fromCharCode(i + start);\n alphabetByEncoding[char] = i;\n alphabetByValue[i] = char;\n}\nfor (let i = 0, start = \"a\".charCodeAt(0), limit = \"z\".charCodeAt(0); i + start <= limit; i++) {\n const char = String.fromCharCode(i + start);\n const index = i + 26;\n alphabetByEncoding[char] = index;\n alphabetByValue[index] = char;\n}\nfor (let i = 0; i < 10; i++) {\n alphabetByEncoding[i.toString(10)] = i + 52;\n const char = i.toString(10);\n const index = i + 52;\n alphabetByEncoding[char] = index;\n alphabetByValue[index] = char;\n}\nalphabetByEncoding[\"+\"] = 62;\nalphabetByValue[62] = \"+\";\nalphabetByEncoding[\"/\"] = 63;\nalphabetByValue[63] = \"/\";\nconst bitsPerLetter = 6;\nconst bitsPerByte = 8;\nconst maxLetterValue = 0b111111;\nexport { alphabetByEncoding, alphabetByValue, bitsPerLetter, bitsPerByte, maxLetterValue };\n","import { alphabetByEncoding, bitsPerByte, bitsPerLetter } from \"./constants.browser\";\nexport const fromBase64 = (input) => {\n let totalByteLength = (input.length / 4) * 3;\n if (input.slice(-2) === \"==\") {\n totalByteLength -= 2;\n }\n else if (input.slice(-1) === \"=\") {\n totalByteLength--;\n }\n const out = new ArrayBuffer(totalByteLength);\n const dataView = new DataView(out);\n for (let i = 0; i < input.length; i += 4) {\n let bits = 0;\n let bitLength = 0;\n for (let j = i, limit = i + 3; j <= limit; j++) {\n if (input[j] !== \"=\") {\n if (!(input[j] in alphabetByEncoding)) {\n throw new TypeError(`Invalid character ${input[j]} in base64 string.`);\n }\n bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);\n bitLength += bitsPerLetter;\n }\n else {\n bits >>= bitsPerLetter;\n }\n }\n const chunkOffset = (i / 4) * 3;\n bits >>= bitLength % bitsPerByte;\n const byteLength = Math.floor(bitLength / bitsPerByte);\n for (let k = 0; k < byteLength; k++) {\n const offset = (byteLength - k - 1) * bitsPerByte;\n dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);\n }\n }\n return new Uint8Array(out);\n};\n","export const fromUtf8 = (input) => new TextEncoder().encode(input);\n","import { fromUtf8 } from \"@smithy/util-utf8\";\nimport { alphabetByValue, bitsPerByte, bitsPerLetter, maxLetterValue } from \"./constants.browser\";\nexport function toBase64(_input) {\n let input;\n if (typeof _input === \"string\") {\n input = fromUtf8(_input);\n }\n else {\n input = _input;\n }\n const isArrayLike = typeof input === \"object\" && typeof input.length === \"number\";\n const isUint8Array = typeof input === \"object\" &&\n typeof input.byteOffset === \"number\" &&\n typeof input.byteLength === \"number\";\n if (!isArrayLike && !isUint8Array) {\n throw new Error(\"@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.\");\n }\n let str = \"\";\n for (let i = 0; i < input.length; i += 3) {\n let bits = 0;\n let bitLength = 0;\n for (let j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {\n bits |= input[j] << ((limit - j - 1) * bitsPerByte);\n bitLength += bitsPerByte;\n }\n const bitClusterCount = Math.ceil(bitLength / bitsPerLetter);\n bits <<= bitClusterCount * bitsPerLetter - bitLength;\n for (let k = 1; k <= bitClusterCount; k++) {\n const offset = (bitClusterCount - k) * bitsPerLetter;\n str += alphabetByValue[(bits & (maxLetterValue << offset)) >> offset];\n }\n str += \"==\".slice(0, 4 - bitClusterCount);\n }\n return str;\n}\n","export * from \"./fromBase64\";\nexport * from \"./toBase64\";\n","import { fromBase64 } from '@smithy/util-base64';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst deserializeContent = (content) => content.map((block) => {\n if (block.image) {\n return deserializeImageBlock(block);\n }\n if (block.toolUse) {\n return deserializeToolUseBlock(block);\n }\n if (block.toolResult) {\n return deserializeToolResultBlock(block);\n }\n return removeNullsFromBlock(block);\n});\nconst deserializeImageBlock = ({ image }) => ({\n image: {\n ...image,\n source: {\n ...image.source,\n bytes: fromBase64(image.source.bytes),\n },\n },\n});\nconst deserializeJsonBlock = ({ json }) => ({\n json: JSON.parse(json),\n});\nconst deserializeToolUseBlock = ({ toolUse }) => ({\n toolUse: {\n ...toolUse,\n input: JSON.parse(toolUse.input),\n },\n});\nconst deserializeToolResultBlock = ({ toolResult, }) => ({\n toolResult: {\n toolUseId: toolResult.toolUseId,\n content: toolResult.content.map((toolResultBlock) => {\n if (toolResultBlock.image) {\n return deserializeImageBlock(toolResultBlock);\n }\n if (toolResultBlock.json) {\n return deserializeJsonBlock(toolResultBlock);\n }\n return removeNullsFromBlock(toolResultBlock);\n }),\n },\n});\nconst removeNullsFromBlock = (block) => Object.fromEntries(Object.entries(block).filter(([_, v]) => v !== null));\n\nexport { deserializeContent };\n//# sourceMappingURL=conversationMessageDeserializers.mjs.map\n","import { deserializeContent } from './conversationMessageDeserializers.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst convertItemToConversationMessage = ({ content, createdAt, id, conversationId, role, }) => ({\n content: deserializeContent(content ?? []),\n conversationId,\n createdAt,\n id,\n role,\n});\n\nexport { convertItemToConversationMessage };\n//# sourceMappingURL=convertItemToConversationMessage.mjs.map\n","import { listFactory } from '../operations/list.mjs';\nimport { convertItemToConversationMessage } from './convertItemToConversationMessage.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createListMessagesFunction = (client, modelIntrospection, conversationId, conversationMessageModel, getInternals) => async (input) => {\n const list = listFactory(client, modelIntrospection, conversationMessageModel, getInternals, false, getCustomUserAgentDetails(AiAction.ListMessages));\n const { data, nextToken, errors } = await list({\n ...input,\n filter: { conversationId: { eq: conversationId } },\n });\n return {\n data: data.map((item) => convertItemToConversationMessage(item)),\n nextToken,\n errors,\n };\n};\n\nexport { createListMessagesFunction };\n//# sourceMappingURL=createListMessagesFunction.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst convertItemToConversationStreamEvent = ({ id, conversationId, associatedUserMessageId, contentBlockIndex, contentBlockDoneAtIndex, contentBlockDeltaIndex, contentBlockText, contentBlockToolUse, stopReason, errors, }) => {\n if (errors) {\n const error = {\n id,\n conversationId,\n associatedUserMessageId,\n errors,\n };\n return { error };\n }\n const next = removeNullsFromConversationStreamEvent({\n id,\n conversationId,\n associatedUserMessageId,\n contentBlockIndex,\n contentBlockDoneAtIndex,\n contentBlockDeltaIndex,\n text: contentBlockText,\n toolUse: deserializeToolUseBlock(contentBlockToolUse),\n stopReason,\n });\n return { next };\n};\nconst deserializeToolUseBlock = (contentBlockToolUse) => {\n if (contentBlockToolUse) {\n const toolUseBlock = {\n ...contentBlockToolUse,\n input: JSON.parse(contentBlockToolUse.input),\n };\n return toolUseBlock;\n }\n};\nconst removeNullsFromConversationStreamEvent = (block) => Object.fromEntries(Object.entries(block).filter(([_, v]) => v !== null));\n\nexport { convertItemToConversationStreamEvent };\n//# sourceMappingURL=conversationStreamEventDeserializers.mjs.map\n","import { customOpFactory } from '../operations/custom.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\nimport { convertItemToConversationStreamEvent } from './conversationStreamEventDeserializers.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createOnStreamEventFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => (handler) => {\n const { conversations } = modelIntrospection;\n // Safe guard for standalone function. When called as part of client generation, this should never be falsy.\n if (!conversations) {\n return {};\n }\n const subscribeSchema = conversations[conversationRouteName].message.subscribe;\n const subscribeOperation = customOpFactory(client, modelIntrospection, 'subscription', subscribeSchema, false, getInternals, getCustomUserAgentDetails(AiAction.OnStreamEvent));\n return subscribeOperation({ conversationId }).subscribe((data) => {\n const { next, error } = convertItemToConversationStreamEvent(data);\n if (error)\n handler.error(error);\n if (next)\n handler.next(next);\n });\n};\n\nexport { createOnStreamEventFunction };\n//# sourceMappingURL=createOnStreamEventFunction.mjs.map\n","import { toBase64 } from '@smithy/util-base64';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst serializeAiContext = (aiContext) => JSON.stringify(aiContext);\nconst serializeContent = (content) => content.map((block) => {\n if (block.image) {\n return serializeImageBlock(block);\n }\n if (block.toolResult) {\n return serializeToolResultBlock(block);\n }\n return block;\n});\nconst serializeToolConfiguration = ({ tools }) => ({\n tools: Object.entries(tools).map(([name, tool]) => ({\n toolSpec: {\n name,\n description: tool.description,\n inputSchema: {\n json: JSON.stringify(tool.inputSchema.json),\n },\n },\n })),\n});\nconst serializeImageBlock = ({ image }) => ({\n image: {\n ...image,\n source: {\n ...image.source,\n bytes: toBase64(image.source.bytes),\n },\n },\n});\nconst serializeJsonBlock = ({ json }) => ({\n json: JSON.stringify(json),\n});\nconst serializeToolResultBlock = ({ toolResult, }) => ({\n toolResult: {\n ...toolResult,\n content: toolResult.content.map((toolResultBlock) => {\n if (toolResultBlock.image) {\n return serializeImageBlock(toolResultBlock);\n }\n if (toolResultBlock.json) {\n return serializeJsonBlock(toolResultBlock);\n }\n return toolResultBlock;\n }),\n },\n});\n\nexport { serializeAiContext, serializeContent, serializeToolConfiguration };\n//# sourceMappingURL=conversationMessageSerializers.mjs.map\n","import { customOpFactory } from '../operations/custom.mjs';\nimport { convertItemToConversationMessage } from './convertItemToConversationMessage.mjs';\nimport { serializeContent, serializeAiContext, serializeToolConfiguration } from './conversationMessageSerializers.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createSendMessageFunction = (client, modelIntrospection, conversationId, conversationRouteName, getInternals) => async (input) => {\n const { conversations } = modelIntrospection;\n // Safe guard for standalone function. When called as part of client generation, this should never be falsy.\n if (!conversations) {\n return {};\n }\n const processedInput = typeof input === 'string' ? { content: [{ text: input }] } : input;\n const { content, aiContext, toolConfiguration } = processedInput;\n const sendSchema = conversations[conversationRouteName].message.send;\n const sendOperation = customOpFactory(client, modelIntrospection, 'mutation', sendSchema, false, getInternals, getCustomUserAgentDetails(AiAction.SendMessage));\n const { data, errors } = await sendOperation({\n conversationId,\n content: serializeContent(content),\n ...(aiContext && { aiContext: serializeAiContext(aiContext) }),\n ...(toolConfiguration && {\n toolConfiguration: serializeToolConfiguration(toolConfiguration),\n }),\n });\n return {\n data: data ? convertItemToConversationMessage(data) : data,\n errors,\n };\n};\n\nexport { createSendMessageFunction };\n//# sourceMappingURL=createSendMessageFunction.mjs.map\n","import { createListMessagesFunction } from './createListMessagesFunction.mjs';\nimport { createOnStreamEventFunction } from './createOnStreamEventFunction.mjs';\nimport { createSendMessageFunction } from './createSendMessageFunction.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst convertItemToConversation = (client, modelIntrospection, conversationId, conversationCreatedAt, conversationUpdatedAt, conversationRouteName, conversationMessageModel, getInternals, conversationMetadata, conversationName) => {\n if (!conversationId) {\n throw new Error(`An error occurred converting a ${conversationRouteName} conversation: Missing ID`);\n }\n return {\n id: conversationId,\n createdAt: conversationCreatedAt,\n updatedAt: conversationUpdatedAt,\n metadata: conversationMetadata,\n name: conversationName,\n onStreamEvent: createOnStreamEventFunction(client, modelIntrospection, conversationId, conversationRouteName, getInternals),\n sendMessage: createSendMessageFunction(client, modelIntrospection, conversationId, conversationRouteName, getInternals),\n listMessages: createListMessagesFunction(client, modelIntrospection, conversationId, conversationMessageModel, getInternals),\n };\n};\n\nexport { convertItemToConversation };\n//# sourceMappingURL=convertItemToConversation.mjs.map\n","import { getFactory } from '../operations/get.mjs';\nimport { convertItemToConversation } from './convertItemToConversation.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createCreateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async (input) => {\n const { name, metadata: metadataObject } = input ?? {};\n const metadata = JSON.stringify(metadataObject);\n const createOperation = getFactory(client, modelIntrospection, conversationModel, 'CREATE', getInternals, false, getCustomUserAgentDetails(AiAction.CreateConversation));\n const { data, errors } = await createOperation({ name, metadata });\n return {\n data: convertItemToConversation(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name),\n errors,\n };\n};\n\nexport { createCreateConversationFunction };\n//# sourceMappingURL=createCreateConversationFunction.mjs.map\n","import { getFactory } from '../operations/get.mjs';\nimport { convertItemToConversation } from './convertItemToConversation.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createGetConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const get = getFactory(client, modelIntrospection, conversationModel, 'GET', getInternals, false, getCustomUserAgentDetails(AiAction.GetConversation));\n const { data, errors } = await get({ id });\n return {\n data: data\n ? convertItemToConversation(client, modelIntrospection, data.id, data.createdAt, data.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)\n : data,\n errors,\n };\n};\n\nexport { createGetConversationFunction };\n//# sourceMappingURL=createGetConversationFunction.mjs.map\n","import { listFactory } from '../operations/list.mjs';\nimport { convertItemToConversation } from './convertItemToConversation.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createListConversationsFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async (input) => {\n const list = listFactory(client, modelIntrospection, conversationModel, getInternals, false, getCustomUserAgentDetails(AiAction.ListConversations));\n const { data, nextToken, errors } = await list(input);\n return {\n data: data.map((datum) => {\n return convertItemToConversation(client, modelIntrospection, datum.id, datum.createdAt, datum.updatedAt, conversationRouteName, conversationMessageModel, getInternals, datum?.metadata, datum?.name);\n }),\n nextToken,\n errors,\n };\n};\n\nexport { createListConversationsFunction };\n//# sourceMappingURL=createListConversationsFunction.mjs.map\n","import { getFactory } from '../operations/get.mjs';\nimport { convertItemToConversation } from './convertItemToConversation.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createDeleteConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id }) => {\n const deleteOperation = getFactory(client, modelIntrospection, conversationModel, 'DELETE', getInternals, false, getCustomUserAgentDetails(AiAction.DeleteConversation));\n const { data, errors } = await deleteOperation({ id });\n return {\n data: data\n ? convertItemToConversation(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)\n : data,\n errors,\n };\n};\n\nexport { createDeleteConversationFunction };\n//# sourceMappingURL=createDeleteConversationFunction.mjs.map\n","import { getFactory } from '../operations/get.mjs';\nimport { convertItemToConversation } from './convertItemToConversation.mjs';\nimport { getCustomUserAgentDetails, AiAction } from './getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createUpdateConversationFunction = (client, modelIntrospection, conversationRouteName, conversationModel, conversationMessageModel, getInternals) => async ({ id, metadata: metadataObject, name }) => {\n const metadata = JSON.stringify(metadataObject);\n const updateOperation = getFactory(client, modelIntrospection, conversationModel, 'UPDATE', getInternals, false, getCustomUserAgentDetails(AiAction.UpdateConversation));\n const { data, errors } = await updateOperation({ id, metadata, name });\n return {\n data: data\n ? convertItemToConversation(client, modelIntrospection, data?.id, data?.createdAt, data?.updatedAt, conversationRouteName, conversationMessageModel, getInternals, data?.metadata, data?.name)\n : data,\n errors,\n };\n};\n\nexport { createUpdateConversationFunction };\n//# sourceMappingURL=createUpdateConversationFunction.mjs.map\n","import { createCreateConversationFunction } from '../../ai/createCreateConversationFunction.mjs';\nimport { createGetConversationFunction } from '../../ai/createGetConversationFunction.mjs';\nimport { createListConversationsFunction } from '../../ai/createListConversationsFunction.mjs';\nimport { createDeleteConversationFunction } from '../../ai/createDeleteConversationFunction.mjs';\nimport { createUpdateConversationFunction } from '../../ai/createUpdateConversationFunction.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction generateConversationsProperty(client, apiGraphQLConfig, getInternals) {\n const modelIntrospection = apiGraphQLConfig?.modelIntrospection;\n // conversations will be absent from model intro schema if no conversation routes\n // are present on the source schema.\n if (!modelIntrospection?.conversations) {\n return {};\n }\n const conversations = {};\n for (const { name, conversation, message, models, nonModels, enums, } of Object.values(modelIntrospection.conversations)) {\n const conversationModel = models[conversation.modelName];\n const conversationMessageModel = models[message.modelName];\n if (!conversationModel || !conversationMessageModel) {\n return {};\n }\n const conversationModelIntrospection = {\n ...modelIntrospection,\n models: {\n ...modelIntrospection.models,\n ...models,\n },\n nonModels: {\n ...modelIntrospection.nonModels,\n ...nonModels,\n },\n enums: {\n ...modelIntrospection.enums,\n ...enums,\n },\n };\n conversations[name] = {\n update: createUpdateConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n create: createCreateConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n get: createGetConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n delete: createDeleteConversationFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n list: createListConversationsFunction(client, conversationModelIntrospection, name, conversationModel, conversationMessageModel, getInternals),\n };\n }\n return conversations;\n}\n\nexport { generateConversationsProperty };\n//# sourceMappingURL=generateConversationsProperty.mjs.map\n","import { customOpFactory } from '../../operations/custom.mjs';\nimport { getCustomUserAgentDetails, AiAction } from '../../ai/getCustomUserAgentDetails.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction generateGenerationsProperty(client, apiGraphQLConfig, getInternals) {\n const modelIntrospection = apiGraphQLConfig?.modelIntrospection;\n // generations will be absent from model intro schema if no generation routes\n // are present on the source schema.\n if (!modelIntrospection?.generations) {\n return {};\n }\n const generations = {};\n for (const generation of Object.values(modelIntrospection.generations)) {\n generations[generation.name] = customOpFactory(client, modelIntrospection, 'query', generation, false, getInternals, getCustomUserAgentDetails(AiAction.Generation));\n }\n return generations;\n}\n\nexport { generateGenerationsProperty };\n//# sourceMappingURL=generateGenerationsProperty.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst generateEnumsProperty = (graphqlConfig) => {\n const modelIntrospection = graphqlConfig.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const enums = {};\n for (const [_, enumData] of Object.entries(modelIntrospection.enums)) {\n enums[enumData.name] = {\n values: () => enumData.values,\n };\n }\n return enums;\n};\n\nexport { generateEnumsProperty };\n//# sourceMappingURL=generateEnumsProperty.mjs.map\n","import { generateGraphQLDocument, buildGraphQLVariables, authModeParams, getCustomHeaders, flattenItems, initializeModel } from '../APIClient.mjs';\nimport { handleListGraphQlError } from './utils.mjs';\nimport { selfAwareAsync } from '../../utils/selfAwareAsync.mjs';\nimport { extendCancellability } from '../cancellation.mjs';\n\nfunction indexQueryFactory(client, modelIntrospection, model, indexMeta, getInternals, context = false) {\n const indexQueryWithContext = (contextSpec, args, options) => {\n return _indexQuery(client, modelIntrospection, model, indexMeta, getInternals, {\n ...args,\n ...options,\n }, contextSpec);\n };\n const indexQuery = (args, options) => {\n return _indexQuery(client, modelIntrospection, model, indexMeta, getInternals, {\n ...args,\n ...options,\n });\n };\n return context ? indexQueryWithContext : indexQuery;\n}\nfunction processGraphQlResponse(modelIntroSchema, modelName, result, selectionSet, modelInitializer) {\n const { data, extensions } = result;\n const [key] = Object.keys(data);\n if (data[key].items) {\n const flattenedResult = data[key].items.map((value) => flattenItems(modelIntroSchema, modelName, value));\n return {\n data: selectionSet ? flattenedResult : modelInitializer(flattenedResult),\n nextToken: data[key].nextToken,\n extensions,\n };\n }\n // Index queries are always list queries. No `items`? No flattening needed.\n return {\n data: data[key],\n nextToken: data[key].nextToken,\n extensions,\n };\n}\nfunction _indexQuery(client, modelIntrospection, model, indexMeta, getInternals, args, contextSpec) {\n return selfAwareAsync(async (resultPromise) => {\n const { name } = model;\n const query = generateGraphQLDocument(modelIntrospection, model, 'INDEX_QUERY', args, indexMeta);\n const variables = buildGraphQLVariables(model, 'INDEX_QUERY', args, modelIntrospection, indexMeta);\n const auth = authModeParams(client, getInternals, args);\n const modelInitializer = (flattenedResult) => initializeModel(client, name, flattenedResult, modelIntrospection, auth.authMode, auth.authToken, !!contextSpec);\n try {\n const headers = getCustomHeaders(client, getInternals, args?.headers);\n const graphQlParams = {\n ...auth,\n query,\n variables,\n };\n const requestArgs = [graphQlParams, headers];\n if (contextSpec !== undefined) {\n requestArgs.unshift(contextSpec);\n }\n const basePromise = client.graphql(...requestArgs);\n const extendedPromise = extendCancellability(basePromise, resultPromise);\n const response = await extendedPromise;\n if (response.data !== undefined) {\n return processGraphQlResponse(modelIntrospection, name, response, args?.selectionSet, modelInitializer);\n }\n }\n catch (error) {\n /**\n * The `data` type returned by `error` here could be:\n * 1) `null`\n * 2) an empty object\n * 3) \"populated\" but with a `null` value:\n * `data: { listByExampleId: null }`\n * 4) an actual record:\n * `data: { listByExampleId: items: [{ id: '1', ...etc } }]`\n */\n const { data, errors } = error;\n // `data` is not `null`, and is not an empty object:\n if (data !== undefined &&\n data !== null &&\n Object.keys(data).length !== 0 &&\n errors) {\n const [key] = Object.keys(data);\n if (data[key]?.items) {\n const flattenedResult = data[key]?.items.map((value) => flattenItems(modelIntrospection, name, value));\n /**\n * Check exists since `flattenedResult` could be `null`.\n * if `flattenedResult` exists, result is an actual record.\n */\n if (flattenedResult) {\n return {\n data: args?.selectionSet\n ? flattenedResult\n : modelInitializer(flattenedResult),\n nextToken: data[key]?.nextToken,\n };\n }\n }\n // response is of type `data: { listByExampleId: null }`\n return {\n data: data[key],\n nextToken: data[key]?.nextToken,\n };\n }\n else {\n // `data` is `null` or an empty object:\n return handleListGraphQlError(error);\n }\n }\n });\n}\n\nexport { indexQueryFactory };\n//# sourceMappingURL=indexQuery.mjs.map\n","import { map } from 'rxjs';\nimport { generateGraphQLDocument, buildGraphQLVariables, authModeParams, getCustomHeaders, flattenItems, initializeModel } from '../APIClient.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction subscriptionFactory(client, modelIntrospection, model, operation, getInternals) {\n const { name } = model;\n const subscription = (args) => {\n const query = generateGraphQLDocument(modelIntrospection, model, operation, args);\n const variables = buildGraphQLVariables(model, operation, args, modelIntrospection);\n const auth = authModeParams(client, getInternals, args);\n const headers = getCustomHeaders(client, getInternals, args?.headers);\n const observable = client.graphql({\n ...auth,\n query,\n variables,\n }, headers);\n return observable.pipe(map((value) => {\n const [key] = Object.keys(value.data);\n const data = value.data[key];\n const flattenedResult = flattenItems(modelIntrospection, name, data);\n if (flattenedResult === null) {\n return null;\n }\n else if (args?.selectionSet) {\n return flattenedResult;\n }\n else {\n const [initialized] = initializeModel(client, name, [flattenedResult], modelIntrospection, auth.authMode, auth.authToken);\n return initialized;\n }\n }));\n };\n return subscription;\n}\n\nexport { subscriptionFactory };\n//# sourceMappingURL=subscription.mjs.map\n",null,null,null,null,"/**\n * Given a SchemaModel from a ModelIntrospectionSchema, returns the primary key\n * as an array of field names.\n *\n * @param model The model object\n * @returns Array of field names\n */\nfunction resolvePKFields(model) {\n const { primaryKeyFieldName, sortKeyFieldNames } = model.primaryKeyInfo;\n return [primaryKeyFieldName, ...sortKeyFieldNames];\n}\n\nexport { resolvePKFields };\n//# sourceMappingURL=resolvePKFields.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Iterates through a collection to find a matching item and returns the index.\n *\n * @param needle The item to search for\n * @param haystack The collection to search\n * @param keyFields The fields used to indicate a match\n * @returns Index of `needle` in `haystack`, otherwise -1 if not found.\n */\nfunction findIndexByFields(needle, haystack, keyFields) {\n const searchObject = Object.fromEntries(keyFields.map((fieldName) => [fieldName, needle[fieldName]]));\n for (let i = 0; i < haystack.length; i++) {\n if (Object.keys(searchObject).every((k) => searchObject[k] === haystack[i][k])) {\n return i;\n }\n }\n return -1;\n}\n\nexport { findIndexByFields };\n//# sourceMappingURL=findIndexByFields.mjs.map\n","import { Observable } from 'rxjs';\nimport { resolvePKFields } from '../../utils/resolvePKFields.mjs';\nimport { findIndexByFields } from '../../utils/findIndexByFields.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction observeQueryFactory(models, model) {\n const { name } = model;\n const observeQuery = (arg) => new Observable((subscriber) => {\n // what we'll be sending to our subscribers\n const items = [];\n // To enqueue subscription messages while we collect our initial\n // result set.\n const messageQueue = [];\n // operation to take when message(s) arrive.\n // this operation will be swapped out once initial \"sync\" is complete\n // to immediately ingest messsages.\n let receiveMessages = (...messages) => {\n return messageQueue.push(...messages);\n };\n // start subscriptions\n const onCreateSub = models[name].onCreate(arg).subscribe({\n next(item) {\n receiveMessages({ item, type: 'create' });\n },\n error(error) {\n subscriber.error({ type: 'onCreate', error });\n },\n });\n const onUpdateSub = models[name].onUpdate(arg).subscribe({\n next(item) {\n receiveMessages({ item, type: 'update' });\n },\n error(error) {\n subscriber.error({ type: 'onUpdate', error });\n },\n });\n const onDeleteSub = models[name].onDelete(arg).subscribe({\n next(item) {\n receiveMessages({ item, type: 'delete' });\n },\n error(error) {\n subscriber.error({ type: 'onDelete', error });\n },\n });\n // consumes a list of messages and sends a snapshot\n function ingestMessages(messages) {\n for (const message of messages) {\n const idx = findIndexByFields(message.item, items, pkFields);\n switch (message.type) {\n case 'create':\n if (idx < 0)\n items.push(message.item);\n break;\n case 'update':\n if (idx >= 0)\n items[idx] = message.item;\n break;\n case 'delete':\n if (idx >= 0)\n items.splice(idx, 1);\n break;\n default:\n console.error('Unrecognized message in observeQuery.', message);\n }\n }\n subscriber.next({\n items,\n isSynced: true,\n });\n }\n const pkFields = resolvePKFields(model);\n // initial results\n (async () => {\n let firstPage = true;\n let nextToken = null;\n while (!subscriber.closed && (firstPage || nextToken)) {\n firstPage = false;\n const { data: page, errors, nextToken: _nextToken, } = await models[name].list({ ...arg, nextToken });\n nextToken = _nextToken;\n items.push(...page);\n // if there are no more pages and no items we already know about\n // that need to be merged in from sub, we're \"synced\"\n const isSynced = messageQueue.length === 0 &&\n (nextToken === null || nextToken === undefined);\n subscriber.next({\n items,\n isSynced,\n });\n if (Array.isArray(errors)) {\n for (const error of errors) {\n subscriber.error(error);\n }\n }\n }\n // play through the queue\n if (messageQueue.length > 0) {\n ingestMessages(messageQueue);\n }\n // switch the queue to write directly to the items collection\n receiveMessages = (...messages) => {\n ingestMessages(messages);\n return items.length;\n };\n })();\n // when subscriber unsubscribes, tear down internal subs\n return () => {\n // 1. tear down internal subs\n onCreateSub.unsubscribe();\n onUpdateSub.unsubscribe();\n onDeleteSub.unsubscribe();\n // 2. there is no need to explicitly stop paging. instead, we\n // just check `subscriber.closed` above before fetching each page.\n };\n });\n return observeQuery;\n}\n\nexport { observeQueryFactory };\n//# sourceMappingURL=observeQuery.mjs.map\n","import { graphQLOperationsInfo } from './APIClient.mjs';\n\nconst attributeIsSecondaryIndex = (attr) => {\n return (attr.type === 'key' &&\n // presence of `name` property distinguishes GSI from primary index\n attr.properties?.name &&\n attr.properties?.queryField &&\n attr.properties?.fields.length > 0);\n};\nconst getSecondaryIndexesFromSchemaModel = (model) => {\n const idxs = model.attributes\n ?.filter(attributeIsSecondaryIndex)\n .map((attr) => {\n const queryField = attr.properties.queryField;\n const [pk, ...sk] = attr.properties.fields;\n return {\n queryField,\n pk,\n sk,\n };\n });\n return idxs || [];\n};\n/**\n * returns graphQLOperationsInfo, but filters out operations that were disabled via model().disableOperations([...])\n */\nconst excludeDisabledOps = (mis, modelName) => {\n /* Example model attributes in MIS {\n \"type\": \"model\",\n \"properties\": {\n \"subscriptions\": null,\n \"mutations\": { \"delete\": null }\n \"timestamps\": null\n } }*/\n const modelAttrs = mis.models[modelName].attributes?.find((attr) => attr.type === 'model');\n const coarseToFineDict = {\n queries: ['list', 'get', 'observeQuery'],\n mutations: ['create', 'update', 'delete'],\n subscriptions: ['onCreate', 'onUpdate', 'onDelete'],\n };\n const disabledOps = [];\n if (!modelAttrs) {\n return graphQLOperationsInfo;\n }\n if (modelAttrs.properties) {\n for (const [key, value] of Object.entries(modelAttrs.properties)) {\n // model.properties can contain other values that are not relevant to disabling ops, e.g. timestamps\n if (!(key in coarseToFineDict)) {\n continue;\n }\n if (value === null) {\n // coarse-grained disable, e.g. \"subscriptions\": null,\n disabledOps.push(...coarseToFineDict[key]);\n }\n else if (value instanceof Object) {\n // fine-grained, e.g. \"mutations\": { \"delete\": null }\n disabledOps.push(...Object.keys(value));\n }\n }\n }\n // observeQuery only exists on the client side, so can't be explicitly disabled via schema builder.\n // It's unusable without `list`\n if (disabledOps.includes('list')) {\n disabledOps.push('observeQuery');\n }\n // graphQLOperationsInfo keys are in caps\n const disabledOpsUpper = disabledOps.map((op) => op.toUpperCase());\n const filteredGraphQLOperations = Object.fromEntries(Object.entries(graphQLOperationsInfo).filter(([key]) => !disabledOpsUpper.includes(key)));\n return filteredGraphQLOperations;\n};\n\nexport { excludeDisabledOps, getSecondaryIndexesFromSchemaModel };\n//# sourceMappingURL=clientUtils.mjs.map\n","import { listFactory } from '../../operations/list.mjs';\nimport { indexQueryFactory } from '../../operations/indexQuery.mjs';\nimport { getFactory } from '../../operations/get.mjs';\nimport { subscriptionFactory } from '../../operations/subscription.mjs';\nimport { observeQueryFactory } from '../../operations/observeQuery.mjs';\nimport { excludeDisabledOps, getSecondaryIndexesFromSchemaModel } from '../../clientUtils.mjs';\n\nfunction generateModelsProperty(client, apiGraphQLConfig, getInternals) {\n const models = {};\n const modelIntrospection = apiGraphQLConfig.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const SUBSCRIPTION_OPS = ['ONCREATE', 'ONUPDATE', 'ONDELETE'];\n for (const model of Object.values(modelIntrospection.models)) {\n const { name } = model;\n models[name] = {};\n const enabledModelOps = excludeDisabledOps(modelIntrospection, name);\n Object.entries(enabledModelOps).forEach(([key, { operationPrefix }]) => {\n const operation = key;\n if (operation === 'LIST') {\n models[name][operationPrefix] = listFactory(client, modelIntrospection, model, getInternals);\n }\n else if (SUBSCRIPTION_OPS.includes(operation)) {\n models[name][operationPrefix] = subscriptionFactory(client, modelIntrospection, model, operation, getInternals);\n }\n else if (operation === 'OBSERVEQUERY') {\n models[name][operationPrefix] = observeQueryFactory(models, model);\n }\n else {\n models[name][operationPrefix] = getFactory(client, modelIntrospection, model, operation, getInternals);\n }\n });\n const secondaryIdxs = getSecondaryIndexesFromSchemaModel(model);\n for (const idx of secondaryIdxs) {\n models[name][idx.queryField] = indexQueryFactory(client, modelIntrospection, model, idx, getInternals);\n }\n }\n return models;\n}\n\nexport { generateModelsProperty };\n//# sourceMappingURL=generateModelsProperty.mjs.map\n","import { generateCustomQueriesProperty, generateCustomMutationsProperty, generateCustomSubscriptionsProperty } from './internals/generateCustomOperationsProperty.mjs';\nimport { generateConversationsProperty } from './internals/utils/clientProperties/generateConversationsProperty.mjs';\nimport { generateGenerationsProperty } from './internals/utils/clientProperties/generateGenerationsProperty.mjs';\nimport { generateEnumsProperty } from './internals/utils/clientProperties/generateEnumsProperty.mjs';\nimport { generateModelsProperty } from './internals/utils/clientProperties/generateModelsProperty.mjs';\nimport { upgradeClientCancellation } from './internals/cancellation.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction addSchemaToClient(client, apiGraphqlConfig, getInternals) {\n upgradeClientCancellation(client);\n client.models = generateModelsProperty(client, apiGraphqlConfig, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n client.subscriptions = generateCustomSubscriptionsProperty(client, apiGraphqlConfig, getInternals);\n client.conversations = generateConversationsProperty(client, apiGraphqlConfig, getInternals);\n client.generations = generateGenerationsProperty(client, apiGraphqlConfig, getInternals);\n return client;\n}\n\nexport { addSchemaToClient };\n//# sourceMappingURL=addSchemaToClient.mjs.map\n","import { listFactory } from '../operations/list.mjs';\nimport { indexQueryFactory } from '../operations/indexQuery.mjs';\nimport { getFactory } from '../operations/get.mjs';\nimport { excludeDisabledOps, getSecondaryIndexesFromSchemaModel } from '../clientUtils.mjs';\n\nfunction generateModelsProperty(client, params, getInternals) {\n const models = {};\n const { config } = params;\n const useContext = params.amplify === null;\n if (!config) {\n throw new Error('generateModelsProperty cannot retrieve Amplify config');\n }\n if (!config.API?.GraphQL) {\n return {};\n }\n const modelIntrospection = config.API.GraphQL.modelIntrospection;\n if (!modelIntrospection) {\n return {};\n }\n const SSR_UNSUPORTED_OPS = [\n 'ONCREATE',\n 'ONUPDATE',\n 'ONDELETE',\n 'OBSERVEQUERY',\n ];\n for (const model of Object.values(modelIntrospection.models)) {\n const { name } = model;\n models[name] = {};\n const enabledModelOps = excludeDisabledOps(modelIntrospection, name);\n Object.entries(enabledModelOps).forEach(([key, { operationPrefix }]) => {\n const operation = key;\n // subscriptions are not supported in SSR\n if (SSR_UNSUPORTED_OPS.includes(operation))\n return;\n if (operation === 'LIST') {\n models[name][operationPrefix] = listFactory(client, modelIntrospection, model, getInternals, useContext);\n }\n else {\n models[name][operationPrefix] = getFactory(client, modelIntrospection, model, operation, getInternals, useContext);\n }\n });\n const secondaryIdxs = getSecondaryIndexesFromSchemaModel(model);\n for (const idx of secondaryIdxs) {\n models[name][idx.queryField] = indexQueryFactory(client, modelIntrospection, model, idx, getInternals, useContext);\n }\n }\n return models;\n}\n\nexport { generateModelsProperty };\n//# sourceMappingURL=generateModelsProperty.mjs.map\n","import { isApiGraphQLConfig } from './internals/utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs';\nimport { generateCustomQueriesProperty, generateCustomMutationsProperty } from './internals/generateCustomOperationsProperty.mjs';\nimport { upgradeClientCancellation } from './internals/cancellation.mjs';\nimport './internals/ai/getCustomUserAgentDetails.mjs';\nimport '@smithy/util-base64';\nimport 'rxjs';\nimport { generateEnumsProperty } from './internals/utils/clientProperties/generateEnumsProperty.mjs';\nimport { generateModelsProperty } from './internals/server/generateModelsProperty.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n// TODO: separate import path\nfunction addSchemaToClientWithInstance(client, params, getInternals) {\n const apiGraphqlConfig = params.config?.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n upgradeClientCancellation(client);\n client.models = generateModelsProperty(client, params, getInternals);\n client.enums = generateEnumsProperty(apiGraphqlConfig);\n client.queries = generateCustomQueriesProperty(client, apiGraphqlConfig, getInternals);\n client.mutations = generateCustomMutationsProperty(client, apiGraphqlConfig, getInternals);\n }\n return client;\n}\n\nexport { addSchemaToClientWithInstance };\n//# sourceMappingURL=addSchemaToClientWithInstance.mjs.map\n","export { __modelMeta__ } from '@aws-amplify/data-schema-types';\nexport { addSchemaToClient } from './addSchemaToClient.mjs';\nexport { addSchemaToClientWithInstance } from './addSchemaToClientWithInstance.mjs';\nexport { INTERNAL_USER_AGENT_OVERRIDE } from './internals/ai/getCustomUserAgentDetails.mjs';\n//# sourceMappingURL=index.mjs.map\n","export { CONTROL_MSG, ConnectionState } from './PubSub.mjs';\n\nvar GraphQLAuthError;\n(function (GraphQLAuthError) {\n GraphQLAuthError[\"NO_API_KEY\"] = \"No api-key configured\";\n GraphQLAuthError[\"NO_CURRENT_USER\"] = \"No current user\";\n GraphQLAuthError[\"NO_CREDENTIALS\"] = \"No credentials\";\n GraphQLAuthError[\"NO_FEDERATED_JWT\"] = \"No federated jwt\";\n GraphQLAuthError[\"NO_AUTH_TOKEN\"] = \"No auth token specified\";\n})(GraphQLAuthError || (GraphQLAuthError = {}));\nconst __amplify = Symbol('amplify');\nconst __authMode = Symbol('authMode');\nconst __authToken = Symbol('authToken');\nconst __apiKey = Symbol('apiKey');\nconst __headers = Symbol('headers');\nconst __endpoint = Symbol('endpoint');\nfunction getInternals(client) {\n const c = client;\n return {\n amplify: c[__amplify],\n apiKey: c[__apiKey],\n authMode: c[__authMode],\n authToken: c[__authToken],\n endpoint: c[__endpoint],\n headers: c[__headers],\n };\n}\n\nexport { GraphQLAuthError, __amplify, __apiKey, __authMode, __authToken, __endpoint, __headers, getInternals };\n//# sourceMappingURL=index.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction isApiGraphQLConfig(apiGraphQLConfig) {\n return apiGraphQLConfig !== undefined;\n}\n\nexport { isApiGraphQLConfig };\n//# sourceMappingURL=isApiGraphQLProviderConfig.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction isConfigureEventWithResourceConfig(payload) {\n return payload.event === 'configure';\n}\n\nexport { isConfigureEventWithResourceConfig };\n//# sourceMappingURL=isConfigureEventWithResourceConfig.mjs.map\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/**\n * Return true if `value` is object-like. A value is object-like if it's not\n * `null` and has a `typeof` result of \"object\".\n */\nexport default function isObjectLike(value) {\n return _typeof(value) == 'object' && value !== null;\n}\n","// In ES2015 (or a polyfilled) environment, this will be Symbol.iterator\n// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\nexport var SYMBOL_ITERATOR = typeof Symbol === 'function' && Symbol.iterator != null ? Symbol.iterator : '@@iterator'; // In ES2017 (or a polyfilled) environment, this will be Symbol.asyncIterator\n// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n\nexport var SYMBOL_ASYNC_ITERATOR = typeof Symbol === 'function' && Symbol.asyncIterator != null ? Symbol.asyncIterator : '@@asyncIterator'; // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n\nexport var SYMBOL_TO_STRING_TAG = typeof Symbol === 'function' && Symbol.toStringTag != null ? Symbol.toStringTag : '@@toStringTag';\n","/**\n * Represents a location in a Source.\n */\n\n/**\n * Takes a Source and a UTF-8 character offset, and returns the corresponding\n * line and column as a SourceLocation.\n */\nexport function getLocation(source, position) {\n var lineRegexp = /\\r\\n|[\\n\\r]/g;\n var line = 1;\n var column = position + 1;\n var match;\n\n while ((match = lineRegexp.exec(source.body)) && match.index < position) {\n line += 1;\n column = position + 1 - (match.index + match[0].length);\n }\n\n return {\n line: line,\n column: column\n };\n}\n","import { getLocation } from \"./location.mjs\";\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printLocation(location) {\n return printSourceLocation(location.source, getLocation(location.source, location.start));\n}\n/**\n * Render a helpful description of the location in the GraphQL Source document.\n */\n\nexport function printSourceLocation(source, sourceLocation) {\n var firstLineColumnOffset = source.locationOffset.column - 1;\n var body = whitespace(firstLineColumnOffset) + source.body;\n var lineIndex = sourceLocation.line - 1;\n var lineOffset = source.locationOffset.line - 1;\n var lineNum = sourceLocation.line + lineOffset;\n var columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0;\n var columnNum = sourceLocation.column + columnOffset;\n var locationStr = \"\".concat(source.name, \":\").concat(lineNum, \":\").concat(columnNum, \"\\n\");\n var lines = body.split(/\\r\\n|[\\n\\r]/g);\n var locationLine = lines[lineIndex]; // Special case for minified documents\n\n if (locationLine.length > 120) {\n var subLineIndex = Math.floor(columnNum / 80);\n var subLineColumnNum = columnNum % 80;\n var subLines = [];\n\n for (var i = 0; i < locationLine.length; i += 80) {\n subLines.push(locationLine.slice(i, i + 80));\n }\n\n return locationStr + printPrefixedLines([[\"\".concat(lineNum), subLines[0]]].concat(subLines.slice(1, subLineIndex + 1).map(function (subLine) {\n return ['', subLine];\n }), [[' ', whitespace(subLineColumnNum - 1) + '^'], ['', subLines[subLineIndex + 1]]]));\n }\n\n return locationStr + printPrefixedLines([// Lines specified like this: [\"prefix\", \"string\"],\n [\"\".concat(lineNum - 1), lines[lineIndex - 1]], [\"\".concat(lineNum), locationLine], ['', whitespace(columnNum - 1) + '^'], [\"\".concat(lineNum + 1), lines[lineIndex + 1]]]);\n}\n\nfunction printPrefixedLines(lines) {\n var existingLines = lines.filter(function (_ref) {\n var _ = _ref[0],\n line = _ref[1];\n return line !== undefined;\n });\n var padLen = Math.max.apply(Math, existingLines.map(function (_ref2) {\n var prefix = _ref2[0];\n return prefix.length;\n }));\n return existingLines.map(function (_ref3) {\n var prefix = _ref3[0],\n line = _ref3[1];\n return leftPad(padLen, prefix) + (line ? ' | ' + line : ' |');\n }).join('\\n');\n}\n\nfunction whitespace(len) {\n return Array(len + 1).join(' ');\n}\n\nfunction leftPad(len, str) {\n return whitespace(len - str.length) + str;\n}\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nimport isObjectLike from \"../jsutils/isObjectLike.mjs\";\nimport { SYMBOL_TO_STRING_TAG } from \"../polyfills/symbols.mjs\";\nimport { getLocation } from \"../language/location.mjs\";\nimport { printLocation, printSourceLocation } from \"../language/printLocation.mjs\";\n/**\n * A GraphQLError describes an Error found during the parse, validate, or\n * execute phases of performing a GraphQL operation. In addition to a message\n * and stack trace, it also includes information about the locations in a\n * GraphQL document and/or execution result that correspond to the Error.\n */\n\nexport var GraphQLError = /*#__PURE__*/function (_Error) {\n _inherits(GraphQLError, _Error);\n\n var _super = _createSuper(GraphQLError);\n\n /**\n * An array of { line, column } locations within the source GraphQL document\n * which correspond to this error.\n *\n * Errors during validation often contain multiple locations, for example to\n * point out two things with the same name. Errors during execution include a\n * single location, the field which produced the error.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array describing the JSON-path into the execution response which\n * corresponds to this error. Only included for errors during execution.\n *\n * Enumerable, and appears in the result of JSON.stringify().\n */\n\n /**\n * An array of GraphQL AST Nodes corresponding to this error.\n */\n\n /**\n * The source GraphQL document for the first location of this error.\n *\n * Note that if this Error represents more than one node, the source may not\n * represent nodes after the first node.\n */\n\n /**\n * An array of character offsets within the source GraphQL document\n * which correspond to this error.\n */\n\n /**\n * The original error thrown from a field resolver during execution.\n */\n\n /**\n * Extension fields to add to the formatted error.\n */\n function GraphQLError(message, nodes, source, positions, path, originalError, extensions) {\n var _nodeLocations, _nodeLocations2, _nodeLocations3;\n\n var _this;\n\n _classCallCheck(this, GraphQLError);\n\n _this = _super.call(this, message);\n _this.name = 'GraphQLError';\n _this.originalError = originalError !== null && originalError !== void 0 ? originalError : undefined; // Compute list of blame nodes.\n\n _this.nodes = undefinedIfEmpty(Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined);\n var nodeLocations = [];\n\n for (var _i2 = 0, _ref3 = (_this$nodes = _this.nodes) !== null && _this$nodes !== void 0 ? _this$nodes : []; _i2 < _ref3.length; _i2++) {\n var _this$nodes;\n\n var _ref4 = _ref3[_i2];\n var loc = _ref4.loc;\n\n if (loc != null) {\n nodeLocations.push(loc);\n }\n }\n\n nodeLocations = undefinedIfEmpty(nodeLocations); // Compute locations in the source for the given nodes/positions.\n\n _this.source = source !== null && source !== void 0 ? source : (_nodeLocations = nodeLocations) === null || _nodeLocations === void 0 ? void 0 : _nodeLocations[0].source;\n _this.positions = positions !== null && positions !== void 0 ? positions : (_nodeLocations2 = nodeLocations) === null || _nodeLocations2 === void 0 ? void 0 : _nodeLocations2.map(function (loc) {\n return loc.start;\n });\n _this.locations = positions && source ? positions.map(function (pos) {\n return getLocation(source, pos);\n }) : (_nodeLocations3 = nodeLocations) === null || _nodeLocations3 === void 0 ? void 0 : _nodeLocations3.map(function (loc) {\n return getLocation(loc.source, loc.start);\n });\n _this.path = path !== null && path !== void 0 ? path : undefined;\n var originalExtensions = originalError === null || originalError === void 0 ? void 0 : originalError.extensions;\n\n if (extensions == null && isObjectLike(originalExtensions)) {\n _this.extensions = _objectSpread({}, originalExtensions);\n } else {\n _this.extensions = extensions !== null && extensions !== void 0 ? extensions : {};\n } // By being enumerable, JSON.stringify will include bellow properties in the resulting output.\n // This ensures that the simplest possible GraphQL service adheres to the spec.\n\n\n Object.defineProperties(_assertThisInitialized(_this), {\n message: {\n enumerable: true\n },\n locations: {\n enumerable: _this.locations != null\n },\n path: {\n enumerable: _this.path != null\n },\n extensions: {\n enumerable: _this.extensions != null && Object.keys(_this.extensions).length > 0\n },\n name: {\n enumerable: false\n },\n nodes: {\n enumerable: false\n },\n source: {\n enumerable: false\n },\n positions: {\n enumerable: false\n },\n originalError: {\n enumerable: false\n }\n }); // Include (non-enumerable) stack trace.\n\n if (originalError !== null && originalError !== void 0 && originalError.stack) {\n Object.defineProperty(_assertThisInitialized(_this), 'stack', {\n value: originalError.stack,\n writable: true,\n configurable: true\n });\n return _possibleConstructorReturn(_this);\n } // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(_assertThisInitialized(_this), GraphQLError);\n } else {\n Object.defineProperty(_assertThisInitialized(_this), 'stack', {\n value: Error().stack,\n writable: true,\n configurable: true\n });\n }\n\n return _this;\n }\n\n _createClass(GraphQLError, [{\n key: \"toString\",\n value: function toString() {\n return printError(this);\n } // FIXME: workaround to not break chai comparisons, should be remove in v16\n // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet\n\n }, {\n key: SYMBOL_TO_STRING_TAG,\n get: function get() {\n return 'Object';\n }\n }]);\n\n return GraphQLError;\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nfunction undefinedIfEmpty(array) {\n return array === undefined || array.length === 0 ? undefined : array;\n}\n/**\n * Prints a GraphQLError to a string, representing useful location information\n * about the error's position in the source.\n */\n\n\nexport function printError(error) {\n var output = error.message;\n\n if (error.nodes) {\n for (var _i4 = 0, _error$nodes2 = error.nodes; _i4 < _error$nodes2.length; _i4++) {\n var node = _error$nodes2[_i4];\n\n if (node.loc) {\n output += '\\n\\n' + printLocation(node.loc);\n }\n }\n } else if (error.source && error.locations) {\n for (var _i6 = 0, _error$locations2 = error.locations; _i6 < _error$locations2.length; _i6++) {\n var location = _error$locations2[_i6];\n output += '\\n\\n' + printSourceLocation(error.source, location);\n }\n }\n\n return output;\n}\n","import { GraphQLError } from \"./GraphQLError.mjs\";\n/**\n * Produces a GraphQLError representing a syntax error, containing useful\n * descriptive information about the syntax error's position in the source.\n */\n\nexport function syntaxError(source, position, description) {\n return new GraphQLError(\"Syntax Error: \".concat(description), undefined, source, [position]);\n}\n","/**\n * The set of allowed kind values for AST nodes.\n */\nexport var Kind = Object.freeze({\n // Name\n NAME: 'Name',\n // Document\n DOCUMENT: 'Document',\n OPERATION_DEFINITION: 'OperationDefinition',\n VARIABLE_DEFINITION: 'VariableDefinition',\n SELECTION_SET: 'SelectionSet',\n FIELD: 'Field',\n ARGUMENT: 'Argument',\n // Fragments\n FRAGMENT_SPREAD: 'FragmentSpread',\n INLINE_FRAGMENT: 'InlineFragment',\n FRAGMENT_DEFINITION: 'FragmentDefinition',\n // Values\n VARIABLE: 'Variable',\n INT: 'IntValue',\n FLOAT: 'FloatValue',\n STRING: 'StringValue',\n BOOLEAN: 'BooleanValue',\n NULL: 'NullValue',\n ENUM: 'EnumValue',\n LIST: 'ListValue',\n OBJECT: 'ObjectValue',\n OBJECT_FIELD: 'ObjectField',\n // Directives\n DIRECTIVE: 'Directive',\n // Types\n NAMED_TYPE: 'NamedType',\n LIST_TYPE: 'ListType',\n NON_NULL_TYPE: 'NonNullType',\n // Type System Definitions\n SCHEMA_DEFINITION: 'SchemaDefinition',\n OPERATION_TYPE_DEFINITION: 'OperationTypeDefinition',\n // Type Definitions\n SCALAR_TYPE_DEFINITION: 'ScalarTypeDefinition',\n OBJECT_TYPE_DEFINITION: 'ObjectTypeDefinition',\n FIELD_DEFINITION: 'FieldDefinition',\n INPUT_VALUE_DEFINITION: 'InputValueDefinition',\n INTERFACE_TYPE_DEFINITION: 'InterfaceTypeDefinition',\n UNION_TYPE_DEFINITION: 'UnionTypeDefinition',\n ENUM_TYPE_DEFINITION: 'EnumTypeDefinition',\n ENUM_VALUE_DEFINITION: 'EnumValueDefinition',\n INPUT_OBJECT_TYPE_DEFINITION: 'InputObjectTypeDefinition',\n // Directive Definitions\n DIRECTIVE_DEFINITION: 'DirectiveDefinition',\n // Type System Extensions\n SCHEMA_EXTENSION: 'SchemaExtension',\n // Type Extensions\n SCALAR_TYPE_EXTENSION: 'ScalarTypeExtension',\n OBJECT_TYPE_EXTENSION: 'ObjectTypeExtension',\n INTERFACE_TYPE_EXTENSION: 'InterfaceTypeExtension',\n UNION_TYPE_EXTENSION: 'UnionTypeExtension',\n ENUM_TYPE_EXTENSION: 'EnumTypeExtension',\n INPUT_OBJECT_TYPE_EXTENSION: 'InputObjectTypeExtension'\n});\n/**\n * The enum type representing the possible kind values of AST nodes.\n */\n","export default function invariant(condition, message) {\n var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')\n\n if (!booleanCondition) {\n throw new Error(message != null ? message : 'Unexpected invariant triggered.');\n }\n}\n","// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\nvar nodejsCustomInspectSymbol = typeof Symbol === 'function' && typeof Symbol.for === 'function' ? Symbol.for('nodejs.util.inspect.custom') : undefined;\nexport default nodejsCustomInspectSymbol;\n","import invariant from \"./invariant.mjs\";\nimport nodejsCustomInspectSymbol from \"./nodejsCustomInspectSymbol.mjs\";\n/**\n * The `defineInspect()` function defines `inspect()` prototype method as alias of `toJSON`\n */\n\nexport default function defineInspect(classObject) {\n var fn = classObject.prototype.toJSON;\n typeof fn === 'function' || invariant(0);\n classObject.prototype.inspect = fn; // istanbul ignore else (See: 'https://github.com/graphql/graphql-js/issues/2317')\n\n if (nodejsCustomInspectSymbol) {\n classObject.prototype[nodejsCustomInspectSymbol] = fn;\n }\n}\n","import defineInspect from \"../jsutils/defineInspect.mjs\";\n\n/**\n * Contains a range of UTF-8 character offsets and token references that\n * identify the region of the source from which the AST derived.\n */\nexport var Location = /*#__PURE__*/function () {\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The Token at which this Node begins.\n */\n\n /**\n * The Token at which this Node ends.\n */\n\n /**\n * The Source document the AST represents.\n */\n function Location(startToken, endToken, source) {\n this.start = startToken.start;\n this.end = endToken.end;\n this.startToken = startToken;\n this.endToken = endToken;\n this.source = source;\n }\n\n var _proto = Location.prototype;\n\n _proto.toJSON = function toJSON() {\n return {\n start: this.start,\n end: this.end\n };\n };\n\n return Location;\n}(); // Print a simplified form when appearing in `inspect` and `util.inspect`.\n\ndefineInspect(Location);\n/**\n * Represents a range of characters represented by a lexical token\n * within a Source.\n */\n\nexport var Token = /*#__PURE__*/function () {\n /**\n * The kind of Token.\n */\n\n /**\n * The character offset at which this Node begins.\n */\n\n /**\n * The character offset at which this Node ends.\n */\n\n /**\n * The 1-indexed line number on which this Token appears.\n */\n\n /**\n * The 1-indexed column number at which this Token begins.\n */\n\n /**\n * For non-punctuation tokens, represents the interpreted value of the token.\n */\n\n /**\n * Tokens exist as nodes in a double-linked-list amongst all tokens\n * including ignored tokens. is always the first node and \n * the last.\n */\n function Token(kind, start, end, line, column, prev, value) {\n this.kind = kind;\n this.start = start;\n this.end = end;\n this.line = line;\n this.column = column;\n this.value = value;\n this.prev = prev;\n this.next = null;\n }\n\n var _proto2 = Token.prototype;\n\n _proto2.toJSON = function toJSON() {\n return {\n kind: this.kind,\n value: this.value,\n line: this.line,\n column: this.column\n };\n };\n\n return Token;\n}(); // Print a simplified form when appearing in `inspect` and `util.inspect`.\n\ndefineInspect(Token);\n/**\n * @internal\n */\n\nexport function isNode(maybeNode) {\n return maybeNode != null && typeof maybeNode.kind === 'string';\n}\n/**\n * The list of all possible AST node types.\n */\n","/**\n * An exported enum describing the different kinds of tokens that the\n * lexer emits.\n */\nexport var TokenKind = Object.freeze({\n SOF: '',\n EOF: '',\n BANG: '!',\n DOLLAR: '$',\n AMP: '&',\n PAREN_L: '(',\n PAREN_R: ')',\n SPREAD: '...',\n COLON: ':',\n EQUALS: '=',\n AT: '@',\n BRACKET_L: '[',\n BRACKET_R: ']',\n BRACE_L: '{',\n PIPE: '|',\n BRACE_R: '}',\n NAME: 'Name',\n INT: 'Int',\n FLOAT: 'Float',\n STRING: 'String',\n BLOCK_STRING: 'BlockString',\n COMMENT: 'Comment'\n});\n/**\n * The enum type representing the token kinds values.\n */\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n/* eslint-disable flowtype/no-weak-types */\nimport nodejsCustomInspectSymbol from \"./nodejsCustomInspectSymbol.mjs\";\nvar MAX_ARRAY_LENGTH = 10;\nvar MAX_RECURSIVE_DEPTH = 2;\n/**\n * Used to print values in error messages.\n */\n\nexport default function inspect(value) {\n return formatValue(value, []);\n}\n\nfunction formatValue(value, seenValues) {\n switch (_typeof(value)) {\n case 'string':\n return JSON.stringify(value);\n\n case 'function':\n return value.name ? \"[function \".concat(value.name, \"]\") : '[function]';\n\n case 'object':\n if (value === null) {\n return 'null';\n }\n\n return formatObjectValue(value, seenValues);\n\n default:\n return String(value);\n }\n}\n\nfunction formatObjectValue(value, previouslySeenValues) {\n if (previouslySeenValues.indexOf(value) !== -1) {\n return '[Circular]';\n }\n\n var seenValues = [].concat(previouslySeenValues, [value]);\n var customInspectFn = getCustomFn(value);\n\n if (customInspectFn !== undefined) {\n var customValue = customInspectFn.call(value); // check for infinite recursion\n\n if (customValue !== value) {\n return typeof customValue === 'string' ? customValue : formatValue(customValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n}\n\nfunction formatObject(object, seenValues) {\n var keys = Object.keys(object);\n\n if (keys.length === 0) {\n return '{}';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[' + getObjectTag(object) + ']';\n }\n\n var properties = keys.map(function (key) {\n var value = formatValue(object[key], seenValues);\n return key + ': ' + value;\n });\n return '{ ' + properties.join(', ') + ' }';\n}\n\nfunction formatArray(array, seenValues) {\n if (array.length === 0) {\n return '[]';\n }\n\n if (seenValues.length > MAX_RECURSIVE_DEPTH) {\n return '[Array]';\n }\n\n var len = Math.min(MAX_ARRAY_LENGTH, array.length);\n var remaining = array.length - len;\n var items = [];\n\n for (var i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push('... 1 more item');\n } else if (remaining > 1) {\n items.push(\"... \".concat(remaining, \" more items\"));\n }\n\n return '[' + items.join(', ') + ']';\n}\n\nfunction getCustomFn(object) {\n var customInspectFn = object[String(nodejsCustomInspectSymbol)];\n\n if (typeof customInspectFn === 'function') {\n return customInspectFn;\n }\n\n if (typeof object.inspect === 'function') {\n return object.inspect;\n }\n}\n\nfunction getObjectTag(object) {\n var tag = Object.prototype.toString.call(object).replace(/^\\[object /, '').replace(/]$/, '');\n\n if (tag === 'Object' && typeof object.constructor === 'function') {\n var name = object.constructor.name;\n\n if (typeof name === 'string' && name !== '') {\n return name;\n }\n }\n\n return tag;\n}\n","export default function devAssert(condition, message) {\n var booleanCondition = Boolean(condition); // istanbul ignore else (See transformation done in './resources/inlineInvariant.js')\n\n if (!booleanCondition) {\n throw new Error(message);\n }\n}\n","function _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport inspect from \"./inspect.mjs\";\n/**\n * A replacement for instanceof which includes an error warning when multi-realm\n * constructors are detected.\n */\n\n// See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production\n// See: https://webpack.js.org/guides/production/\nexport default process.env.NODE_ENV === 'production' ? // istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2317')\n// eslint-disable-next-line no-shadow\nfunction instanceOf(value, constructor) {\n return value instanceof constructor;\n} : // eslint-disable-next-line no-shadow\nfunction instanceOf(value, constructor) {\n if (value instanceof constructor) {\n return true;\n }\n\n if (_typeof(value) === 'object' && value !== null) {\n var _value$constructor;\n\n var className = constructor.prototype[Symbol.toStringTag];\n var valueClassName = // We still need to support constructor's name to detect conflicts with older versions of this library.\n Symbol.toStringTag in value ? value[Symbol.toStringTag] : (_value$constructor = value.constructor) === null || _value$constructor === void 0 ? void 0 : _value$constructor.name;\n\n if (className === valueClassName) {\n var stringifiedValue = inspect(value);\n throw new Error(\"Cannot use \".concat(className, \" \\\"\").concat(stringifiedValue, \"\\\" from another module or realm.\\n\\nEnsure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory. If different versions of \\\"graphql\\\" are the dependencies of other\\nrelied on modules, use \\\"resolutions\\\" to ensure only one version is installed.\\n\\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\\n\\nDuplicate \\\"graphql\\\" modules cannot be used at the same time since different\\nversions may have different capabilities and behavior. The data from one\\nversion used in the function from another could produce confusing and\\nspurious results.\"));\n }\n }\n\n return false;\n};\n","function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nimport { SYMBOL_TO_STRING_TAG } from \"../polyfills/symbols.mjs\";\nimport inspect from \"../jsutils/inspect.mjs\";\nimport devAssert from \"../jsutils/devAssert.mjs\";\nimport instanceOf from \"../jsutils/instanceOf.mjs\";\n\n/**\n * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are\n * optional, but they are useful for clients who store GraphQL documents in source files.\n * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might\n * be useful for `name` to be `\"Foo.graphql\"` and location to be `{ line: 40, column: 1 }`.\n * The `line` and `column` properties in `locationOffset` are 1-indexed.\n */\nexport var Source = /*#__PURE__*/function () {\n function Source(body) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'GraphQL request';\n var locationOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {\n line: 1,\n column: 1\n };\n typeof body === 'string' || devAssert(0, \"Body must be a string. Received: \".concat(inspect(body), \".\"));\n this.body = body;\n this.name = name;\n this.locationOffset = locationOffset;\n this.locationOffset.line > 0 || devAssert(0, 'line in locationOffset is 1-indexed and must be positive.');\n this.locationOffset.column > 0 || devAssert(0, 'column in locationOffset is 1-indexed and must be positive.');\n } // $FlowFixMe[unsupported-syntax] Flow doesn't support computed properties yet\n\n\n _createClass(Source, [{\n key: SYMBOL_TO_STRING_TAG,\n get: function get() {\n return 'Source';\n }\n }]);\n\n return Source;\n}();\n/**\n * Test if the given value is a Source object.\n *\n * @internal\n */\n\n// eslint-disable-next-line no-redeclare\nexport function isSource(source) {\n return instanceOf(source, Source);\n}\n","/**\n * The set of allowed directive location values.\n */\nexport var DirectiveLocation = Object.freeze({\n // Request Definitions\n QUERY: 'QUERY',\n MUTATION: 'MUTATION',\n SUBSCRIPTION: 'SUBSCRIPTION',\n FIELD: 'FIELD',\n FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION',\n FRAGMENT_SPREAD: 'FRAGMENT_SPREAD',\n INLINE_FRAGMENT: 'INLINE_FRAGMENT',\n VARIABLE_DEFINITION: 'VARIABLE_DEFINITION',\n // Type System Definitions\n SCHEMA: 'SCHEMA',\n SCALAR: 'SCALAR',\n OBJECT: 'OBJECT',\n FIELD_DEFINITION: 'FIELD_DEFINITION',\n ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION',\n INTERFACE: 'INTERFACE',\n UNION: 'UNION',\n ENUM: 'ENUM',\n ENUM_VALUE: 'ENUM_VALUE',\n INPUT_OBJECT: 'INPUT_OBJECT',\n INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION'\n});\n/**\n * The enum type representing the directive location values.\n */\n","/**\n * Produces the value of a block string from its parsed raw value, similar to\n * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc.\n *\n * This implements the GraphQL spec's BlockStringValue() static algorithm.\n *\n * @internal\n */\nexport function dedentBlockStringValue(rawString) {\n // Expand a block string's raw value into independent lines.\n var lines = rawString.split(/\\r\\n|[\\n\\r]/g); // Remove common indentation from all lines but first.\n\n var commonIndent = getBlockStringIndentation(rawString);\n\n if (commonIndent !== 0) {\n for (var i = 1; i < lines.length; i++) {\n lines[i] = lines[i].slice(commonIndent);\n }\n } // Remove leading and trailing blank lines.\n\n\n var startLine = 0;\n\n while (startLine < lines.length && isBlank(lines[startLine])) {\n ++startLine;\n }\n\n var endLine = lines.length;\n\n while (endLine > startLine && isBlank(lines[endLine - 1])) {\n --endLine;\n } // Return a string of the lines joined with U+000A.\n\n\n return lines.slice(startLine, endLine).join('\\n');\n}\n\nfunction isBlank(str) {\n for (var i = 0; i < str.length; ++i) {\n if (str[i] !== ' ' && str[i] !== '\\t') {\n return false;\n }\n }\n\n return true;\n}\n/**\n * @internal\n */\n\n\nexport function getBlockStringIndentation(value) {\n var _commonIndent;\n\n var isFirstLine = true;\n var isEmptyLine = true;\n var indent = 0;\n var commonIndent = null;\n\n for (var i = 0; i < value.length; ++i) {\n switch (value.charCodeAt(i)) {\n case 13:\n // \\r\n if (value.charCodeAt(i + 1) === 10) {\n ++i; // skip \\r\\n as one symbol\n }\n\n // falls through\n\n case 10:\n // \\n\n isFirstLine = false;\n isEmptyLine = true;\n indent = 0;\n break;\n\n case 9: // \\t\n\n case 32:\n // \n ++indent;\n break;\n\n default:\n if (isEmptyLine && !isFirstLine && (commonIndent === null || indent < commonIndent)) {\n commonIndent = indent;\n }\n\n isEmptyLine = false;\n }\n }\n\n return (_commonIndent = commonIndent) !== null && _commonIndent !== void 0 ? _commonIndent : 0;\n}\n/**\n * Print a block string in the indented block form by adding a leading and\n * trailing blank line. However, if a block string starts with whitespace and is\n * a single-line, adding a leading blank line would strip that whitespace.\n *\n * @internal\n */\n\nexport function printBlockString(value) {\n var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var preferMultipleLines = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var isSingleLine = value.indexOf('\\n') === -1;\n var hasLeadingSpace = value[0] === ' ' || value[0] === '\\t';\n var hasTrailingQuote = value[value.length - 1] === '\"';\n var hasTrailingSlash = value[value.length - 1] === '\\\\';\n var printAsMultipleLines = !isSingleLine || hasTrailingQuote || hasTrailingSlash || preferMultipleLines;\n var result = ''; // Format a multi-line block quote to account for leading space.\n\n if (printAsMultipleLines && !(isSingleLine && hasLeadingSpace)) {\n result += '\\n' + indentation;\n }\n\n result += indentation ? value.replace(/\\n/g, '\\n' + indentation) : value;\n\n if (printAsMultipleLines) {\n result += '\\n';\n }\n\n return '\"\"\"' + result.replace(/\"\"\"/g, '\\\\\"\"\"') + '\"\"\"';\n}\n","import { syntaxError } from \"../error/syntaxError.mjs\";\nimport { Token } from \"./ast.mjs\";\nimport { TokenKind } from \"./tokenKind.mjs\";\nimport { dedentBlockStringValue } from \"./blockString.mjs\";\n/**\n * Given a Source object, creates a Lexer for that source.\n * A Lexer is a stateful stream generator in that every time\n * it is advanced, it returns the next token in the Source. Assuming the\n * source lexes, the final Token emitted by the lexer will be of kind\n * EOF, after which the lexer will repeatedly return the same EOF token\n * whenever called.\n */\n\nexport var Lexer = /*#__PURE__*/function () {\n /**\n * The previously focused non-ignored token.\n */\n\n /**\n * The currently focused non-ignored token.\n */\n\n /**\n * The (1-indexed) line containing the current token.\n */\n\n /**\n * The character offset at which the current line begins.\n */\n function Lexer(source) {\n var startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0, null);\n this.source = source;\n this.lastToken = startOfFileToken;\n this.token = startOfFileToken;\n this.line = 1;\n this.lineStart = 0;\n }\n /**\n * Advances the token stream to the next non-ignored token.\n */\n\n\n var _proto = Lexer.prototype;\n\n _proto.advance = function advance() {\n this.lastToken = this.token;\n var token = this.token = this.lookahead();\n return token;\n }\n /**\n * Looks ahead and returns the next non-ignored token, but does not change\n * the state of Lexer.\n */\n ;\n\n _proto.lookahead = function lookahead() {\n var token = this.token;\n\n if (token.kind !== TokenKind.EOF) {\n do {\n var _token$next;\n\n // Note: next is only mutable during parsing, so we cast to allow this.\n token = (_token$next = token.next) !== null && _token$next !== void 0 ? _token$next : token.next = readToken(this, token);\n } while (token.kind === TokenKind.COMMENT);\n }\n\n return token;\n };\n\n return Lexer;\n}();\n/**\n * @internal\n */\n\nexport function isPunctuatorTokenKind(kind) {\n return kind === TokenKind.BANG || kind === TokenKind.DOLLAR || kind === TokenKind.AMP || kind === TokenKind.PAREN_L || kind === TokenKind.PAREN_R || kind === TokenKind.SPREAD || kind === TokenKind.COLON || kind === TokenKind.EQUALS || kind === TokenKind.AT || kind === TokenKind.BRACKET_L || kind === TokenKind.BRACKET_R || kind === TokenKind.BRACE_L || kind === TokenKind.PIPE || kind === TokenKind.BRACE_R;\n}\n\nfunction printCharCode(code) {\n return (// NaN/undefined represents access beyond the end of the file.\n isNaN(code) ? TokenKind.EOF : // Trust JSON for ASCII.\n code < 0x007f ? JSON.stringify(String.fromCharCode(code)) : // Otherwise print the escaped form.\n \"\\\"\\\\u\".concat(('00' + code.toString(16).toUpperCase()).slice(-4), \"\\\"\")\n );\n}\n/**\n * Gets the next token from the source starting at the given position.\n *\n * This skips over whitespace until it finds the next lexable token, then lexes\n * punctuators immediately or calls the appropriate helper function for more\n * complicated tokens.\n */\n\n\nfunction readToken(lexer, prev) {\n var source = lexer.source;\n var body = source.body;\n var bodyLength = body.length;\n var pos = prev.end;\n\n while (pos < bodyLength) {\n var code = body.charCodeAt(pos);\n var _line = lexer.line;\n\n var _col = 1 + pos - lexer.lineStart; // SourceCharacter\n\n\n switch (code) {\n case 0xfeff: // \n\n case 9: // \\t\n\n case 32: // \n\n case 44:\n // ,\n ++pos;\n continue;\n\n case 10:\n // \\n\n ++pos;\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 13:\n // \\r\n if (body.charCodeAt(pos + 1) === 10) {\n pos += 2;\n } else {\n ++pos;\n }\n\n ++lexer.line;\n lexer.lineStart = pos;\n continue;\n\n case 33:\n // !\n return new Token(TokenKind.BANG, pos, pos + 1, _line, _col, prev);\n\n case 35:\n // #\n return readComment(source, pos, _line, _col, prev);\n\n case 36:\n // $\n return new Token(TokenKind.DOLLAR, pos, pos + 1, _line, _col, prev);\n\n case 38:\n // &\n return new Token(TokenKind.AMP, pos, pos + 1, _line, _col, prev);\n\n case 40:\n // (\n return new Token(TokenKind.PAREN_L, pos, pos + 1, _line, _col, prev);\n\n case 41:\n // )\n return new Token(TokenKind.PAREN_R, pos, pos + 1, _line, _col, prev);\n\n case 46:\n // .\n if (body.charCodeAt(pos + 1) === 46 && body.charCodeAt(pos + 2) === 46) {\n return new Token(TokenKind.SPREAD, pos, pos + 3, _line, _col, prev);\n }\n\n break;\n\n case 58:\n // :\n return new Token(TokenKind.COLON, pos, pos + 1, _line, _col, prev);\n\n case 61:\n // =\n return new Token(TokenKind.EQUALS, pos, pos + 1, _line, _col, prev);\n\n case 64:\n // @\n return new Token(TokenKind.AT, pos, pos + 1, _line, _col, prev);\n\n case 91:\n // [\n return new Token(TokenKind.BRACKET_L, pos, pos + 1, _line, _col, prev);\n\n case 93:\n // ]\n return new Token(TokenKind.BRACKET_R, pos, pos + 1, _line, _col, prev);\n\n case 123:\n // {\n return new Token(TokenKind.BRACE_L, pos, pos + 1, _line, _col, prev);\n\n case 124:\n // |\n return new Token(TokenKind.PIPE, pos, pos + 1, _line, _col, prev);\n\n case 125:\n // }\n return new Token(TokenKind.BRACE_R, pos, pos + 1, _line, _col, prev);\n\n case 34:\n // \"\n if (body.charCodeAt(pos + 1) === 34 && body.charCodeAt(pos + 2) === 34) {\n return readBlockString(source, pos, _line, _col, prev, lexer);\n }\n\n return readString(source, pos, _line, _col, prev);\n\n case 45: // -\n\n case 48: // 0\n\n case 49: // 1\n\n case 50: // 2\n\n case 51: // 3\n\n case 52: // 4\n\n case 53: // 5\n\n case 54: // 6\n\n case 55: // 7\n\n case 56: // 8\n\n case 57:\n // 9\n return readNumber(source, pos, code, _line, _col, prev);\n\n case 65: // A\n\n case 66: // B\n\n case 67: // C\n\n case 68: // D\n\n case 69: // E\n\n case 70: // F\n\n case 71: // G\n\n case 72: // H\n\n case 73: // I\n\n case 74: // J\n\n case 75: // K\n\n case 76: // L\n\n case 77: // M\n\n case 78: // N\n\n case 79: // O\n\n case 80: // P\n\n case 81: // Q\n\n case 82: // R\n\n case 83: // S\n\n case 84: // T\n\n case 85: // U\n\n case 86: // V\n\n case 87: // W\n\n case 88: // X\n\n case 89: // Y\n\n case 90: // Z\n\n case 95: // _\n\n case 97: // a\n\n case 98: // b\n\n case 99: // c\n\n case 100: // d\n\n case 101: // e\n\n case 102: // f\n\n case 103: // g\n\n case 104: // h\n\n case 105: // i\n\n case 106: // j\n\n case 107: // k\n\n case 108: // l\n\n case 109: // m\n\n case 110: // n\n\n case 111: // o\n\n case 112: // p\n\n case 113: // q\n\n case 114: // r\n\n case 115: // s\n\n case 116: // t\n\n case 117: // u\n\n case 118: // v\n\n case 119: // w\n\n case 120: // x\n\n case 121: // y\n\n case 122:\n // z\n return readName(source, pos, _line, _col, prev);\n }\n\n throw syntaxError(source, pos, unexpectedCharacterMessage(code));\n }\n\n var line = lexer.line;\n var col = 1 + pos - lexer.lineStart;\n return new Token(TokenKind.EOF, bodyLength, bodyLength, line, col, prev);\n}\n/**\n * Report a message that an unexpected character was encountered.\n */\n\n\nfunction unexpectedCharacterMessage(code) {\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n return \"Cannot contain the invalid character \".concat(printCharCode(code), \".\");\n }\n\n if (code === 39) {\n // '\n return 'Unexpected single quote character (\\'), did you mean to use a double quote (\")?';\n }\n\n return \"Cannot parse the unexpected character \".concat(printCharCode(code), \".\");\n}\n/**\n * Reads a comment token from the source file.\n *\n * #[\\u0009\\u0020-\\uFFFF]*\n */\n\n\nfunction readComment(source, start, line, col, prev) {\n var body = source.body;\n var code;\n var position = start;\n\n do {\n code = body.charCodeAt(++position);\n } while (!isNaN(code) && ( // SourceCharacter but not LineTerminator\n code > 0x001f || code === 0x0009));\n\n return new Token(TokenKind.COMMENT, start, position, line, col, prev, body.slice(start + 1, position));\n}\n/**\n * Reads a number token from the source file, either a float\n * or an int depending on whether a decimal point appears.\n *\n * Int: -?(0|[1-9][0-9]*)\n * Float: -?(0|[1-9][0-9]*)(\\.[0-9]+)?((E|e)(+|-)?[0-9]+)?\n */\n\n\nfunction readNumber(source, start, firstCode, line, col, prev) {\n var body = source.body;\n var code = firstCode;\n var position = start;\n var isFloat = false;\n\n if (code === 45) {\n // -\n code = body.charCodeAt(++position);\n }\n\n if (code === 48) {\n // 0\n code = body.charCodeAt(++position);\n\n if (code >= 48 && code <= 57) {\n throw syntaxError(source, position, \"Invalid number, unexpected digit after 0: \".concat(printCharCode(code), \".\"));\n }\n } else {\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n }\n\n if (code === 46) {\n // .\n isFloat = true;\n code = body.charCodeAt(++position);\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n }\n\n if (code === 69 || code === 101) {\n // E e\n isFloat = true;\n code = body.charCodeAt(++position);\n\n if (code === 43 || code === 45) {\n // + -\n code = body.charCodeAt(++position);\n }\n\n position = readDigits(source, position, code);\n code = body.charCodeAt(position);\n } // Numbers cannot be followed by . or NameStart\n\n\n if (code === 46 || isNameStart(code)) {\n throw syntaxError(source, position, \"Invalid number, expected digit but got: \".concat(printCharCode(code), \".\"));\n }\n\n return new Token(isFloat ? TokenKind.FLOAT : TokenKind.INT, start, position, line, col, prev, body.slice(start, position));\n}\n/**\n * Returns the new position in the source after reading digits.\n */\n\n\nfunction readDigits(source, start, firstCode) {\n var body = source.body;\n var position = start;\n var code = firstCode;\n\n if (code >= 48 && code <= 57) {\n // 0 - 9\n do {\n code = body.charCodeAt(++position);\n } while (code >= 48 && code <= 57); // 0 - 9\n\n\n return position;\n }\n\n throw syntaxError(source, position, \"Invalid number, expected digit but got: \".concat(printCharCode(code), \".\"));\n}\n/**\n * Reads a string token from the source file.\n *\n * \"([^\"\\\\\\u000A\\u000D]|(\\\\(u[0-9a-fA-F]{4}|[\"\\\\/bfnrt])))*\"\n */\n\n\nfunction readString(source, start, line, col, prev) {\n var body = source.body;\n var position = start + 1;\n var chunkStart = position;\n var code = 0;\n var value = '';\n\n while (position < body.length && !isNaN(code = body.charCodeAt(position)) && // not LineTerminator\n code !== 0x000a && code !== 0x000d) {\n // Closing Quote (\")\n if (code === 34) {\n value += body.slice(chunkStart, position);\n return new Token(TokenKind.STRING, start, position + 1, line, col, prev, value);\n } // SourceCharacter\n\n\n if (code < 0x0020 && code !== 0x0009) {\n throw syntaxError(source, position, \"Invalid character within String: \".concat(printCharCode(code), \".\"));\n }\n\n ++position;\n\n if (code === 92) {\n // \\\n value += body.slice(chunkStart, position - 1);\n code = body.charCodeAt(position);\n\n switch (code) {\n case 34:\n value += '\"';\n break;\n\n case 47:\n value += '/';\n break;\n\n case 92:\n value += '\\\\';\n break;\n\n case 98:\n value += '\\b';\n break;\n\n case 102:\n value += '\\f';\n break;\n\n case 110:\n value += '\\n';\n break;\n\n case 114:\n value += '\\r';\n break;\n\n case 116:\n value += '\\t';\n break;\n\n case 117:\n {\n // uXXXX\n var charCode = uniCharCode(body.charCodeAt(position + 1), body.charCodeAt(position + 2), body.charCodeAt(position + 3), body.charCodeAt(position + 4));\n\n if (charCode < 0) {\n var invalidSequence = body.slice(position + 1, position + 5);\n throw syntaxError(source, position, \"Invalid character escape sequence: \\\\u\".concat(invalidSequence, \".\"));\n }\n\n value += String.fromCharCode(charCode);\n position += 4;\n break;\n }\n\n default:\n throw syntaxError(source, position, \"Invalid character escape sequence: \\\\\".concat(String.fromCharCode(code), \".\"));\n }\n\n ++position;\n chunkStart = position;\n }\n }\n\n throw syntaxError(source, position, 'Unterminated string.');\n}\n/**\n * Reads a block string token from the source file.\n *\n * \"\"\"(\"?\"?(\\\\\"\"\"|\\\\(?!=\"\"\")|[^\"\\\\]))*\"\"\"\n */\n\n\nfunction readBlockString(source, start, line, col, prev, lexer) {\n var body = source.body;\n var position = start + 3;\n var chunkStart = position;\n var code = 0;\n var rawValue = '';\n\n while (position < body.length && !isNaN(code = body.charCodeAt(position))) {\n // Closing Triple-Quote (\"\"\")\n if (code === 34 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34) {\n rawValue += body.slice(chunkStart, position);\n return new Token(TokenKind.BLOCK_STRING, start, position + 3, line, col, prev, dedentBlockStringValue(rawValue));\n } // SourceCharacter\n\n\n if (code < 0x0020 && code !== 0x0009 && code !== 0x000a && code !== 0x000d) {\n throw syntaxError(source, position, \"Invalid character within String: \".concat(printCharCode(code), \".\"));\n }\n\n if (code === 10) {\n // new line\n ++position;\n ++lexer.line;\n lexer.lineStart = position;\n } else if (code === 13) {\n // carriage return\n if (body.charCodeAt(position + 1) === 10) {\n position += 2;\n } else {\n ++position;\n }\n\n ++lexer.line;\n lexer.lineStart = position;\n } else if ( // Escape Triple-Quote (\\\"\"\")\n code === 92 && body.charCodeAt(position + 1) === 34 && body.charCodeAt(position + 2) === 34 && body.charCodeAt(position + 3) === 34) {\n rawValue += body.slice(chunkStart, position) + '\"\"\"';\n position += 4;\n chunkStart = position;\n } else {\n ++position;\n }\n }\n\n throw syntaxError(source, position, 'Unterminated string.');\n}\n/**\n * Converts four hexadecimal chars to the integer that the\n * string represents. For example, uniCharCode('0','0','0','f')\n * will return 15, and uniCharCode('0','0','f','f') returns 255.\n *\n * Returns a negative number on error, if a char was invalid.\n *\n * This is implemented by noting that char2hex() returns -1 on error,\n * which means the result of ORing the char2hex() will also be negative.\n */\n\n\nfunction uniCharCode(a, b, c, d) {\n return char2hex(a) << 12 | char2hex(b) << 8 | char2hex(c) << 4 | char2hex(d);\n}\n/**\n * Converts a hex character to its integer value.\n * '0' becomes 0, '9' becomes 9\n * 'A' becomes 10, 'F' becomes 15\n * 'a' becomes 10, 'f' becomes 15\n *\n * Returns -1 on error.\n */\n\n\nfunction char2hex(a) {\n return a >= 48 && a <= 57 ? a - 48 // 0-9\n : a >= 65 && a <= 70 ? a - 55 // A-F\n : a >= 97 && a <= 102 ? a - 87 // a-f\n : -1;\n}\n/**\n * Reads an alphanumeric + underscore name from the source.\n *\n * [_A-Za-z][_0-9A-Za-z]*\n */\n\n\nfunction readName(source, start, line, col, prev) {\n var body = source.body;\n var bodyLength = body.length;\n var position = start + 1;\n var code = 0;\n\n while (position !== bodyLength && !isNaN(code = body.charCodeAt(position)) && (code === 95 || // _\n code >= 48 && code <= 57 || // 0-9\n code >= 65 && code <= 90 || // A-Z\n code >= 97 && code <= 122) // a-z\n ) {\n ++position;\n }\n\n return new Token(TokenKind.NAME, start, position, line, col, prev, body.slice(start, position));\n} // _ A-Z a-z\n\n\nfunction isNameStart(code) {\n return code === 95 || code >= 65 && code <= 90 || code >= 97 && code <= 122;\n}\n","import { syntaxError } from \"../error/syntaxError.mjs\";\nimport { Kind } from \"./kinds.mjs\";\nimport { Location } from \"./ast.mjs\";\nimport { TokenKind } from \"./tokenKind.mjs\";\nimport { Source, isSource } from \"./source.mjs\";\nimport { DirectiveLocation } from \"./directiveLocation.mjs\";\nimport { Lexer, isPunctuatorTokenKind } from \"./lexer.mjs\";\n/**\n * Configuration options to control parser behavior\n */\n\n/**\n * Given a GraphQL source, parses it into a Document.\n * Throws GraphQLError if a syntax error is encountered.\n */\nexport function parse(source, options) {\n var parser = new Parser(source, options);\n return parser.parseDocument();\n}\n/**\n * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for\n * that value.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Values directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: valueFromAST().\n */\n\nexport function parseValue(source, options) {\n var parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n var value = parser.parseValueLiteral(false);\n parser.expectToken(TokenKind.EOF);\n return value;\n}\n/**\n * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for\n * that type.\n * Throws GraphQLError if a syntax error is encountered.\n *\n * This is useful within tools that operate upon GraphQL Types directly and\n * in isolation of complete GraphQL documents.\n *\n * Consider providing the results to the utility function: typeFromAST().\n */\n\nexport function parseType(source, options) {\n var parser = new Parser(source, options);\n parser.expectToken(TokenKind.SOF);\n var type = parser.parseTypeReference();\n parser.expectToken(TokenKind.EOF);\n return type;\n}\n/**\n * This class is exported only to assist people in implementing their own parsers\n * without duplicating too much code and should be used only as last resort for cases\n * such as experimental syntax or if certain features could not be contributed upstream.\n *\n * It is still part of the internal API and is versioned, so any changes to it are never\n * considered breaking changes. If you still need to support multiple versions of the\n * library, please use the `versionInfo` variable for version detection.\n *\n * @internal\n */\n\nexport var Parser = /*#__PURE__*/function () {\n function Parser(source, options) {\n var sourceObj = isSource(source) ? source : new Source(source);\n this._lexer = new Lexer(sourceObj);\n this._options = options;\n }\n /**\n * Converts a name lex token into a name parse node.\n */\n\n\n var _proto = Parser.prototype;\n\n _proto.parseName = function parseName() {\n var token = this.expectToken(TokenKind.NAME);\n return {\n kind: Kind.NAME,\n value: token.value,\n loc: this.loc(token)\n };\n } // Implements the parsing rules in the Document section.\n\n /**\n * Document : Definition+\n */\n ;\n\n _proto.parseDocument = function parseDocument() {\n var start = this._lexer.token;\n return {\n kind: Kind.DOCUMENT,\n definitions: this.many(TokenKind.SOF, this.parseDefinition, TokenKind.EOF),\n loc: this.loc(start)\n };\n }\n /**\n * Definition :\n * - ExecutableDefinition\n * - TypeSystemDefinition\n * - TypeSystemExtension\n *\n * ExecutableDefinition :\n * - OperationDefinition\n * - FragmentDefinition\n */\n ;\n\n _proto.parseDefinition = function parseDefinition() {\n if (this.peek(TokenKind.NAME)) {\n switch (this._lexer.token.value) {\n case 'query':\n case 'mutation':\n case 'subscription':\n return this.parseOperationDefinition();\n\n case 'fragment':\n return this.parseFragmentDefinition();\n\n case 'schema':\n case 'scalar':\n case 'type':\n case 'interface':\n case 'union':\n case 'enum':\n case 'input':\n case 'directive':\n return this.parseTypeSystemDefinition();\n\n case 'extend':\n return this.parseTypeSystemExtension();\n }\n } else if (this.peek(TokenKind.BRACE_L)) {\n return this.parseOperationDefinition();\n } else if (this.peekDescription()) {\n return this.parseTypeSystemDefinition();\n }\n\n throw this.unexpected();\n } // Implements the parsing rules in the Operations section.\n\n /**\n * OperationDefinition :\n * - SelectionSet\n * - OperationType Name? VariableDefinitions? Directives? SelectionSet\n */\n ;\n\n _proto.parseOperationDefinition = function parseOperationDefinition() {\n var start = this._lexer.token;\n\n if (this.peek(TokenKind.BRACE_L)) {\n return {\n kind: Kind.OPERATION_DEFINITION,\n operation: 'query',\n name: undefined,\n variableDefinitions: [],\n directives: [],\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n\n var operation = this.parseOperationType();\n var name;\n\n if (this.peek(TokenKind.NAME)) {\n name = this.parseName();\n }\n\n return {\n kind: Kind.OPERATION_DEFINITION,\n operation: operation,\n name: name,\n variableDefinitions: this.parseVariableDefinitions(),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * OperationType : one of query mutation subscription\n */\n ;\n\n _proto.parseOperationType = function parseOperationType() {\n var operationToken = this.expectToken(TokenKind.NAME);\n\n switch (operationToken.value) {\n case 'query':\n return 'query';\n\n case 'mutation':\n return 'mutation';\n\n case 'subscription':\n return 'subscription';\n }\n\n throw this.unexpected(operationToken);\n }\n /**\n * VariableDefinitions : ( VariableDefinition+ )\n */\n ;\n\n _proto.parseVariableDefinitions = function parseVariableDefinitions() {\n return this.optionalMany(TokenKind.PAREN_L, this.parseVariableDefinition, TokenKind.PAREN_R);\n }\n /**\n * VariableDefinition : Variable : Type DefaultValue? Directives[Const]?\n */\n ;\n\n _proto.parseVariableDefinition = function parseVariableDefinition() {\n var start = this._lexer.token;\n return {\n kind: Kind.VARIABLE_DEFINITION,\n variable: this.parseVariable(),\n type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()),\n defaultValue: this.expectOptionalToken(TokenKind.EQUALS) ? this.parseValueLiteral(true) : undefined,\n directives: this.parseDirectives(true),\n loc: this.loc(start)\n };\n }\n /**\n * Variable : $ Name\n */\n ;\n\n _proto.parseVariable = function parseVariable() {\n var start = this._lexer.token;\n this.expectToken(TokenKind.DOLLAR);\n return {\n kind: Kind.VARIABLE,\n name: this.parseName(),\n loc: this.loc(start)\n };\n }\n /**\n * SelectionSet : { Selection+ }\n */\n ;\n\n _proto.parseSelectionSet = function parseSelectionSet() {\n var start = this._lexer.token;\n return {\n kind: Kind.SELECTION_SET,\n selections: this.many(TokenKind.BRACE_L, this.parseSelection, TokenKind.BRACE_R),\n loc: this.loc(start)\n };\n }\n /**\n * Selection :\n * - Field\n * - FragmentSpread\n * - InlineFragment\n */\n ;\n\n _proto.parseSelection = function parseSelection() {\n return this.peek(TokenKind.SPREAD) ? this.parseFragment() : this.parseField();\n }\n /**\n * Field : Alias? Name Arguments? Directives? SelectionSet?\n *\n * Alias : Name :\n */\n ;\n\n _proto.parseField = function parseField() {\n var start = this._lexer.token;\n var nameOrAlias = this.parseName();\n var alias;\n var name;\n\n if (this.expectOptionalToken(TokenKind.COLON)) {\n alias = nameOrAlias;\n name = this.parseName();\n } else {\n name = nameOrAlias;\n }\n\n return {\n kind: Kind.FIELD,\n alias: alias,\n name: name,\n arguments: this.parseArguments(false),\n directives: this.parseDirectives(false),\n selectionSet: this.peek(TokenKind.BRACE_L) ? this.parseSelectionSet() : undefined,\n loc: this.loc(start)\n };\n }\n /**\n * Arguments[Const] : ( Argument[?Const]+ )\n */\n ;\n\n _proto.parseArguments = function parseArguments(isConst) {\n var item = isConst ? this.parseConstArgument : this.parseArgument;\n return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R);\n }\n /**\n * Argument[Const] : Name : Value[?Const]\n */\n ;\n\n _proto.parseArgument = function parseArgument() {\n var start = this._lexer.token;\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return {\n kind: Kind.ARGUMENT,\n name: name,\n value: this.parseValueLiteral(false),\n loc: this.loc(start)\n };\n };\n\n _proto.parseConstArgument = function parseConstArgument() {\n var start = this._lexer.token;\n return {\n kind: Kind.ARGUMENT,\n name: this.parseName(),\n value: (this.expectToken(TokenKind.COLON), this.parseValueLiteral(true)),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Fragments section.\n\n /**\n * Corresponds to both FragmentSpread and InlineFragment in the spec.\n *\n * FragmentSpread : ... FragmentName Directives?\n *\n * InlineFragment : ... TypeCondition? Directives? SelectionSet\n */\n ;\n\n _proto.parseFragment = function parseFragment() {\n var start = this._lexer.token;\n this.expectToken(TokenKind.SPREAD);\n var hasTypeCondition = this.expectOptionalKeyword('on');\n\n if (!hasTypeCondition && this.peek(TokenKind.NAME)) {\n return {\n kind: Kind.FRAGMENT_SPREAD,\n name: this.parseFragmentName(),\n directives: this.parseDirectives(false),\n loc: this.loc(start)\n };\n }\n\n return {\n kind: Kind.INLINE_FRAGMENT,\n typeCondition: hasTypeCondition ? this.parseNamedType() : undefined,\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * FragmentDefinition :\n * - fragment FragmentName on TypeCondition Directives? SelectionSet\n *\n * TypeCondition : NamedType\n */\n ;\n\n _proto.parseFragmentDefinition = function parseFragmentDefinition() {\n var _this$_options;\n\n var start = this._lexer.token;\n this.expectKeyword('fragment'); // Experimental support for defining variables within fragments changes\n // the grammar of FragmentDefinition:\n // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet\n\n if (((_this$_options = this._options) === null || _this$_options === void 0 ? void 0 : _this$_options.experimentalFragmentVariables) === true) {\n return {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n variableDefinitions: this.parseVariableDefinitions(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n\n return {\n kind: Kind.FRAGMENT_DEFINITION,\n name: this.parseFragmentName(),\n typeCondition: (this.expectKeyword('on'), this.parseNamedType()),\n directives: this.parseDirectives(false),\n selectionSet: this.parseSelectionSet(),\n loc: this.loc(start)\n };\n }\n /**\n * FragmentName : Name but not `on`\n */\n ;\n\n _proto.parseFragmentName = function parseFragmentName() {\n if (this._lexer.token.value === 'on') {\n throw this.unexpected();\n }\n\n return this.parseName();\n } // Implements the parsing rules in the Values section.\n\n /**\n * Value[Const] :\n * - [~Const] Variable\n * - IntValue\n * - FloatValue\n * - StringValue\n * - BooleanValue\n * - NullValue\n * - EnumValue\n * - ListValue[?Const]\n * - ObjectValue[?Const]\n *\n * BooleanValue : one of `true` `false`\n *\n * NullValue : `null`\n *\n * EnumValue : Name but not `true`, `false` or `null`\n */\n ;\n\n _proto.parseValueLiteral = function parseValueLiteral(isConst) {\n var token = this._lexer.token;\n\n switch (token.kind) {\n case TokenKind.BRACKET_L:\n return this.parseList(isConst);\n\n case TokenKind.BRACE_L:\n return this.parseObject(isConst);\n\n case TokenKind.INT:\n this._lexer.advance();\n\n return {\n kind: Kind.INT,\n value: token.value,\n loc: this.loc(token)\n };\n\n case TokenKind.FLOAT:\n this._lexer.advance();\n\n return {\n kind: Kind.FLOAT,\n value: token.value,\n loc: this.loc(token)\n };\n\n case TokenKind.STRING:\n case TokenKind.BLOCK_STRING:\n return this.parseStringLiteral();\n\n case TokenKind.NAME:\n this._lexer.advance();\n\n switch (token.value) {\n case 'true':\n return {\n kind: Kind.BOOLEAN,\n value: true,\n loc: this.loc(token)\n };\n\n case 'false':\n return {\n kind: Kind.BOOLEAN,\n value: false,\n loc: this.loc(token)\n };\n\n case 'null':\n return {\n kind: Kind.NULL,\n loc: this.loc(token)\n };\n\n default:\n return {\n kind: Kind.ENUM,\n value: token.value,\n loc: this.loc(token)\n };\n }\n\n case TokenKind.DOLLAR:\n if (!isConst) {\n return this.parseVariable();\n }\n\n break;\n }\n\n throw this.unexpected();\n };\n\n _proto.parseStringLiteral = function parseStringLiteral() {\n var token = this._lexer.token;\n\n this._lexer.advance();\n\n return {\n kind: Kind.STRING,\n value: token.value,\n block: token.kind === TokenKind.BLOCK_STRING,\n loc: this.loc(token)\n };\n }\n /**\n * ListValue[Const] :\n * - [ ]\n * - [ Value[?Const]+ ]\n */\n ;\n\n _proto.parseList = function parseList(isConst) {\n var _this = this;\n\n var start = this._lexer.token;\n\n var item = function item() {\n return _this.parseValueLiteral(isConst);\n };\n\n return {\n kind: Kind.LIST,\n values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R),\n loc: this.loc(start)\n };\n }\n /**\n * ObjectValue[Const] :\n * - { }\n * - { ObjectField[?Const]+ }\n */\n ;\n\n _proto.parseObject = function parseObject(isConst) {\n var _this2 = this;\n\n var start = this._lexer.token;\n\n var item = function item() {\n return _this2.parseObjectField(isConst);\n };\n\n return {\n kind: Kind.OBJECT,\n fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R),\n loc: this.loc(start)\n };\n }\n /**\n * ObjectField[Const] : Name : Value[?Const]\n */\n ;\n\n _proto.parseObjectField = function parseObjectField(isConst) {\n var start = this._lexer.token;\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n return {\n kind: Kind.OBJECT_FIELD,\n name: name,\n value: this.parseValueLiteral(isConst),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Directives section.\n\n /**\n * Directives[Const] : Directive[?Const]+\n */\n ;\n\n _proto.parseDirectives = function parseDirectives(isConst) {\n var directives = [];\n\n while (this.peek(TokenKind.AT)) {\n directives.push(this.parseDirective(isConst));\n }\n\n return directives;\n }\n /**\n * Directive[Const] : @ Name Arguments[?Const]?\n */\n ;\n\n _proto.parseDirective = function parseDirective(isConst) {\n var start = this._lexer.token;\n this.expectToken(TokenKind.AT);\n return {\n kind: Kind.DIRECTIVE,\n name: this.parseName(),\n arguments: this.parseArguments(isConst),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Types section.\n\n /**\n * Type :\n * - NamedType\n * - ListType\n * - NonNullType\n */\n ;\n\n _proto.parseTypeReference = function parseTypeReference() {\n var start = this._lexer.token;\n var type;\n\n if (this.expectOptionalToken(TokenKind.BRACKET_L)) {\n type = this.parseTypeReference();\n this.expectToken(TokenKind.BRACKET_R);\n type = {\n kind: Kind.LIST_TYPE,\n type: type,\n loc: this.loc(start)\n };\n } else {\n type = this.parseNamedType();\n }\n\n if (this.expectOptionalToken(TokenKind.BANG)) {\n return {\n kind: Kind.NON_NULL_TYPE,\n type: type,\n loc: this.loc(start)\n };\n }\n\n return type;\n }\n /**\n * NamedType : Name\n */\n ;\n\n _proto.parseNamedType = function parseNamedType() {\n var start = this._lexer.token;\n return {\n kind: Kind.NAMED_TYPE,\n name: this.parseName(),\n loc: this.loc(start)\n };\n } // Implements the parsing rules in the Type Definition section.\n\n /**\n * TypeSystemDefinition :\n * - SchemaDefinition\n * - TypeDefinition\n * - DirectiveDefinition\n *\n * TypeDefinition :\n * - ScalarTypeDefinition\n * - ObjectTypeDefinition\n * - InterfaceTypeDefinition\n * - UnionTypeDefinition\n * - EnumTypeDefinition\n * - InputObjectTypeDefinition\n */\n ;\n\n _proto.parseTypeSystemDefinition = function parseTypeSystemDefinition() {\n // Many definitions begin with a description and require a lookahead.\n var keywordToken = this.peekDescription() ? this._lexer.lookahead() : this._lexer.token;\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaDefinition();\n\n case 'scalar':\n return this.parseScalarTypeDefinition();\n\n case 'type':\n return this.parseObjectTypeDefinition();\n\n case 'interface':\n return this.parseInterfaceTypeDefinition();\n\n case 'union':\n return this.parseUnionTypeDefinition();\n\n case 'enum':\n return this.parseEnumTypeDefinition();\n\n case 'input':\n return this.parseInputObjectTypeDefinition();\n\n case 'directive':\n return this.parseDirectiveDefinition();\n }\n }\n\n throw this.unexpected(keywordToken);\n };\n\n _proto.peekDescription = function peekDescription() {\n return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING);\n }\n /**\n * Description : StringValue\n */\n ;\n\n _proto.parseDescription = function parseDescription() {\n if (this.peekDescription()) {\n return this.parseStringLiteral();\n }\n }\n /**\n * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ }\n */\n ;\n\n _proto.parseSchemaDefinition = function parseSchemaDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('schema');\n var directives = this.parseDirectives(true);\n var operationTypes = this.many(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);\n return {\n kind: Kind.SCHEMA_DEFINITION,\n description: description,\n directives: directives,\n operationTypes: operationTypes,\n loc: this.loc(start)\n };\n }\n /**\n * OperationTypeDefinition : OperationType : NamedType\n */\n ;\n\n _proto.parseOperationTypeDefinition = function parseOperationTypeDefinition() {\n var start = this._lexer.token;\n var operation = this.parseOperationType();\n this.expectToken(TokenKind.COLON);\n var type = this.parseNamedType();\n return {\n kind: Kind.OPERATION_TYPE_DEFINITION,\n operation: operation,\n type: type,\n loc: this.loc(start)\n };\n }\n /**\n * ScalarTypeDefinition : Description? scalar Name Directives[Const]?\n */\n ;\n\n _proto.parseScalarTypeDefinition = function parseScalarTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('scalar');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.SCALAR_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ObjectTypeDefinition :\n * Description?\n * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition?\n */\n ;\n\n _proto.parseObjectTypeDefinition = function parseObjectTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('type');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n return {\n kind: Kind.OBJECT_TYPE_DEFINITION,\n description: description,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * ImplementsInterfaces :\n * - implements `&`? NamedType\n * - ImplementsInterfaces & NamedType\n */\n ;\n\n _proto.parseImplementsInterfaces = function parseImplementsInterfaces() {\n var _this$_options2;\n\n if (!this.expectOptionalKeyword('implements')) {\n return [];\n }\n\n if (((_this$_options2 = this._options) === null || _this$_options2 === void 0 ? void 0 : _this$_options2.allowLegacySDLImplementsInterfaces) === true) {\n var types = []; // Optional leading ampersand\n\n this.expectOptionalToken(TokenKind.AMP);\n\n do {\n types.push(this.parseNamedType());\n } while (this.expectOptionalToken(TokenKind.AMP) || this.peek(TokenKind.NAME));\n\n return types;\n }\n\n return this.delimitedMany(TokenKind.AMP, this.parseNamedType);\n }\n /**\n * FieldsDefinition : { FieldDefinition+ }\n */\n ;\n\n _proto.parseFieldsDefinition = function parseFieldsDefinition() {\n var _this$_options3;\n\n // Legacy support for the SDL?\n if (((_this$_options3 = this._options) === null || _this$_options3 === void 0 ? void 0 : _this$_options3.allowLegacySDLEmptyFields) === true && this.peek(TokenKind.BRACE_L) && this._lexer.lookahead().kind === TokenKind.BRACE_R) {\n this._lexer.advance();\n\n this._lexer.advance();\n\n return [];\n }\n\n return this.optionalMany(TokenKind.BRACE_L, this.parseFieldDefinition, TokenKind.BRACE_R);\n }\n /**\n * FieldDefinition :\n * - Description? Name ArgumentsDefinition? : Type Directives[Const]?\n */\n ;\n\n _proto.parseFieldDefinition = function parseFieldDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n var args = this.parseArgumentDefs();\n this.expectToken(TokenKind.COLON);\n var type = this.parseTypeReference();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.FIELD_DEFINITION,\n description: description,\n name: name,\n arguments: args,\n type: type,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ArgumentsDefinition : ( InputValueDefinition+ )\n */\n ;\n\n _proto.parseArgumentDefs = function parseArgumentDefs() {\n return this.optionalMany(TokenKind.PAREN_L, this.parseInputValueDef, TokenKind.PAREN_R);\n }\n /**\n * InputValueDefinition :\n * - Description? Name : Type DefaultValue? Directives[Const]?\n */\n ;\n\n _proto.parseInputValueDef = function parseInputValueDef() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n this.expectToken(TokenKind.COLON);\n var type = this.parseTypeReference();\n var defaultValue;\n\n if (this.expectOptionalToken(TokenKind.EQUALS)) {\n defaultValue = this.parseValueLiteral(true);\n }\n\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.INPUT_VALUE_DEFINITION,\n description: description,\n name: name,\n type: type,\n defaultValue: defaultValue,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * InterfaceTypeDefinition :\n * - Description? interface Name Directives[Const]? FieldsDefinition?\n */\n ;\n\n _proto.parseInterfaceTypeDefinition = function parseInterfaceTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('interface');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n return {\n kind: Kind.INTERFACE_TYPE_DEFINITION,\n description: description,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * UnionTypeDefinition :\n * - Description? union Name Directives[Const]? UnionMemberTypes?\n */\n ;\n\n _proto.parseUnionTypeDefinition = function parseUnionTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('union');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var types = this.parseUnionMemberTypes();\n return {\n kind: Kind.UNION_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n types: types,\n loc: this.loc(start)\n };\n }\n /**\n * UnionMemberTypes :\n * - = `|`? NamedType\n * - UnionMemberTypes | NamedType\n */\n ;\n\n _proto.parseUnionMemberTypes = function parseUnionMemberTypes() {\n return this.expectOptionalToken(TokenKind.EQUALS) ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) : [];\n }\n /**\n * EnumTypeDefinition :\n * - Description? enum Name Directives[Const]? EnumValuesDefinition?\n */\n ;\n\n _proto.parseEnumTypeDefinition = function parseEnumTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('enum');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var values = this.parseEnumValuesDefinition();\n return {\n kind: Kind.ENUM_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n values: values,\n loc: this.loc(start)\n };\n }\n /**\n * EnumValuesDefinition : { EnumValueDefinition+ }\n */\n ;\n\n _proto.parseEnumValuesDefinition = function parseEnumValuesDefinition() {\n return this.optionalMany(TokenKind.BRACE_L, this.parseEnumValueDefinition, TokenKind.BRACE_R);\n }\n /**\n * EnumValueDefinition : Description? EnumValue Directives[Const]?\n *\n * EnumValue : Name\n */\n ;\n\n _proto.parseEnumValueDefinition = function parseEnumValueDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n return {\n kind: Kind.ENUM_VALUE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * InputObjectTypeDefinition :\n * - Description? input Name Directives[Const]? InputFieldsDefinition?\n */\n ;\n\n _proto.parseInputObjectTypeDefinition = function parseInputObjectTypeDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('input');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseInputFieldsDefinition();\n return {\n kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,\n description: description,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * InputFieldsDefinition : { InputValueDefinition+ }\n */\n ;\n\n _proto.parseInputFieldsDefinition = function parseInputFieldsDefinition() {\n return this.optionalMany(TokenKind.BRACE_L, this.parseInputValueDef, TokenKind.BRACE_R);\n }\n /**\n * TypeSystemExtension :\n * - SchemaExtension\n * - TypeExtension\n *\n * TypeExtension :\n * - ScalarTypeExtension\n * - ObjectTypeExtension\n * - InterfaceTypeExtension\n * - UnionTypeExtension\n * - EnumTypeExtension\n * - InputObjectTypeDefinition\n */\n ;\n\n _proto.parseTypeSystemExtension = function parseTypeSystemExtension() {\n var keywordToken = this._lexer.lookahead();\n\n if (keywordToken.kind === TokenKind.NAME) {\n switch (keywordToken.value) {\n case 'schema':\n return this.parseSchemaExtension();\n\n case 'scalar':\n return this.parseScalarTypeExtension();\n\n case 'type':\n return this.parseObjectTypeExtension();\n\n case 'interface':\n return this.parseInterfaceTypeExtension();\n\n case 'union':\n return this.parseUnionTypeExtension();\n\n case 'enum':\n return this.parseEnumTypeExtension();\n\n case 'input':\n return this.parseInputObjectTypeExtension();\n }\n }\n\n throw this.unexpected(keywordToken);\n }\n /**\n * SchemaExtension :\n * - extend schema Directives[Const]? { OperationTypeDefinition+ }\n * - extend schema Directives[Const]\n */\n ;\n\n _proto.parseSchemaExtension = function parseSchemaExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('schema');\n var directives = this.parseDirectives(true);\n var operationTypes = this.optionalMany(TokenKind.BRACE_L, this.parseOperationTypeDefinition, TokenKind.BRACE_R);\n\n if (directives.length === 0 && operationTypes.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.SCHEMA_EXTENSION,\n directives: directives,\n operationTypes: operationTypes,\n loc: this.loc(start)\n };\n }\n /**\n * ScalarTypeExtension :\n * - extend scalar Name Directives[Const]\n */\n ;\n\n _proto.parseScalarTypeExtension = function parseScalarTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('scalar');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n\n if (directives.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.SCALAR_TYPE_EXTENSION,\n name: name,\n directives: directives,\n loc: this.loc(start)\n };\n }\n /**\n * ObjectTypeExtension :\n * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend type Name ImplementsInterfaces? Directives[Const]\n * - extend type Name ImplementsInterfaces\n */\n ;\n\n _proto.parseObjectTypeExtension = function parseObjectTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('type');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n\n if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.OBJECT_TYPE_EXTENSION,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * InterfaceTypeExtension :\n * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition\n * - extend interface Name ImplementsInterfaces? Directives[Const]\n * - extend interface Name ImplementsInterfaces\n */\n ;\n\n _proto.parseInterfaceTypeExtension = function parseInterfaceTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('interface');\n var name = this.parseName();\n var interfaces = this.parseImplementsInterfaces();\n var directives = this.parseDirectives(true);\n var fields = this.parseFieldsDefinition();\n\n if (interfaces.length === 0 && directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.INTERFACE_TYPE_EXTENSION,\n name: name,\n interfaces: interfaces,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * UnionTypeExtension :\n * - extend union Name Directives[Const]? UnionMemberTypes\n * - extend union Name Directives[Const]\n */\n ;\n\n _proto.parseUnionTypeExtension = function parseUnionTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('union');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var types = this.parseUnionMemberTypes();\n\n if (directives.length === 0 && types.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.UNION_TYPE_EXTENSION,\n name: name,\n directives: directives,\n types: types,\n loc: this.loc(start)\n };\n }\n /**\n * EnumTypeExtension :\n * - extend enum Name Directives[Const]? EnumValuesDefinition\n * - extend enum Name Directives[Const]\n */\n ;\n\n _proto.parseEnumTypeExtension = function parseEnumTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('enum');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var values = this.parseEnumValuesDefinition();\n\n if (directives.length === 0 && values.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.ENUM_TYPE_EXTENSION,\n name: name,\n directives: directives,\n values: values,\n loc: this.loc(start)\n };\n }\n /**\n * InputObjectTypeExtension :\n * - extend input Name Directives[Const]? InputFieldsDefinition\n * - extend input Name Directives[Const]\n */\n ;\n\n _proto.parseInputObjectTypeExtension = function parseInputObjectTypeExtension() {\n var start = this._lexer.token;\n this.expectKeyword('extend');\n this.expectKeyword('input');\n var name = this.parseName();\n var directives = this.parseDirectives(true);\n var fields = this.parseInputFieldsDefinition();\n\n if (directives.length === 0 && fields.length === 0) {\n throw this.unexpected();\n }\n\n return {\n kind: Kind.INPUT_OBJECT_TYPE_EXTENSION,\n name: name,\n directives: directives,\n fields: fields,\n loc: this.loc(start)\n };\n }\n /**\n * DirectiveDefinition :\n * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations\n */\n ;\n\n _proto.parseDirectiveDefinition = function parseDirectiveDefinition() {\n var start = this._lexer.token;\n var description = this.parseDescription();\n this.expectKeyword('directive');\n this.expectToken(TokenKind.AT);\n var name = this.parseName();\n var args = this.parseArgumentDefs();\n var repeatable = this.expectOptionalKeyword('repeatable');\n this.expectKeyword('on');\n var locations = this.parseDirectiveLocations();\n return {\n kind: Kind.DIRECTIVE_DEFINITION,\n description: description,\n name: name,\n arguments: args,\n repeatable: repeatable,\n locations: locations,\n loc: this.loc(start)\n };\n }\n /**\n * DirectiveLocations :\n * - `|`? DirectiveLocation\n * - DirectiveLocations | DirectiveLocation\n */\n ;\n\n _proto.parseDirectiveLocations = function parseDirectiveLocations() {\n return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation);\n }\n /*\n * DirectiveLocation :\n * - ExecutableDirectiveLocation\n * - TypeSystemDirectiveLocation\n *\n * ExecutableDirectiveLocation : one of\n * `QUERY`\n * `MUTATION`\n * `SUBSCRIPTION`\n * `FIELD`\n * `FRAGMENT_DEFINITION`\n * `FRAGMENT_SPREAD`\n * `INLINE_FRAGMENT`\n *\n * TypeSystemDirectiveLocation : one of\n * `SCHEMA`\n * `SCALAR`\n * `OBJECT`\n * `FIELD_DEFINITION`\n * `ARGUMENT_DEFINITION`\n * `INTERFACE`\n * `UNION`\n * `ENUM`\n * `ENUM_VALUE`\n * `INPUT_OBJECT`\n * `INPUT_FIELD_DEFINITION`\n */\n ;\n\n _proto.parseDirectiveLocation = function parseDirectiveLocation() {\n var start = this._lexer.token;\n var name = this.parseName();\n\n if (DirectiveLocation[name.value] !== undefined) {\n return name;\n }\n\n throw this.unexpected(start);\n } // Core parsing utility functions\n\n /**\n * Returns a location object, used to identify the place in the source that created a given parsed object.\n */\n ;\n\n _proto.loc = function loc(startToken) {\n var _this$_options4;\n\n if (((_this$_options4 = this._options) === null || _this$_options4 === void 0 ? void 0 : _this$_options4.noLocation) !== true) {\n return new Location(startToken, this._lexer.lastToken, this._lexer.source);\n }\n }\n /**\n * Determines if the next token is of a given kind\n */\n ;\n\n _proto.peek = function peek(kind) {\n return this._lexer.token.kind === kind;\n }\n /**\n * If the next token is of the given kind, return that token after advancing the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n ;\n\n _proto.expectToken = function expectToken(kind) {\n var token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n throw syntaxError(this._lexer.source, token.start, \"Expected \".concat(getTokenKindDesc(kind), \", found \").concat(getTokenDesc(token), \".\"));\n }\n /**\n * If the next token is of the given kind, return that token after advancing the lexer.\n * Otherwise, do not change the parser state and return undefined.\n */\n ;\n\n _proto.expectOptionalToken = function expectOptionalToken(kind) {\n var token = this._lexer.token;\n\n if (token.kind === kind) {\n this._lexer.advance();\n\n return token;\n }\n\n return undefined;\n }\n /**\n * If the next token is a given keyword, advance the lexer.\n * Otherwise, do not change the parser state and throw an error.\n */\n ;\n\n _proto.expectKeyword = function expectKeyword(value) {\n var token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n } else {\n throw syntaxError(this._lexer.source, token.start, \"Expected \\\"\".concat(value, \"\\\", found \").concat(getTokenDesc(token), \".\"));\n }\n }\n /**\n * If the next token is a given keyword, return \"true\" after advancing the lexer.\n * Otherwise, do not change the parser state and return \"false\".\n */\n ;\n\n _proto.expectOptionalKeyword = function expectOptionalKeyword(value) {\n var token = this._lexer.token;\n\n if (token.kind === TokenKind.NAME && token.value === value) {\n this._lexer.advance();\n\n return true;\n }\n\n return false;\n }\n /**\n * Helper function for creating an error when an unexpected lexed token is encountered.\n */\n ;\n\n _proto.unexpected = function unexpected(atToken) {\n var token = atToken !== null && atToken !== void 0 ? atToken : this._lexer.token;\n return syntaxError(this._lexer.source, token.start, \"Unexpected \".concat(getTokenDesc(token), \".\"));\n }\n /**\n * Returns a possibly empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n ;\n\n _proto.any = function any(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n var nodes = [];\n\n while (!this.expectOptionalToken(closeKind)) {\n nodes.push(parseFn.call(this));\n }\n\n return nodes;\n }\n /**\n * Returns a list of parse nodes, determined by the parseFn.\n * It can be empty only if open token is missing otherwise it will always return non-empty list\n * that begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n ;\n\n _proto.optionalMany = function optionalMany(openKind, parseFn, closeKind) {\n if (this.expectOptionalToken(openKind)) {\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n\n return [];\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list begins with a lex token of openKind and ends with a lex token of closeKind.\n * Advances the parser to the next lex token after the closing token.\n */\n ;\n\n _proto.many = function many(openKind, parseFn, closeKind) {\n this.expectToken(openKind);\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (!this.expectOptionalToken(closeKind));\n\n return nodes;\n }\n /**\n * Returns a non-empty list of parse nodes, determined by the parseFn.\n * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind.\n * Advances the parser to the next lex token after last item in the list.\n */\n ;\n\n _proto.delimitedMany = function delimitedMany(delimiterKind, parseFn) {\n this.expectOptionalToken(delimiterKind);\n var nodes = [];\n\n do {\n nodes.push(parseFn.call(this));\n } while (this.expectOptionalToken(delimiterKind));\n\n return nodes;\n };\n\n return Parser;\n}();\n/**\n * A helper function to describe a token as a string for debugging.\n */\n\nfunction getTokenDesc(token) {\n var value = token.value;\n return getTokenKindDesc(token.kind) + (value != null ? \" \\\"\".concat(value, \"\\\"\") : '');\n}\n/**\n * A helper function to describe a token kind as a string for debugging.\n */\n\n\nfunction getTokenKindDesc(kind) {\n return isPunctuatorTokenKind(kind) ? \"\\\"\".concat(kind, \"\\\"\") : kind;\n}\n","import inspect from \"../jsutils/inspect.mjs\";\nimport { isNode } from \"./ast.mjs\";\n/**\n * A visitor is provided to visit, it contains the collection of\n * relevant functions to be called during the visitor's traversal.\n */\n\nexport var QueryDocumentKeys = {\n Name: [],\n Document: ['definitions'],\n OperationDefinition: ['name', 'variableDefinitions', 'directives', 'selectionSet'],\n VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'],\n Variable: ['name'],\n SelectionSet: ['selections'],\n Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'],\n Argument: ['name', 'value'],\n FragmentSpread: ['name', 'directives'],\n InlineFragment: ['typeCondition', 'directives', 'selectionSet'],\n FragmentDefinition: ['name', // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n 'variableDefinitions', 'typeCondition', 'directives', 'selectionSet'],\n IntValue: [],\n FloatValue: [],\n StringValue: [],\n BooleanValue: [],\n NullValue: [],\n EnumValue: [],\n ListValue: ['values'],\n ObjectValue: ['fields'],\n ObjectField: ['name', 'value'],\n Directive: ['name', 'arguments'],\n NamedType: ['name'],\n ListType: ['type'],\n NonNullType: ['type'],\n SchemaDefinition: ['description', 'directives', 'operationTypes'],\n OperationTypeDefinition: ['type'],\n ScalarTypeDefinition: ['description', 'name', 'directives'],\n ObjectTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],\n FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'],\n InputValueDefinition: ['description', 'name', 'type', 'defaultValue', 'directives'],\n InterfaceTypeDefinition: ['description', 'name', 'interfaces', 'directives', 'fields'],\n UnionTypeDefinition: ['description', 'name', 'directives', 'types'],\n EnumTypeDefinition: ['description', 'name', 'directives', 'values'],\n EnumValueDefinition: ['description', 'name', 'directives'],\n InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],\n DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],\n SchemaExtension: ['directives', 'operationTypes'],\n ScalarTypeExtension: ['name', 'directives'],\n ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],\n UnionTypeExtension: ['name', 'directives', 'types'],\n EnumTypeExtension: ['name', 'directives', 'values'],\n InputObjectTypeExtension: ['name', 'directives', 'fields']\n};\nexport var BREAK = Object.freeze({});\n/**\n * visit() will walk through an AST using a depth-first traversal, calling\n * the visitor's enter function at each node in the traversal, and calling the\n * leave function after visiting that node and all of its child nodes.\n *\n * By returning different values from the enter and leave functions, the\n * behavior of the visitor can be altered, including skipping over a sub-tree of\n * the AST (by returning false), editing the AST by returning a value or null\n * to remove the value, or to stop the whole traversal by returning BREAK.\n *\n * When using visit() to edit an AST, the original AST will not be modified, and\n * a new version of the AST with the changes applied will be returned from the\n * visit function.\n *\n * const editedAST = visit(ast, {\n * enter(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: skip visiting this node\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * },\n * leave(node, key, parent, path, ancestors) {\n * // @return\n * // undefined: no action\n * // false: no action\n * // visitor.BREAK: stop visiting altogether\n * // null: delete this node\n * // any value: replace this node with the returned value\n * }\n * });\n *\n * Alternatively to providing enter() and leave() functions, a visitor can\n * instead provide functions named the same as the kinds of AST nodes, or\n * enter/leave visitors at a named key, leading to four permutations of the\n * visitor API:\n *\n * 1) Named visitors triggered when entering a node of a specific kind.\n *\n * visit(ast, {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * })\n *\n * 2) Named visitors that trigger upon entering and leaving a node of\n * a specific kind.\n *\n * visit(ast, {\n * Kind: {\n * enter(node) {\n * // enter the \"Kind\" node\n * }\n * leave(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n *\n * 3) Generic visitors that trigger upon entering and leaving any node.\n *\n * visit(ast, {\n * enter(node) {\n * // enter any node\n * },\n * leave(node) {\n * // leave any node\n * }\n * })\n *\n * 4) Parallel visitors for entering and leaving nodes of a specific kind.\n *\n * visit(ast, {\n * enter: {\n * Kind(node) {\n * // enter the \"Kind\" node\n * }\n * },\n * leave: {\n * Kind(node) {\n * // leave the \"Kind\" node\n * }\n * }\n * })\n */\n\nexport function visit(root, visitor) {\n var visitorKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : QueryDocumentKeys;\n\n /* eslint-disable no-undef-init */\n var stack = undefined;\n var inArray = Array.isArray(root);\n var keys = [root];\n var index = -1;\n var edits = [];\n var node = undefined;\n var key = undefined;\n var parent = undefined;\n var path = [];\n var ancestors = [];\n var newRoot = root;\n /* eslint-enable no-undef-init */\n\n do {\n index++;\n var isLeaving = index === keys.length;\n var isEdited = isLeaving && edits.length !== 0;\n\n if (isLeaving) {\n key = ancestors.length === 0 ? undefined : path[path.length - 1];\n node = parent;\n parent = ancestors.pop();\n\n if (isEdited) {\n if (inArray) {\n node = node.slice();\n } else {\n var clone = {};\n\n for (var _i2 = 0, _Object$keys2 = Object.keys(node); _i2 < _Object$keys2.length; _i2++) {\n var k = _Object$keys2[_i2];\n clone[k] = node[k];\n }\n\n node = clone;\n }\n\n var editOffset = 0;\n\n for (var ii = 0; ii < edits.length; ii++) {\n var editKey = edits[ii][0];\n var editValue = edits[ii][1];\n\n if (inArray) {\n editKey -= editOffset;\n }\n\n if (inArray && editValue === null) {\n node.splice(editKey, 1);\n editOffset++;\n } else {\n node[editKey] = editValue;\n }\n }\n }\n\n index = stack.index;\n keys = stack.keys;\n edits = stack.edits;\n inArray = stack.inArray;\n stack = stack.prev;\n } else {\n key = parent ? inArray ? index : keys[index] : undefined;\n node = parent ? parent[key] : newRoot;\n\n if (node === null || node === undefined) {\n continue;\n }\n\n if (parent) {\n path.push(key);\n }\n }\n\n var result = void 0;\n\n if (!Array.isArray(node)) {\n if (!isNode(node)) {\n throw new Error(\"Invalid AST Node: \".concat(inspect(node), \".\"));\n }\n\n var visitFn = getVisitFn(visitor, node.kind, isLeaving);\n\n if (visitFn) {\n result = visitFn.call(visitor, node, key, parent, path, ancestors);\n\n if (result === BREAK) {\n break;\n }\n\n if (result === false) {\n if (!isLeaving) {\n path.pop();\n continue;\n }\n } else if (result !== undefined) {\n edits.push([key, result]);\n\n if (!isLeaving) {\n if (isNode(result)) {\n node = result;\n } else {\n path.pop();\n continue;\n }\n }\n }\n }\n }\n\n if (result === undefined && isEdited) {\n edits.push([key, node]);\n }\n\n if (isLeaving) {\n path.pop();\n } else {\n var _visitorKeys$node$kin;\n\n stack = {\n inArray: inArray,\n index: index,\n keys: keys,\n edits: edits,\n prev: stack\n };\n inArray = Array.isArray(node);\n keys = inArray ? node : (_visitorKeys$node$kin = visitorKeys[node.kind]) !== null && _visitorKeys$node$kin !== void 0 ? _visitorKeys$node$kin : [];\n index = -1;\n edits = [];\n\n if (parent) {\n ancestors.push(parent);\n }\n\n parent = node;\n }\n } while (stack !== undefined);\n\n if (edits.length !== 0) {\n newRoot = edits[edits.length - 1][1];\n }\n\n return newRoot;\n}\n/**\n * Creates a new visitor instance which delegates to many visitors to run in\n * parallel. Each visitor will be visited for each node before moving on.\n *\n * If a prior visitor edits a node, no following visitors will see that node.\n */\n\nexport function visitInParallel(visitors) {\n var skipping = new Array(visitors.length);\n return {\n enter: function enter(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (skipping[i] == null) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n false);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === false) {\n skipping[i] = node;\n } else if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined) {\n return result;\n }\n }\n }\n }\n },\n leave: function leave(node) {\n for (var i = 0; i < visitors.length; i++) {\n if (skipping[i] == null) {\n var fn = getVisitFn(visitors[i], node.kind,\n /* isLeaving */\n true);\n\n if (fn) {\n var result = fn.apply(visitors[i], arguments);\n\n if (result === BREAK) {\n skipping[i] = BREAK;\n } else if (result !== undefined && result !== false) {\n return result;\n }\n }\n } else if (skipping[i] === node) {\n skipping[i] = null;\n }\n }\n }\n };\n}\n/**\n * Given a visitor instance, if it is leaving or not, and a node kind, return\n * the function the visitor runtime should call.\n */\n\nexport function getVisitFn(visitor, kind, isLeaving) {\n var kindVisitor = visitor[kind];\n\n if (kindVisitor) {\n if (!isLeaving && typeof kindVisitor === 'function') {\n // { Kind() {} }\n return kindVisitor;\n }\n\n var kindSpecificVisitor = isLeaving ? kindVisitor.leave : kindVisitor.enter;\n\n if (typeof kindSpecificVisitor === 'function') {\n // { Kind: { enter() {}, leave() {} } }\n return kindSpecificVisitor;\n }\n } else {\n var specificVisitor = isLeaving ? visitor.leave : visitor.enter;\n\n if (specificVisitor) {\n if (typeof specificVisitor === 'function') {\n // { enter() {}, leave() {} }\n return specificVisitor;\n }\n\n var specificKindVisitor = specificVisitor[kind];\n\n if (typeof specificKindVisitor === 'function') {\n // { enter: { Kind() {} }, leave: { Kind() {} } }\n return specificKindVisitor;\n }\n }\n }\n}\n","import { visit } from \"./visitor.mjs\";\nimport { printBlockString } from \"./blockString.mjs\";\n/**\n * Converts an AST into a string, using one set of reasonable\n * formatting rules.\n */\n\nexport function print(ast) {\n return visit(ast, {\n leave: printDocASTReducer\n });\n}\nvar MAX_LINE_LENGTH = 80; // TODO: provide better type coverage in future\n\nvar printDocASTReducer = {\n Name: function Name(node) {\n return node.value;\n },\n Variable: function Variable(node) {\n return '$' + node.name;\n },\n // Document\n Document: function Document(node) {\n return join(node.definitions, '\\n\\n') + '\\n';\n },\n OperationDefinition: function OperationDefinition(node) {\n var op = node.operation;\n var name = node.name;\n var varDefs = wrap('(', join(node.variableDefinitions, ', '), ')');\n var directives = join(node.directives, ' ');\n var selectionSet = node.selectionSet; // Anonymous queries with no directives or variable definitions can use\n // the query short form.\n\n return !name && !directives && !varDefs && op === 'query' ? selectionSet : join([op, join([name, varDefs]), directives, selectionSet], ' ');\n },\n VariableDefinition: function VariableDefinition(_ref) {\n var variable = _ref.variable,\n type = _ref.type,\n defaultValue = _ref.defaultValue,\n directives = _ref.directives;\n return variable + ': ' + type + wrap(' = ', defaultValue) + wrap(' ', join(directives, ' '));\n },\n SelectionSet: function SelectionSet(_ref2) {\n var selections = _ref2.selections;\n return block(selections);\n },\n Field: function Field(_ref3) {\n var alias = _ref3.alias,\n name = _ref3.name,\n args = _ref3.arguments,\n directives = _ref3.directives,\n selectionSet = _ref3.selectionSet;\n var prefix = wrap('', alias, ': ') + name;\n var argsLine = prefix + wrap('(', join(args, ', '), ')');\n\n if (argsLine.length > MAX_LINE_LENGTH) {\n argsLine = prefix + wrap('(\\n', indent(join(args, '\\n')), '\\n)');\n }\n\n return join([argsLine, join(directives, ' '), selectionSet], ' ');\n },\n Argument: function Argument(_ref4) {\n var name = _ref4.name,\n value = _ref4.value;\n return name + ': ' + value;\n },\n // Fragments\n FragmentSpread: function FragmentSpread(_ref5) {\n var name = _ref5.name,\n directives = _ref5.directives;\n return '...' + name + wrap(' ', join(directives, ' '));\n },\n InlineFragment: function InlineFragment(_ref6) {\n var typeCondition = _ref6.typeCondition,\n directives = _ref6.directives,\n selectionSet = _ref6.selectionSet;\n return join(['...', wrap('on ', typeCondition), join(directives, ' '), selectionSet], ' ');\n },\n FragmentDefinition: function FragmentDefinition(_ref7) {\n var name = _ref7.name,\n typeCondition = _ref7.typeCondition,\n variableDefinitions = _ref7.variableDefinitions,\n directives = _ref7.directives,\n selectionSet = _ref7.selectionSet;\n return (// Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n \"fragment \".concat(name).concat(wrap('(', join(variableDefinitions, ', '), ')'), \" \") + \"on \".concat(typeCondition, \" \").concat(wrap('', join(directives, ' '), ' ')) + selectionSet\n );\n },\n // Value\n IntValue: function IntValue(_ref8) {\n var value = _ref8.value;\n return value;\n },\n FloatValue: function FloatValue(_ref9) {\n var value = _ref9.value;\n return value;\n },\n StringValue: function StringValue(_ref10, key) {\n var value = _ref10.value,\n isBlockString = _ref10.block;\n return isBlockString ? printBlockString(value, key === 'description' ? '' : ' ') : JSON.stringify(value);\n },\n BooleanValue: function BooleanValue(_ref11) {\n var value = _ref11.value;\n return value ? 'true' : 'false';\n },\n NullValue: function NullValue() {\n return 'null';\n },\n EnumValue: function EnumValue(_ref12) {\n var value = _ref12.value;\n return value;\n },\n ListValue: function ListValue(_ref13) {\n var values = _ref13.values;\n return '[' + join(values, ', ') + ']';\n },\n ObjectValue: function ObjectValue(_ref14) {\n var fields = _ref14.fields;\n return '{' + join(fields, ', ') + '}';\n },\n ObjectField: function ObjectField(_ref15) {\n var name = _ref15.name,\n value = _ref15.value;\n return name + ': ' + value;\n },\n // Directive\n Directive: function Directive(_ref16) {\n var name = _ref16.name,\n args = _ref16.arguments;\n return '@' + name + wrap('(', join(args, ', '), ')');\n },\n // Type\n NamedType: function NamedType(_ref17) {\n var name = _ref17.name;\n return name;\n },\n ListType: function ListType(_ref18) {\n var type = _ref18.type;\n return '[' + type + ']';\n },\n NonNullType: function NonNullType(_ref19) {\n var type = _ref19.type;\n return type + '!';\n },\n // Type System Definitions\n SchemaDefinition: addDescription(function (_ref20) {\n var directives = _ref20.directives,\n operationTypes = _ref20.operationTypes;\n return join(['schema', join(directives, ' '), block(operationTypes)], ' ');\n }),\n OperationTypeDefinition: function OperationTypeDefinition(_ref21) {\n var operation = _ref21.operation,\n type = _ref21.type;\n return operation + ': ' + type;\n },\n ScalarTypeDefinition: addDescription(function (_ref22) {\n var name = _ref22.name,\n directives = _ref22.directives;\n return join(['scalar', name, join(directives, ' ')], ' ');\n }),\n ObjectTypeDefinition: addDescription(function (_ref23) {\n var name = _ref23.name,\n interfaces = _ref23.interfaces,\n directives = _ref23.directives,\n fields = _ref23.fields;\n return join(['type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n }),\n FieldDefinition: addDescription(function (_ref24) {\n var name = _ref24.name,\n args = _ref24.arguments,\n type = _ref24.type,\n directives = _ref24.directives;\n return name + (hasMultilineItems(args) ? wrap('(\\n', indent(join(args, '\\n')), '\\n)') : wrap('(', join(args, ', '), ')')) + ': ' + type + wrap(' ', join(directives, ' '));\n }),\n InputValueDefinition: addDescription(function (_ref25) {\n var name = _ref25.name,\n type = _ref25.type,\n defaultValue = _ref25.defaultValue,\n directives = _ref25.directives;\n return join([name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], ' ');\n }),\n InterfaceTypeDefinition: addDescription(function (_ref26) {\n var name = _ref26.name,\n interfaces = _ref26.interfaces,\n directives = _ref26.directives,\n fields = _ref26.fields;\n return join(['interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n }),\n UnionTypeDefinition: addDescription(function (_ref27) {\n var name = _ref27.name,\n directives = _ref27.directives,\n types = _ref27.types;\n return join(['union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');\n }),\n EnumTypeDefinition: addDescription(function (_ref28) {\n var name = _ref28.name,\n directives = _ref28.directives,\n values = _ref28.values;\n return join(['enum', name, join(directives, ' '), block(values)], ' ');\n }),\n EnumValueDefinition: addDescription(function (_ref29) {\n var name = _ref29.name,\n directives = _ref29.directives;\n return join([name, join(directives, ' ')], ' ');\n }),\n InputObjectTypeDefinition: addDescription(function (_ref30) {\n var name = _ref30.name,\n directives = _ref30.directives,\n fields = _ref30.fields;\n return join(['input', name, join(directives, ' '), block(fields)], ' ');\n }),\n DirectiveDefinition: addDescription(function (_ref31) {\n var name = _ref31.name,\n args = _ref31.arguments,\n repeatable = _ref31.repeatable,\n locations = _ref31.locations;\n return 'directive @' + name + (hasMultilineItems(args) ? wrap('(\\n', indent(join(args, '\\n')), '\\n)') : wrap('(', join(args, ', '), ')')) + (repeatable ? ' repeatable' : '') + ' on ' + join(locations, ' | ');\n }),\n SchemaExtension: function SchemaExtension(_ref32) {\n var directives = _ref32.directives,\n operationTypes = _ref32.operationTypes;\n return join(['extend schema', join(directives, ' '), block(operationTypes)], ' ');\n },\n ScalarTypeExtension: function ScalarTypeExtension(_ref33) {\n var name = _ref33.name,\n directives = _ref33.directives;\n return join(['extend scalar', name, join(directives, ' ')], ' ');\n },\n ObjectTypeExtension: function ObjectTypeExtension(_ref34) {\n var name = _ref34.name,\n interfaces = _ref34.interfaces,\n directives = _ref34.directives,\n fields = _ref34.fields;\n return join(['extend type', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n },\n InterfaceTypeExtension: function InterfaceTypeExtension(_ref35) {\n var name = _ref35.name,\n interfaces = _ref35.interfaces,\n directives = _ref35.directives,\n fields = _ref35.fields;\n return join(['extend interface', name, wrap('implements ', join(interfaces, ' & ')), join(directives, ' '), block(fields)], ' ');\n },\n UnionTypeExtension: function UnionTypeExtension(_ref36) {\n var name = _ref36.name,\n directives = _ref36.directives,\n types = _ref36.types;\n return join(['extend union', name, join(directives, ' '), types && types.length !== 0 ? '= ' + join(types, ' | ') : ''], ' ');\n },\n EnumTypeExtension: function EnumTypeExtension(_ref37) {\n var name = _ref37.name,\n directives = _ref37.directives,\n values = _ref37.values;\n return join(['extend enum', name, join(directives, ' '), block(values)], ' ');\n },\n InputObjectTypeExtension: function InputObjectTypeExtension(_ref38) {\n var name = _ref38.name,\n directives = _ref38.directives,\n fields = _ref38.fields;\n return join(['extend input', name, join(directives, ' '), block(fields)], ' ');\n }\n};\n\nfunction addDescription(cb) {\n return function (node) {\n return join([node.description, cb(node)], '\\n');\n };\n}\n/**\n * Given maybeArray, print an empty string if it is null or empty, otherwise\n * print all items together separated by separator if provided\n */\n\n\nfunction join(maybeArray) {\n var _maybeArray$filter$jo;\n\n var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n return (_maybeArray$filter$jo = maybeArray === null || maybeArray === void 0 ? void 0 : maybeArray.filter(function (x) {\n return x;\n }).join(separator)) !== null && _maybeArray$filter$jo !== void 0 ? _maybeArray$filter$jo : '';\n}\n/**\n * Given array, print each item on its own line, wrapped in an\n * indented \"{ }\" block.\n */\n\n\nfunction block(array) {\n return wrap('{\\n', indent(join(array, '\\n')), '\\n}');\n}\n/**\n * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string.\n */\n\n\nfunction wrap(start, maybeString) {\n var end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';\n return maybeString != null && maybeString !== '' ? start + maybeString + end : '';\n}\n\nfunction indent(str) {\n return wrap(' ', str.replace(/\\n/g, '\\n '));\n}\n\nfunction isMultiline(str) {\n return str.indexOf('\\n') !== -1;\n}\n\nfunction hasMultilineItems(maybeArray) {\n return maybeArray != null && maybeArray.some(isMultiline);\n}\n",null,null,null,null,null,null,null,null,null,null,"import { AmplifyError } from './AmplifyError.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Error class for errors that associated with unsuccessful HTTP responses.\n * It's throw by API category REST API handlers and GraphQL query handlers for now.\n */\nclass ApiError extends AmplifyError {\n /**\n * The unwrapped HTTP response causing the given API error.\n */\n get response() {\n return this._response\n ? replicateApiErrorResponse(this._response)\n : undefined;\n }\n constructor(params) {\n super(params);\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = ApiError;\n Object.setPrototypeOf(this, ApiError.prototype);\n if (params.response) {\n this._response = params.response;\n }\n }\n}\nconst replicateApiErrorResponse = (response) => ({\n ...response,\n headers: { ...response.headers },\n});\n\nexport { ApiError };\n//# sourceMappingURL=APIError.mjs.map\n","import { ApiError } from '@aws-amplify/core/internals/utils';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nclass RestApiError extends ApiError {\n constructor(params) {\n super(params);\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = RestApiError;\n Object.setPrototypeOf(this, RestApiError.prototype);\n }\n}\n\nexport { RestApiError };\n//# sourceMappingURL=RestApiError.mjs.map\n","import { RestApiError } from './RestApiError.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Internal-only class for CanceledError.\n *\n * @internal\n */\nclass CanceledError extends RestApiError {\n constructor(params = {}) {\n super({\n name: 'CanceledError',\n message: 'Request is canceled by user',\n ...params,\n });\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = CanceledError;\n Object.setPrototypeOf(this, CanceledError.prototype);\n }\n}\n/**\n * Check if an error is caused by user calling `cancel()` in REST API.\n *\n * @note This function works **ONLY** for errors thrown by REST API. For GraphQL APIs, use `client.isCancelError(error)`\n * instead. `client` is generated from `generateClient()` API from `aws-amplify/api`.\n *\n * @param {unknown} error The unknown exception to be checked.\n * @returns - A boolean indicating if the error was from an upload cancellation\n */\nconst isCancelError = (error) => !!error && error instanceof CanceledError;\n\nexport { CanceledError, isCancelError };\n//# sourceMappingURL=CanceledError.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar RestApiValidationErrorCode;\n(function (RestApiValidationErrorCode) {\n RestApiValidationErrorCode[\"InvalidApiName\"] = \"InvalidApiName\";\n})(RestApiValidationErrorCode || (RestApiValidationErrorCode = {}));\nconst validationErrorMap = {\n [RestApiValidationErrorCode.InvalidApiName]: {\n message: 'API name is invalid.',\n recoverySuggestion: 'Check if the API name matches the one in your configuration or `aws-exports.js`',\n },\n};\n\nexport { RestApiValidationErrorCode, validationErrorMap };\n//# sourceMappingURL=validation.mjs.map\n","import { parseJsonError } from '@aws-amplify/core/internals/aws-client-utils';\nimport { RestApiError } from '../errors/RestApiError.mjs';\nimport '../errors/validation.mjs';\n\n/**\n * Parses both AWS and non-AWS error responses coming from the users' backend code.\n * * AWS errors generated by the AWS services(e.g. API Gateway, Bedrock). They can be Signature errors,\n * ClockSkew errors, etc. These responses will be parsed to errors with proper name and message from the AWS\n * services.\n * * non-AWS errors thrown by the user code. They can contain any headers or body. Users need to access the\n * error.response to get the headers and body and parse them accordingly. The JS error name and message will\n * be `UnknownError` and `Unknown error` respectively.\n */\nconst parseRestApiServiceError = async (response) => {\n if (!response) {\n // Response is not considered an error.\n return;\n }\n const parsedAwsError = await parseJsonError(stubErrorResponse(response));\n if (!parsedAwsError) ;\n else {\n const bodyText = await response.body?.text();\n return buildRestApiError(parsedAwsError, {\n statusCode: response.statusCode,\n headers: response.headers,\n body: bodyText,\n });\n }\n};\n/**\n * The response object needs to be stub here because the parseAwsJsonError assumes the response body to be valid JSON.\n * Although this is true for AWS services, it is not true for responses from user's code. Once the response body is\n * unwrapped as JSON(and fail), it cannot be read as text again. Therefore, we need to stub the response body here to\n * make sure we can read the error response body as a JSON, and may fall back to read as text if it is not a valid JSON.\n */\nconst stubErrorResponse = (response) => {\n let bodyTextPromise;\n const bodyProxy = new Proxy(response.body, {\n get(target, prop, receiver) {\n if (prop === 'json') {\n // For potential AWS errors, error parser will try to parse the body as JSON first.\n return async () => {\n if (!bodyTextPromise) {\n bodyTextPromise = target.text();\n }\n try {\n return JSON.parse(await bodyTextPromise);\n }\n catch (error) {\n // If response body is not a valid JSON, we stub it to be an empty object and eventually parsed\n // as an unknown error\n return {};\n }\n };\n }\n else if (prop === 'text') {\n // For non-AWS errors, users can access the body as a string as a fallback.\n return async () => {\n if (!bodyTextPromise) {\n bodyTextPromise = target.text();\n }\n return bodyTextPromise;\n };\n }\n else {\n return Reflect.get(target, prop, receiver);\n }\n },\n });\n const responseProxy = new Proxy(response, {\n get(target, prop, receiver) {\n if (prop === 'body') {\n return bodyProxy;\n }\n else {\n return Reflect.get(target, prop, receiver);\n }\n },\n });\n return responseProxy;\n};\n/**\n * Utility to create a new RestApiError from a service error.\n */\nconst buildRestApiError = (error, response) => {\n const restApiError = new RestApiError({\n name: error?.name,\n message: error.message,\n underlyingError: error,\n response,\n });\n // $metadata is only required for backwards compatibility.\n return Object.assign(restApiError, { $metadata: error.$metadata });\n};\n\nexport { parseRestApiServiceError };\n//# sourceMappingURL=serviceError.mjs.map\n","import { ConsoleLogger } from '@aws-amplify/core';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst logger = new ConsoleLogger('RestApis');\n\nexport { logger };\n//# sourceMappingURL=logger.mjs.map\n","import { CanceledError } from '../errors/CanceledError.mjs';\nimport '@aws-amplify/core/internals/utils';\nimport '../errors/validation.mjs';\nimport { parseRestApiServiceError } from './serviceError.mjs';\nimport { logger } from './logger.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @internal\n */\nfunction createCancellableOperation(handler, abortController) {\n const isInternalPost = (targetHandler) => !!abortController;\n // For creating a cancellable operation for public REST APIs, we need to create an AbortController\n // internally. Whereas for internal POST APIs, we need to accept in the AbortController from the\n // callers.\n const publicApisAbortController = new AbortController();\n const publicApisAbortSignal = publicApisAbortController.signal;\n const internalPostAbortSignal = abortController?.signal;\n let abortReason;\n const job = async () => {\n try {\n const response = await (isInternalPost(handler)\n ? handler()\n : handler(publicApisAbortSignal));\n if (response.statusCode >= 300) {\n throw await parseRestApiServiceError(response);\n }\n return response;\n }\n catch (error) {\n const abortSignal = internalPostAbortSignal ?? publicApisAbortSignal;\n const message = abortReason ?? abortSignal.reason;\n if (error.name === 'AbortError' || abortSignal?.aborted === true) {\n const canceledError = new CanceledError({\n ...(message && { message }),\n underlyingError: error,\n recoverySuggestion: 'The API request was explicitly canceled. If this is not intended, validate if you called the `cancel()` function on the API request erroneously.',\n });\n logger.debug(error);\n throw canceledError;\n }\n logger.debug(error);\n throw error;\n }\n };\n if (isInternalPost()) {\n return job();\n }\n else {\n const cancel = (abortMessage) => {\n if (publicApisAbortSignal.aborted === true) {\n return;\n }\n publicApisAbortController.abort(abortMessage);\n // If abort reason is not supported, set a scoped reasons instead. The reason property inside an\n // AbortSignal is a readonly property and trying to set it would throw an error.\n if (abortMessage && publicApisAbortSignal.reason !== abortMessage) {\n abortReason = abortMessage;\n }\n };\n return { response: job(), cancel };\n }\n}\n\nexport { createCancellableOperation };\n//# sourceMappingURL=createCancellableOperation.mjs.map\n","import { RestApiError } from './RestApiError.mjs';\nimport { validationErrorMap } from './validation.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @internal\n */\nfunction assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validationErrorMap[name];\n if (!assertion) {\n throw new RestApiError({ name, message, recoverySuggestion });\n }\n}\n\nexport { assertValidationError };\n//# sourceMappingURL=assertValidatonError.mjs.map\n","import { AmplifyUrl, AmplifyUrlSearchParams } from '@aws-amplify/core/internals/utils';\nimport { RestApiError } from '../errors/RestApiError.mjs';\nimport { assertValidationError } from '../errors/assertValidatonError.mjs';\nimport { RestApiValidationErrorCode, validationErrorMap } from '../errors/validation.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Resolve the REST API request URL by:\n * 1. Loading the REST API endpoint from the Amplify configuration with corresponding API name.\n * 2. Appending the path to the endpoint.\n * 3. Merge the query parameters from path and the queryParameter argument which is taken from the public REST API\n * options.\n * 4. Validating the resulting URL string.\n *\n * @internal\n */\nconst resolveApiUrl = (amplify, apiName, path, queryParams) => {\n const urlStr = amplify.getConfig()?.API?.REST?.[apiName]?.endpoint;\n assertValidationError(!!urlStr, RestApiValidationErrorCode.InvalidApiName);\n try {\n const url = new AmplifyUrl(urlStr + path);\n if (queryParams) {\n const mergedQueryParams = new AmplifyUrlSearchParams(url.searchParams);\n Object.entries(queryParams).forEach(([key, value]) => {\n mergedQueryParams.set(key, value);\n });\n url.search = new AmplifyUrlSearchParams(mergedQueryParams).toString();\n }\n return url;\n }\n catch (error) {\n throw new RestApiError({\n name: RestApiValidationErrorCode.InvalidApiName,\n ...validationErrorMap[RestApiValidationErrorCode.InvalidApiName],\n recoverySuggestion: `Please make sure the REST endpoint URL is a valid URL string. Got ${urlStr}`,\n });\n }\n};\n\nexport { resolveApiUrl };\n//# sourceMappingURL=resolveApiUrl.mjs.map\n","import { retryMiddlewareFactory } from '../middleware/retry/middleware.mjs';\nimport '../../types/errors.mjs';\nimport '../../errors/errorHelpers.mjs';\nimport '../../utils/getClientInfo/getClientInfo.mjs';\nimport '../../utils/retry/retry.mjs';\nimport { signingMiddlewareFactory } from '../middleware/signing/middleware.mjs';\nimport { userAgentMiddlewareFactory } from '../middleware/userAgent/middleware.mjs';\nimport { composeTransferHandler } from '../internal/composeTransferHandler.mjs';\nimport { fetchTransferHandler } from './fetch.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst authenticatedHandler = composeTransferHandler(fetchTransferHandler, [\n userAgentMiddlewareFactory,\n retryMiddlewareFactory,\n signingMiddlewareFactory,\n]);\n\nexport { authenticatedHandler };\n//# sourceMappingURL=authenticated.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst DEFAULT_REST_IAM_SIGNING_SERVICE = 'execute-api';\nconst DEFAULT_APPSYNC_API_SERVICE = 'appsync-api';\nconst DEFAULT_IAM_SIGNING_REGION = 'us-east-1';\n/**\n * The REST endpoints generated by API Gateway\n * @see {@link https://docs.aws.amazon.com/general/latest/gr/apigateway.html#apigateway_region_data_plane}\n */\nconst APIG_HOSTNAME_PATTERN = /^.+\\.([a-z0-9-]+)\\.([a-z0-9-]+)\\.amazonaws\\.com/;\n\nexport { APIG_HOSTNAME_PATTERN, DEFAULT_APPSYNC_API_SERVICE, DEFAULT_IAM_SIGNING_REGION, DEFAULT_REST_IAM_SIGNING_SERVICE };\n//# sourceMappingURL=constants.mjs.map\n","import { DEFAULT_REST_IAM_SIGNING_SERVICE, DEFAULT_IAM_SIGNING_REGION, APIG_HOSTNAME_PATTERN } from './constants.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Infer the signing service and region from the given URL, and for REST API only, from the Amplify configuration.\n * It supports raw API Gateway endpoint and AppSync endpoint.\n *\n * @internal\n */\nconst parseSigningInfo = (url, restApiOptions) => {\n const { service: signingService = DEFAULT_REST_IAM_SIGNING_SERVICE, region: signingRegion = DEFAULT_IAM_SIGNING_REGION, } = restApiOptions?.amplify.getConfig()?.API?.REST?.[restApiOptions?.apiName] ??\n {};\n const { hostname } = url;\n const [, service, region] = APIG_HOSTNAME_PATTERN.exec(hostname) ?? [];\n if (service === DEFAULT_REST_IAM_SIGNING_SERVICE) {\n // The configured endpoint is an API Gateway endpoint\n // @see: https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-call-api.html\n return {\n service,\n region: region ?? signingRegion,\n };\n }\n else if (service === 'appsync-api') {\n // AppSync endpoint is internally supported because GraphQL operation will send request using POST handler.\n // example: https://xxxx.appsync-api.us-east-1.amazonaws.com/graphql\n return {\n service: 'appsync',\n region: region ?? signingRegion,\n };\n }\n else {\n return {\n service: signingService,\n region: signingRegion,\n };\n }\n};\n\nexport { parseSigningInfo };\n//# sourceMappingURL=parseSigningInfo.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst resolveHeaders = (headers, body) => {\n const normalizedHeaders = {};\n for (const key in headers) {\n normalizedHeaders[key.toLowerCase()] = headers[key];\n }\n if (body) {\n normalizedHeaders['content-type'] = 'application/json; charset=UTF-8';\n if (body instanceof FormData) {\n /**\n * If body is a FormData we should not allow setting content-type.\n * It's because runtime HTTP handlers(xhr, fetch, undici, node-fetch,\n * etc.) will modify the content-type value when setting multipart\n * boundary.\n */\n delete normalizedHeaders['content-type'];\n }\n }\n return normalizedHeaders;\n};\n\nexport { resolveHeaders };\n//# sourceMappingURL=resolveHeaders.mjs.map\n","import { getRetryDecider, jitteredBackoff, authenticatedHandler, unauthenticatedHandler } from '@aws-amplify/core/internals/aws-client-utils';\nimport '@aws-amplify/core/internals/utils';\nimport '../../errors/validation.mjs';\nimport { parseRestApiServiceError } from '../../utils/serviceError.mjs';\nimport { logger } from '../../utils/logger.mjs';\nimport { parseSigningInfo } from '../../utils/parseSigningInfo.mjs';\nimport { resolveHeaders } from '../../utils/resolveHeaders.mjs';\n\n/**\n * Make REST API call with best-effort IAM auth.\n * @param amplify Amplify instance to to resolve credentials and tokens. Should use different instance in client-side\n * and SSR\n * @param options Options accepted from public API options when calling the handlers.\n * @param signingServiceInfo Internal-only options enable IAM auth as well as to to overwrite the IAM signing service\n * and region. If specified, and NONE of API Key header or Auth header is present, IAM auth will be used.\n * @param iamAuthApplicable Callback function that is used to determine if IAM Auth should be used or not.\n *\n * @internal\n */\nconst transferHandler = async (amplify, options, iamAuthApplicable, signingServiceInfo) => {\n const { url, method, headers, body, withCredentials, abortSignal } = options;\n const resolvedBody = body\n ? body instanceof FormData\n ? body\n : JSON.stringify(body ?? '')\n : undefined;\n const resolvedHeaders = resolveHeaders(headers, body);\n const request = {\n url,\n headers: resolvedHeaders,\n method,\n body: resolvedBody,\n };\n const baseOptions = {\n retryDecider: getRetryDecider(parseRestApiServiceError),\n computeDelay: jitteredBackoff,\n withCrossDomainCredentials: withCredentials,\n abortSignal,\n };\n const isIamAuthApplicable = iamAuthApplicable(request, signingServiceInfo);\n let response;\n const credentials = await resolveCredentials(amplify);\n if (isIamAuthApplicable && credentials) {\n const signingInfoFromUrl = parseSigningInfo(url);\n const signingService = signingServiceInfo?.service ?? signingInfoFromUrl.service;\n const signingRegion = signingServiceInfo?.region ?? signingInfoFromUrl.region;\n response = await authenticatedHandler(request, {\n ...baseOptions,\n credentials,\n region: signingRegion,\n service: signingService,\n });\n }\n else {\n response = await unauthenticatedHandler(request, {\n ...baseOptions,\n });\n }\n // Clean-up un-modeled properties from response.\n return {\n statusCode: response.statusCode,\n headers: response.headers,\n body: response.body,\n };\n};\nconst resolveCredentials = async (amplify) => {\n try {\n const { credentials } = await amplify.Auth.fetchAuthSession();\n if (credentials) {\n return credentials;\n }\n }\n catch (e) {\n logger.debug('No credentials available, the request will be unsigned.');\n }\n return null;\n};\n\nexport { transferHandler };\n//# sourceMappingURL=handler.mjs.map\n","import { createCancellableOperation } from '../../utils/createCancellableOperation.mjs';\nimport { parseSigningInfo } from '../../utils/parseSigningInfo.mjs';\nimport '@aws-amplify/core/internals/aws-client-utils';\nimport '@aws-amplify/core/internals/utils';\nimport '../../errors/validation.mjs';\nimport { resolveApiUrl } from '../../utils/resolveApiUrl.mjs';\nimport { logger } from '../../utils/logger.mjs';\nimport { isIamAuthApplicableForRest } from '../../utils/isIamAuthApplicable.mjs';\nimport { transferHandler } from './handler.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst publicHandler = (amplify, options, method) => createCancellableOperation(async (abortSignal) => {\n const { apiName, options: apiOptions = {}, path: apiPath } = options;\n const url = resolveApiUrl(amplify, apiName, apiPath, apiOptions?.queryParams);\n const libraryConfigHeaders = await amplify.libraryOptions?.API?.REST?.headers?.({\n apiName,\n });\n const { headers: invocationHeaders = {} } = apiOptions;\n const headers = {\n // custom headers from invocation options should precede library options\n ...libraryConfigHeaders,\n ...invocationHeaders,\n };\n const signingServiceInfo = parseSigningInfo(url, {\n amplify,\n apiName,\n });\n logger.debug(method, url, headers, `IAM signing options: ${JSON.stringify(signingServiceInfo)}`);\n return transferHandler(amplify, {\n ...apiOptions,\n url,\n method,\n headers,\n abortSignal,\n }, isIamAuthApplicableForRest, signingServiceInfo);\n});\nconst get = (amplify, input) => publicHandler(amplify, input, 'GET');\nconst post = (amplify, input) => publicHandler(amplify, input, 'POST');\nconst put = (amplify, input) => publicHandler(amplify, input, 'PUT');\nconst del = (amplify, input) => publicHandler(amplify, input, 'DELETE');\nconst head = (amplify, input) => publicHandler(amplify, input, 'HEAD');\nconst patch = (amplify, input) => publicHandler(amplify, input, 'PATCH');\n\nexport { del, get, head, patch, post, put };\n//# sourceMappingURL=publicApis.mjs.map\n","import { Amplify } from '@aws-amplify/core';\nimport { get as get$1, post as post$1, put as put$1, del as del$1, head as head$1, patch as patch$1 } from './common/publicApis.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * GET HTTP request\n * @param {GetInput} input - Input for GET operation\n * @returns {GetOperation} Operation for GET request\n * @throws - {@link RestApiError}\n * @example\n * Send a GET request\n * ```js\n * import { get, isCancelError } from '@aws-amplify/api';\n *\n * const { body } = await get({\n * apiName,\n * path,\n * options: {\n * headers, // Optional, A map of custom header key/values\n * body, // Optional, JSON object or FormData\n * queryParams, // Optional, A map of query strings\n * }\n * }).response;\n * const data = await body.json();\n * ```\n * @example\n * Cancel a GET request\n *\n * ```js\n * import { get, isCancelError } from '@aws-amplify/api';\n *\n * const { response, cancel } = get({apiName, path, options});\n * cancel(message);\n * try {\n * await response;\n * } catch (e) {\n * if (isCancelError(e)) {\n * // handle request cancellation\n * }\n * //...\n * }\n * ```\n */\nconst get = (input) => get$1(Amplify, input);\n/**\n * POST HTTP request\n * @param {PostInput} input - Input for POST operation\n * @returns {PostOperation} Operation for POST request\n * @throws - {@link RestApiError}\n * @example\n * Send a POST request\n * ```js\n * import { post, isCancelError } from '@aws-amplify/api';\n *\n * const { body } = await post({\n * apiName,\n * path,\n * options: {\n * headers, // Optional, A map of custom header key/values\n * body, // Optional, JSON object or FormData\n * queryParams, // Optional, A map of query strings\n * }\n * }).response;\n * const data = await body.json();\n * ```\n * @example\n * Cancel a POST request\n *\n * ```js\n * import { post, isCancelError } from '@aws-amplify/api';\n *\n * const { response, cancel } = post({apiName, path, options});\n * cancel(message);\n * try {\n * await response;\n * } catch (e) {\n * if (isCancelError(e)) {\n * // handle request cancellation\n * }\n * //...\n * }\n * ```\n */\nconst post = (input) => post$1(Amplify, input);\n/**\n * PUT HTTP request\n * @param {PutInput} input - Input for PUT operation\n * @returns {PutOperation} Operation for PUT request\n * @throws - {@link RestApiError}\n * @example\n * Send a PUT request\n * ```js\n * import { put, isCancelError } from '@aws-amplify/api';\n *\n * const { body } = await put({\n * apiName,\n * path,\n * options: {\n * headers, // Optional, A map of custom header key/values\n * body, // Optional, JSON object or FormData\n * queryParams, // Optional, A map of query strings\n * }\n * }).response;\n * const data = await body.json();\n * ```\n * @example\n * Cancel a PUT request\n * ```js\n * import { put, isCancelError } from '@aws-amplify/api';\n *\n * const { response, cancel } = put({apiName, path, options});\n * cancel(message);\n * try {\n * await response;\n * } catch (e) {\n * if (isCancelError(e)) {\n * // handle request cancellation\n * }\n * //...\n * }\n * ```\n */\nconst put = (input) => put$1(Amplify, input);\n/**\n * DELETE HTTP request\n * @param {DeleteInput} input - Input for DELETE operation\n * @returns {DeleteOperation} Operation for DELETE request\n * @throws - {@link RestApiError}\n * @example\n * Send a DELETE request\n * ```js\n * import { del } from '@aws-amplify/api';\n *\n * const { statusCode } = await del({\n * apiName,\n * path,\n * options: {\n * headers, // Optional, A map of custom header key/values\n * queryParams, // Optional, A map of query strings\n * }\n * }).response;\n * ```\n */\nconst del = (input) => del$1(Amplify, input);\n/**\n * HEAD HTTP request\n * @param {HeadInput} input - Input for HEAD operation\n * @returns {HeadOperation} Operation for HEAD request\n * @throws - {@link RestApiError}\n * @example\n * Send a HEAD request\n * ```js\n * import { head, isCancelError } from '@aws-amplify/api';\n *\n * const { headers, statusCode } = await head({\n * apiName,\n * path,\n * options: {\n * headers, // Optional, A map of custom header key/values\n * queryParams, // Optional, A map of query strings\n * }\n * }),response;\n * ```\n *\n */\nconst head = (input) => head$1(Amplify, input);\n/**\n * PATCH HTTP request\n * @param {PatchInput} input - Input for PATCH operation\n * @returns {PatchOperation} Operation for PATCH request\n * @throws - {@link RestApiError}\n * @example\n * Send a PATCH request\n * ```js\n * import { patch } from '@aws-amplify/api';\n *\n * const { body } = await patch({\n * apiName,\n * path,\n * options: {\n * headers, // Optional, A map of custom header key/values\n * body, // Optional, JSON object or FormData\n * queryParams, // Optional, A map of query strings\n * }\n * }).response;\n * const data = await body.json();\n * ```\n *\n * @example\n * Cancel a PATCH request\n * ```js\n * import { patch, isCancelError } from '@aws-amplify/api';\n *\n * const { response, cancel } = patch({apiName, path, options});\n * cancel(message);\n * try {\n * await response;\n * } catch (e) {\n * if (isCancelError(e)) {\n * // handle request cancellation\n * }\n * //...\n * }\n * ```\n */\nconst patch = (input) => patch$1(Amplify, input);\n\nexport { del, get, head, patch, post, put };\n//# sourceMappingURL=index.mjs.map\n","export { isCancelError } from './errors/CanceledError.mjs';\nexport { del, get, head, patch, post, put } from './apis/index.mjs';\n//# sourceMappingURL=index.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Determines if IAM authentication should be applied for a GraphQL request.\n *\n * This function checks the `headers` of the HTTP request to determine if IAM authentication\n * is applicable. IAM authentication is considered applicable if there is no `authorization`\n * header, no `x-api-key` header, and `signingServiceInfo` is provided.\n *\n * @param request - The HTTP request object containing headers.\n * @param signingServiceInfo - Optional signing service information,\n * including service and region.\n * @returns A boolean `true` if IAM authentication should be applied.\n *\n * @internal\n */\nconst isIamAuthApplicableForGraphQL = ({ headers }, signingServiceInfo) => !headers.authorization && !headers['x-api-key'] && !!signingServiceInfo;\n/**\n * Determines if IAM authentication should be applied for a REST request.\n *\n * This function checks the `headers` of the HTTP request to determine if IAM authentication\n * is applicable. IAM authentication is considered applicable if there is no `authorization`\n * header and `signingServiceInfo` is provided.\n *\n * @param request - The HTTP request object containing headers.\n * @param signingServiceInfo - Optional signing service information,\n * including service and region.\n * @returns A boolean `true` if IAM authentication should be applied.\n *\n * @internal\n */\nconst isIamAuthApplicableForRest = ({ headers }, signingServiceInfo) => !headers.authorization && !!signingServiceInfo;\n\nexport { isIamAuthApplicableForGraphQL, isIamAuthApplicableForRest };\n//# sourceMappingURL=isIamAuthApplicable.mjs.map\n","import { createCancellableOperation } from '../../utils/createCancellableOperation.mjs';\nimport '@aws-amplify/core/internals/aws-client-utils';\nimport '@aws-amplify/core/internals/utils';\nimport '../../errors/validation.mjs';\nimport '../../utils/logger.mjs';\nimport { isIamAuthApplicableForGraphQL } from '../../utils/isIamAuthApplicable.mjs';\nimport { transferHandler } from './handler.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * This weak map provides functionality to cancel a request given the promise containing the `post` request.\n *\n * 1. For every GraphQL POST request, an abort controller is created and supplied to the request.\n * 2. The promise fulfilled by GraphGL POST request is then mapped to that abort controller.\n * 3. The promise is returned to the external caller.\n * 4. The caller can either wait for the promise to fulfill or call `cancel(promise)` to cancel the request.\n * 5. If `cancel(promise)` is called, then the corresponding abort controller is retrieved from the map below.\n * 6. GraphQL POST request will be rejected with the error message provided during cancel.\n * 7. Caller can check if the error is because of cancelling by calling `isCancelError(error)`.\n */\nconst cancelTokenMap = new WeakMap();\n/**\n * @internal\n *\n * REST POST handler to send GraphQL request to given endpoint. By default, it will use IAM to authorize\n * the request. In some auth modes, the IAM auth has to be disabled. Here's how to set up the request auth correctly:\n * * If auth mode is 'iam', you MUST NOT set 'authorization' header and 'x-api-key' header, since it would disable IAM\n * auth. You MUST also set 'input.options.signingServiceInfo' option.\n * * The including 'input.options.signingServiceInfo.service' and 'input.options.signingServiceInfo.region' are\n * optional. If omitted, the signing service and region will be inferred from url.\n * * If auth mode is 'none', you MUST NOT set 'options.signingServiceInfo' option.\n * * If auth mode is 'apiKey', you MUST set 'x-api-key' custom header.\n * * If auth mode is 'oidc' or 'lambda' or 'userPool', you MUST set 'authorization' header.\n *\n * To make the internal post cancellable, you must also call `updateRequestToBeCancellable()` with the promise from\n * internal post call and the abort controller supplied to the internal post call.\n *\n * @param amplify the AmplifyClassV6 instance - it may be the singleton used on Web, or an instance created within\n * a context created by `runWithAmplifyServerContext`\n * @param postInput an object of {@link InternalPostInput}\n * @param postInput.url The URL that the POST request sends to\n * @param postInput.options Options of the POST request\n * @param postInput.abortController The abort controller used to cancel the POST request\n * @returns a {@link RestApiResponse}\n *\n * @throws an {@link AmplifyError} with `Network Error` as the `message` when the external resource is unreachable due to one\n * of the following reasons:\n * 1. no network connection\n * 2. CORS error\n * @throws a {@link CanceledError} when the ongoing POST request get cancelled\n */\nconst post = (amplify, { url, options, abortController }) => {\n const controller = abortController ?? new AbortController();\n const responsePromise = createCancellableOperation(async () => {\n const response = transferHandler(amplify, {\n url,\n method: 'POST',\n ...options,\n abortSignal: controller.signal,\n }, isIamAuthApplicableForGraphQL, options?.signingServiceInfo);\n return response;\n }, controller);\n const responseWithCleanUp = responsePromise.finally(() => {\n cancelTokenMap.delete(responseWithCleanUp);\n });\n return responseWithCleanUp;\n};\n/**\n * Cancels a request given the promise returned by `post`.\n * If the request is already completed, this function does nothing.\n * It MUST be used after `updateRequestToBeCancellable` is called.\n */\nconst cancel = (promise, message) => {\n const controller = cancelTokenMap.get(promise);\n if (controller) {\n controller.abort(message);\n if (message && controller.signal.reason !== message) {\n // In runtimes where `AbortSignal.reason` is not supported, we track the reason ourselves.\n // @ts-expect-error reason is read-only property.\n controller.signal.reason = message;\n }\n return true;\n }\n return false;\n};\n/**\n * MUST be used to make a promise including internal `post` API call cancellable.\n */\nconst updateRequestToBeCancellable = (promise, controller) => {\n cancelTokenMap.set(promise, controller);\n};\n\nexport { cancel, post, updateRequestToBeCancellable };\n//# sourceMappingURL=internalPost.mjs.map\n","export { cancel, post, updateRequestToBeCancellable } from '../apis/common/internalPost.mjs';\n//# sourceMappingURL=index.mjs.map\n","export { AMPLIFY_SYMBOL } from '@aws-amplify/core/internals/utils';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst MAX_DELAY_MS = 5000;\nconst NON_RETRYABLE_CODES = [400, 401, 403];\nconst NON_RETRYABLE_ERROR_TYPES = [\n 'BadRequestException',\n 'UnauthorizedException',\n];\nconst CONNECTION_STATE_CHANGE = 'ConnectionStateChange';\nvar MESSAGE_TYPES;\n(function (MESSAGE_TYPES) {\n /**\n * Client -> Server message.\n * This message type is the first message after handshake and this will initialize AWS AppSync RealTime communication\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_INIT\"] = \"connection_init\";\n /**\n * Server -> Client message\n * This message type is in case there is an issue with AWS AppSync RealTime when establishing connection\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_ERROR\"] = \"connection_error\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_CONNECTION_INIT message\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_ACK\"] = \"connection_ack\";\n /**\n * Client -> Server message.\n * This message type is for register subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_START\"] = \"start\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_START message\n */\n MESSAGE_TYPES[\"GQL_START_ACK\"] = \"start_ack\";\n /**\n * Server -> Client message.\n * This message type is for subscription message from AWS AppSync RealTime or Events\n */\n MESSAGE_TYPES[\"DATA\"] = \"data\";\n /**\n * Server -> Client message.\n * This message type helps the client to know is still receiving messages from AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_CONNECTION_KEEP_ALIVE\"] = \"ka\";\n /**\n * Client -> Server message.\n * This message type is for unregister subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"GQL_STOP\"] = \"stop\";\n /**\n * Server -> Client message.\n * This message type is for the ack response from AWS AppSync RealTime for GQL_STOP message\n */\n MESSAGE_TYPES[\"GQL_COMPLETE\"] = \"complete\";\n /**\n * Server -> Client message.\n * This message type is for sending error messages from AWS AppSync RealTime to the client\n */\n MESSAGE_TYPES[\"GQL_ERROR\"] = \"error\";\n /**\n * Client -> Server message.\n * This message type is for registering subscriptions with Events\n */\n MESSAGE_TYPES[\"EVENT_SUBSCRIBE\"] = \"subscribe\";\n /**\n * Client -> Server message.\n * This message type is for publishing a message with Events\n */\n MESSAGE_TYPES[\"EVENT_PUBLISH\"] = \"publish\";\n /**\n * Server -> Client message.\n * Server acknowledges successful subscription\n */\n MESSAGE_TYPES[\"EVENT_SUBSCRIBE_ACK\"] = \"subscribe_success\";\n /**\n * Server -> Client message.\n * Server acknowledges successful publish\n */\n MESSAGE_TYPES[\"EVENT_PUBLISH_ACK\"] = \"publish_success\";\n /**\n * Client -> Server message.\n * This message type is for unregister subscriptions with AWS AppSync RealTime\n */\n MESSAGE_TYPES[\"EVENT_STOP\"] = \"unsubscribe\";\n /**\n * Server -> Client message.\n * This is the ack response from AWS AppSync Events to EVENT_STOP message\n */\n MESSAGE_TYPES[\"EVENT_COMPLETE\"] = \"unsubscribe_success\";\n})(MESSAGE_TYPES || (MESSAGE_TYPES = {}));\nvar SUBSCRIPTION_STATUS;\n(function (SUBSCRIPTION_STATUS) {\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"PENDING\"] = 0] = \"PENDING\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"CONNECTED\"] = 1] = \"CONNECTED\";\n SUBSCRIPTION_STATUS[SUBSCRIPTION_STATUS[\"FAILED\"] = 2] = \"FAILED\";\n})(SUBSCRIPTION_STATUS || (SUBSCRIPTION_STATUS = {}));\nvar SOCKET_STATUS;\n(function (SOCKET_STATUS) {\n SOCKET_STATUS[SOCKET_STATUS[\"CLOSED\"] = 0] = \"CLOSED\";\n SOCKET_STATUS[SOCKET_STATUS[\"READY\"] = 1] = \"READY\";\n SOCKET_STATUS[SOCKET_STATUS[\"CONNECTING\"] = 2] = \"CONNECTING\";\n})(SOCKET_STATUS || (SOCKET_STATUS = {}));\nconst AWS_APPSYNC_REALTIME_HEADERS = {\n accept: 'application/json, text/javascript',\n 'content-encoding': 'amz-1.0',\n 'content-type': 'application/json; charset=UTF-8',\n};\n/**\n * Time in milleseconds to wait for GQL_CONNECTION_INIT message\n */\nconst CONNECTION_INIT_TIMEOUT = 15000;\n/**\n * Time in milleseconds to wait for GQL_START_ACK message\n */\nconst START_ACK_TIMEOUT = 15000;\n/**\n * Default Time in milleseconds to wait for GQL_CONNECTION_KEEP_ALIVE message\n */\nconst DEFAULT_KEEP_ALIVE_TIMEOUT = 5 * 60 * 1000;\n/**\n * Default Time in milleseconds between monitoring checks of keep alive status\n */\nconst DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT = 5 * 1000;\n/**\n * Default Time in milleseconds to alert for missed GQL_CONNECTION_KEEP_ALIVE message\n */\nconst DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT = 65 * 1000;\n/**\n * Default delay time in milleseconds between when reconnect is triggered vs when it is attempted\n */\nconst RECONNECT_DELAY = 5 * 1000;\n/**\n * Default interval time in milleseconds between when reconnect is re-attempted\n */\nconst RECONNECT_INTERVAL = 60 * 1000;\n\nexport { AWS_APPSYNC_REALTIME_HEADERS, CONNECTION_INIT_TIMEOUT, CONNECTION_STATE_CHANGE, DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT, DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT, DEFAULT_KEEP_ALIVE_TIMEOUT, MAX_DELAY_MS, MESSAGE_TYPES, NON_RETRYABLE_CODES, NON_RETRYABLE_ERROR_TYPES, RECONNECT_DELAY, RECONNECT_INTERVAL, SOCKET_STATUS, START_ACK_TIMEOUT, SUBSCRIPTION_STATUS };\n//# sourceMappingURL=constants.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nclass NonRetryableError extends Error {\n constructor() {\n super(...arguments);\n this.nonRetryable = true;\n }\n}\n\nexport { NonRetryableError };\n//# sourceMappingURL=NonRetryableError.mjs.map\n","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import { v4 } from 'uuid';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst amplifyUuid = v4;\n\nexport { amplifyUuid };\n//# sourceMappingURL=index.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst isNonRetryableError = (obj) => {\n const key = 'nonRetryable';\n return obj && obj[key];\n};\n\nexport { isNonRetryableError };\n//# sourceMappingURL=isNonRetryableError.mjs.map\n","import { ConsoleLogger } from '../../Logger/ConsoleLogger.mjs';\nimport { isNonRetryableError } from './isNonRetryableError.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst logger = new ConsoleLogger('retryUtil');\n/**\n * @private\n * Internal use of Amplify only\n */\nasync function retry(functionToRetry, args, delayFn, onTerminate) {\n if (typeof functionToRetry !== 'function') {\n throw Error('functionToRetry must be a function');\n }\n // TODO(eslint): remove this linter suppression with refactoring.\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n let attempt = 0;\n let terminated = false;\n let timeout;\n let wakeUp = () => {\n // no-op\n }; // will be replaced with a resolver()\n // used after the loop if terminated while waiting for a timer.\n let lastError;\n onTerminate &&\n onTerminate.then(() => {\n // signal not to try anymore.\n terminated = true;\n // stop sleeping if we're sleeping.\n clearTimeout(timeout);\n wakeUp();\n });\n // TODO(eslint): remove this linter suppression with refactoring.\n // eslint-disable-next-line no-unmodified-loop-condition\n while (!terminated) {\n attempt++;\n logger.debug(`${functionToRetry.name} attempt #${attempt} with this vars: ${JSON.stringify(args)}`);\n try {\n resolve(await functionToRetry(...args));\n return;\n }\n catch (err) {\n lastError = err;\n logger.debug(`error on ${functionToRetry.name}`, err);\n if (isNonRetryableError(err)) {\n logger.debug(`${functionToRetry.name} non retryable error`, err);\n reject(err);\n return;\n }\n const retryIn = delayFn(attempt, args, err);\n logger.debug(`${functionToRetry.name} retrying in ${retryIn} ms`);\n // we check `terminated` again here because it could have flipped\n // in the time it took `functionToRetry` to return.\n if (retryIn === false || terminated) {\n reject(err);\n return;\n }\n else {\n await new Promise(_resolve => {\n wakeUp = _resolve; // export wakeUp for onTerminate handling\n timeout = setTimeout(wakeUp, retryIn);\n });\n }\n }\n }\n // reached if terminated while waiting for a timer.\n reject(lastError);\n });\n}\n\nexport { retry };\n//# sourceMappingURL=retry.mjs.map\n","import { MAX_DELAY_MS } from './constants.mjs';\nimport { jitteredBackoff } from './jitteredBackoff.mjs';\nimport { retry } from './retry.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @private\n * Internal use of Amplify only\n */\nconst jitteredExponentialRetry = (functionToRetry, args, maxDelayMs = MAX_DELAY_MS, onTerminate) => retry(functionToRetry, args, jitteredBackoff(maxDelayMs), onTerminate);\n\nexport { jitteredExponentialRetry };\n//# sourceMappingURL=jitteredExponentialRetry.mjs.map\n","var CONTROL_MSG;\n(function (CONTROL_MSG) {\n CONTROL_MSG[\"CONNECTION_CLOSED\"] = \"Connection closed\";\n CONTROL_MSG[\"CONNECTION_FAILED\"] = \"Connection failed\";\n CONTROL_MSG[\"REALTIME_SUBSCRIPTION_INIT_ERROR\"] = \"AppSync Realtime subscription init error\";\n CONTROL_MSG[\"SUBSCRIPTION_ACK\"] = \"Subscription ack\";\n CONTROL_MSG[\"TIMEOUT_DISCONNECT\"] = \"Timeout disconnect\";\n})(CONTROL_MSG || (CONTROL_MSG = {}));\n/** @enum {string} */\nvar ConnectionState;\n(function (ConnectionState) {\n /*\n * The connection is alive and healthy\n */\n ConnectionState[\"Connected\"] = \"Connected\";\n /*\n * The connection is alive, but the connection is offline\n */\n ConnectionState[\"ConnectedPendingNetwork\"] = \"ConnectedPendingNetwork\";\n /*\n * The connection has been disconnected while in use\n */\n ConnectionState[\"ConnectionDisrupted\"] = \"ConnectionDisrupted\";\n /*\n * The connection has been disconnected and the network is offline\n */\n ConnectionState[\"ConnectionDisruptedPendingNetwork\"] = \"ConnectionDisruptedPendingNetwork\";\n /*\n * The connection is in the process of connecting\n */\n ConnectionState[\"Connecting\"] = \"Connecting\";\n /*\n * The connection is not in use and is being disconnected\n */\n ConnectionState[\"ConnectedPendingDisconnect\"] = \"ConnectedPendingDisconnect\";\n /*\n * The connection is not in use and has been disconnected\n */\n ConnectionState[\"Disconnected\"] = \"Disconnected\";\n /*\n * The connection is alive, but a keep alive message has been missed\n */\n ConnectionState[\"ConnectedPendingKeepAlive\"] = \"ConnectedPendingKeepAlive\";\n})(ConnectionState || (ConnectionState = {}));\n\nexport { CONTROL_MSG, ConnectionState };\n//# sourceMappingURL=PubSub.mjs.map\n",null,null,null,null,null,null,null,null,null,null,null,null,"// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst isWebWorker = () => {\n if (typeof self === 'undefined') {\n return false;\n }\n const selfContext = self;\n return (typeof selfContext.WorkerGlobalScope !== 'undefined' &&\n self instanceof selfContext.WorkerGlobalScope);\n};\n\nexport { isWebWorker };\n//# sourceMappingURL=isWebWorker.mjs.map\n","import { from, Observable } from 'rxjs';\nimport '../types/errors.mjs';\nimport '../errors/errorHelpers.mjs';\nimport '../utils/getClientInfo/getClientInfo.mjs';\nimport { isWebWorker } from '../utils/isWebWorker.mjs';\nimport '../utils/retry/retry.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nclass Reachability {\n networkMonitor(_) {\n const globalObj = isWebWorker()\n ? self\n : typeof window !== 'undefined' && window;\n if (!globalObj) {\n return from([{ online: true }]);\n }\n return new Observable(observer => {\n observer.next({ online: globalObj.navigator.onLine });\n const notifyOnline = () => {\n observer.next({ online: true });\n };\n const notifyOffline = () => {\n observer.next({ online: false });\n };\n globalObj.addEventListener('online', notifyOnline);\n globalObj.addEventListener('offline', notifyOffline);\n Reachability._observers.push(observer);\n return () => {\n globalObj.removeEventListener('online', notifyOnline);\n globalObj.removeEventListener('offline', notifyOffline);\n Reachability._observers = Reachability._observers.filter(_observer => _observer !== observer);\n };\n });\n }\n // expose observers to simulate offline mode for integration testing\n static _observerOverride(status) {\n for (const observer of this._observers) {\n if (observer.closed) {\n this._observers = this._observers.filter(_observer => _observer !== observer);\n continue;\n }\n observer?.next && observer.next(status);\n }\n }\n}\nReachability._observers = [];\n\nexport { Reachability };\n//# sourceMappingURL=Reachability.mjs.map\n","import { Reachability } from '@aws-amplify/core/internals/utils';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst ReachabilityMonitor = () => new Reachability().networkMonitor();\n\nexport { ReachabilityMonitor };\n//# sourceMappingURL=index.mjs.map\n","import { Observable, map, filter } from 'rxjs';\nimport { ConnectionState } from '../types/PubSub.mjs';\nimport { ReachabilityMonitor } from './ReachabilityMonitor/index.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst CONNECTION_CHANGE = {\n KEEP_ALIVE_MISSED: { keepAliveState: 'unhealthy' },\n KEEP_ALIVE: { keepAliveState: 'healthy' },\n CONNECTION_ESTABLISHED: { connectionState: 'connected' },\n CONNECTION_FAILED: {\n intendedConnectionState: 'disconnected',\n connectionState: 'disconnected',\n },\n CLOSING_CONNECTION: { intendedConnectionState: 'disconnected' },\n OPENING_CONNECTION: {\n intendedConnectionState: 'connected',\n connectionState: 'connecting',\n },\n CLOSED: { connectionState: 'disconnected' },\n ONLINE: { networkState: 'connected' },\n OFFLINE: { networkState: 'disconnected' },\n};\nclass ConnectionStateMonitor {\n constructor() {\n this._networkMonitoringSubscription = undefined;\n this._linkedConnectionState = {\n networkState: 'connected',\n connectionState: 'disconnected',\n intendedConnectionState: 'disconnected',\n keepAliveState: 'healthy',\n };\n // Attempt to update the state with the current actual network state\n this._initialNetworkStateSubscription = ReachabilityMonitor().subscribe(({ online }) => {\n this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);\n this._initialNetworkStateSubscription?.unsubscribe();\n });\n this._linkedConnectionStateObservable =\n new Observable(connectionStateObserver => {\n connectionStateObserver.next(this._linkedConnectionState);\n this._linkedConnectionStateObserver = connectionStateObserver;\n });\n }\n /**\n * Turn network state monitoring on if it isn't on already\n */\n enableNetworkMonitoring() {\n // If no initial network state was discovered, stop trying\n this._initialNetworkStateSubscription?.unsubscribe();\n // Maintain the network state based on the reachability monitor\n if (this._networkMonitoringSubscription === undefined) {\n this._networkMonitoringSubscription = ReachabilityMonitor().subscribe(({ online }) => {\n this.record(online ? CONNECTION_CHANGE.ONLINE : CONNECTION_CHANGE.OFFLINE);\n });\n }\n }\n /**\n * Turn network state monitoring off if it isn't off already\n */\n disableNetworkMonitoring() {\n this._networkMonitoringSubscription?.unsubscribe();\n this._networkMonitoringSubscription = undefined;\n }\n /**\n * Get the observable that allows us to monitor the connection state\n *\n * @returns {Observable} - The observable that emits ConnectionState updates\n */\n get connectionStateObservable() {\n let previous;\n // The linked state aggregates state changes to any of the network, connection,\n // intendedConnection and keepAliveHealth. Some states will change these independent\n // states without changing the overall connection state.\n // After translating from linked states to ConnectionState, then remove any duplicates\n return this._linkedConnectionStateObservable\n .pipe(map(value => {\n return this.connectionStatesTranslator(value);\n }))\n .pipe(filter(current => {\n const toInclude = current !== previous;\n previous = current;\n return toInclude;\n }));\n }\n /*\n * Updates local connection state and emits the full state to the observer.\n */\n record(statusUpdates) {\n // Maintain the network monitor\n if (statusUpdates.intendedConnectionState === 'connected') {\n this.enableNetworkMonitoring();\n }\n else if (statusUpdates.intendedConnectionState === 'disconnected') {\n this.disableNetworkMonitoring();\n }\n // Maintain the socket state\n const newSocketStatus = {\n ...this._linkedConnectionState,\n ...statusUpdates,\n };\n this._linkedConnectionState = { ...newSocketStatus };\n this._linkedConnectionStateObserver?.next(this._linkedConnectionState);\n }\n /*\n * Translate the ConnectionState structure into a specific ConnectionState string literal union\n */\n connectionStatesTranslator({ connectionState, networkState, intendedConnectionState, keepAliveState, }) {\n if (connectionState === 'connected' && networkState === 'disconnected')\n return ConnectionState.ConnectedPendingNetwork;\n if (connectionState === 'connected' &&\n intendedConnectionState === 'disconnected')\n return ConnectionState.ConnectedPendingDisconnect;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected' &&\n networkState === 'disconnected')\n return ConnectionState.ConnectionDisruptedPendingNetwork;\n if (connectionState === 'disconnected' &&\n intendedConnectionState === 'connected')\n return ConnectionState.ConnectionDisrupted;\n if (connectionState === 'connected' && keepAliveState === 'unhealthy')\n return ConnectionState.ConnectedPendingKeepAlive;\n // All remaining states directly correspond to the connection state\n if (connectionState === 'connecting')\n return ConnectionState.Connecting;\n if (connectionState === 'disconnected')\n return ConnectionState.Disconnected;\n return ConnectionState.Connected;\n }\n}\n\nexport { CONNECTION_CHANGE, ConnectionStateMonitor };\n//# sourceMappingURL=ConnectionStateMonitor.mjs.map\n","import { RECONNECT_INTERVAL, RECONNECT_DELAY } from '../Providers/constants.mjs';\n\nvar ReconnectEvent;\n(function (ReconnectEvent) {\n ReconnectEvent[\"START_RECONNECT\"] = \"START_RECONNECT\";\n ReconnectEvent[\"HALT_RECONNECT\"] = \"HALT_RECONNECT\";\n})(ReconnectEvent || (ReconnectEvent = {}));\n/**\n * Captures the reconnect event logic used to determine when to reconnect to PubSub providers.\n * Reconnect attempts are delayed by 5 seconds to let the interface settle.\n * Attempting to reconnect only once creates unrecoverable states when the network state isn't\n * supported by the browser, so this keeps retrying every minute until halted.\n */\nclass ReconnectionMonitor {\n constructor() {\n this.reconnectObservers = [];\n }\n /**\n * Add reconnect observer to the list of observers to alert on reconnect\n */\n addObserver(reconnectObserver) {\n this.reconnectObservers.push(reconnectObserver);\n }\n /**\n * Given a reconnect event, start the appropriate behavior\n */\n record(event) {\n if (event === ReconnectEvent.START_RECONNECT) {\n // If the reconnection hasn't been started\n if (this.reconnectSetTimeoutId === undefined &&\n this.reconnectIntervalId === undefined) {\n this.reconnectSetTimeoutId = setTimeout(() => {\n // Reconnect now\n this._triggerReconnect();\n // Retry reconnect every periodically until it works\n this.reconnectIntervalId = setInterval(() => {\n this._triggerReconnect();\n }, RECONNECT_INTERVAL);\n }, RECONNECT_DELAY);\n }\n }\n if (event === ReconnectEvent.HALT_RECONNECT) {\n if (this.reconnectIntervalId) {\n clearInterval(this.reconnectIntervalId);\n this.reconnectIntervalId = undefined;\n }\n if (this.reconnectSetTimeoutId) {\n clearTimeout(this.reconnectSetTimeoutId);\n this.reconnectSetTimeoutId = undefined;\n }\n }\n }\n /**\n * Complete all reconnect observers\n */\n close() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.complete?.();\n });\n }\n _triggerReconnect() {\n this.reconnectObservers.forEach(reconnectObserver => {\n reconnectObserver.next?.();\n });\n }\n}\n\nexport { ReconnectEvent, ReconnectionMonitor };\n//# sourceMappingURL=ReconnectionMonitor.mjs.map\n","import { AmplifyUrl, AmplifyUrlSearchParams } from '@aws-amplify/core/internals/utils';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst protocol = 'wss://';\nconst standardDomainPattern = /^https:\\/\\/\\w{26}\\.appsync-api\\.\\w{2}(?:(?:-\\w{2,})+)-\\d\\.amazonaws.com(?:\\.cn)?\\/graphql$/i;\nconst eventDomainPattern = /^https:\\/\\/\\w{26}\\.\\w+-api\\.\\w{2}(?:(?:-\\w{2,})+)-\\d\\.amazonaws.com(?:\\.cn)?\\/event$/i;\nconst customDomainPath = '/realtime';\nconst isCustomDomain = (url) => {\n return url.match(standardDomainPattern) === null;\n};\nconst isEventDomain = (url) => url.match(eventDomainPattern) !== null;\nconst getRealtimeEndpointUrl = (appSyncGraphqlEndpoint) => {\n let realtimeEndpoint = appSyncGraphqlEndpoint ?? '';\n if (isEventDomain(realtimeEndpoint)) {\n realtimeEndpoint = realtimeEndpoint\n .concat(customDomainPath)\n .replace('ddpg-api', 'grt-gamma')\n .replace('appsync-api', 'appsync-realtime-api');\n }\n else if (isCustomDomain(realtimeEndpoint)) {\n realtimeEndpoint = realtimeEndpoint.concat(customDomainPath);\n }\n else {\n realtimeEndpoint = realtimeEndpoint\n .replace('appsync-api', 'appsync-realtime-api')\n .replace('gogi-beta', 'grt-beta')\n .replace('ddpg-api', 'grt-gamma');\n }\n realtimeEndpoint = realtimeEndpoint\n .replace('https://', protocol)\n .replace('http://', protocol);\n return new AmplifyUrl(realtimeEndpoint);\n};\n/**\n * Strips out `Authorization` header if present\n */\nconst extractNonAuthHeaders = (headers) => {\n if (!headers) {\n return {};\n }\n if ('Authorization' in headers) {\n const { Authorization: _, ...nonAuthHeaders } = headers;\n return nonAuthHeaders;\n }\n return headers;\n};\n/**\n *\n * @param headers - http headers\n * @returns uri-encoded query parameters derived from custom headers\n */\nconst queryParamsFromCustomHeaders = (headers) => {\n const nonAuthHeaders = extractNonAuthHeaders(headers);\n const params = new AmplifyUrlSearchParams();\n Object.entries(nonAuthHeaders).forEach(([k, v]) => {\n params.append(k, v);\n });\n return params;\n};\n/**\n * Normalizes AppSync realtime endpoint URL\n *\n * @param appSyncGraphqlEndpoint - AppSync endpointUri from config\n * @param urlParams - URLSearchParams\n * @returns fully resolved string realtime endpoint URL\n */\nconst realtimeUrlWithQueryString = (appSyncGraphqlEndpoint, urlParams) => {\n const realtimeEndpointUrl = getRealtimeEndpointUrl(appSyncGraphqlEndpoint);\n // preserves any query params a customer might manually set in the configuration\n const existingParams = new AmplifyUrlSearchParams(realtimeEndpointUrl.search);\n for (const [k, v] of urlParams.entries()) {\n existingParams.append(k, v);\n }\n realtimeEndpointUrl.search = existingParams.toString();\n return realtimeEndpointUrl.toString();\n};\n// TODO: move to separate file?\nconst additionalHeadersFromOptions = async (options) => {\n const { appSyncGraphqlEndpoint, query, libraryConfigHeaders = () => ({}), additionalHeaders = {}, authToken, } = options;\n let additionalCustomHeaders = {};\n const _libraryConfigHeaders = await libraryConfigHeaders();\n if (typeof additionalHeaders === 'function') {\n const requestOptions = {\n url: appSyncGraphqlEndpoint || '',\n queryString: query || '',\n };\n additionalCustomHeaders = await additionalHeaders(requestOptions);\n }\n else {\n additionalCustomHeaders = additionalHeaders;\n }\n // if an authorization header is set, have the explicit, operation-level authToken take precedence\n if (authToken) {\n additionalCustomHeaders = {\n ...additionalCustomHeaders,\n Authorization: authToken,\n };\n }\n return {\n additionalCustomHeaders,\n libraryConfigHeaders: _libraryConfigHeaders,\n };\n};\n\nexport { additionalHeadersFromOptions, getRealtimeEndpointUrl, isCustomDomain, queryParamsFromCustomHeaders, realtimeUrlWithQueryString };\n//# sourceMappingURL=appsyncUrl.mjs.map\n","import { ConsoleLogger, fetchAuthSession } from '@aws-amplify/core';\nimport { signRequest } from '@aws-amplify/core/internals/aws-client-utils';\nimport { AmplifyUrl } from '@aws-amplify/core/internals/utils';\nimport { AWS_APPSYNC_REALTIME_HEADERS } from '../constants.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst logger = new ConsoleLogger('AWSAppSyncRealTimeProvider Auth');\nconst awsAuthTokenHeader = async ({ host }) => {\n const session = await fetchAuthSession();\n return {\n Authorization: session?.tokens?.accessToken?.toString(),\n host,\n };\n};\nconst awsRealTimeApiKeyHeader = async ({ apiKey, host, }) => {\n const dt = new Date();\n const dtStr = dt.toISOString().replace(/[:-]|\\.\\d{3}/g, '');\n return {\n host,\n 'x-amz-date': dtStr,\n 'x-api-key': apiKey,\n };\n};\nconst awsRealTimeIAMHeader = async ({ payload, canonicalUri, appSyncGraphqlEndpoint, region, }) => {\n const endpointInfo = {\n region,\n service: 'appsync',\n };\n const creds = (await fetchAuthSession()).credentials;\n const request = {\n url: `${appSyncGraphqlEndpoint}${canonicalUri}`,\n data: payload,\n method: 'POST',\n headers: { ...AWS_APPSYNC_REALTIME_HEADERS },\n };\n const signedParams = signRequest({\n headers: request.headers,\n method: request.method,\n url: new AmplifyUrl(request.url),\n body: request.data,\n }, {\n credentials: creds,\n signingRegion: endpointInfo.region,\n signingService: endpointInfo.service,\n });\n return signedParams.headers;\n};\nconst customAuthHeader = async ({ host, additionalCustomHeaders, }) => {\n /**\n * If `additionalHeaders` was provided to the subscription as a function,\n * the headers that are returned by that function will already have been\n * provided before this function is called.\n */\n if (!additionalCustomHeaders?.Authorization) {\n throw new Error('No auth token specified');\n }\n return {\n Authorization: additionalCustomHeaders.Authorization,\n host,\n };\n};\nconst awsRealTimeHeaderBasedAuth = async ({ apiKey, authenticationType, canonicalUri, appSyncGraphqlEndpoint, region, additionalCustomHeaders, payload, }) => {\n const headerHandler = {\n apiKey: awsRealTimeApiKeyHeader,\n iam: awsRealTimeIAMHeader,\n oidc: awsAuthTokenHeader,\n userPool: awsAuthTokenHeader,\n lambda: customAuthHeader,\n none: customAuthHeader,\n };\n if (!authenticationType || !headerHandler[authenticationType]) {\n logger.debug(`Authentication type ${authenticationType} not supported`);\n return undefined;\n }\n else {\n const handler = headerHandler[authenticationType];\n const host = appSyncGraphqlEndpoint\n ? new AmplifyUrl(appSyncGraphqlEndpoint).host\n : undefined;\n const resolvedApiKey = authenticationType === 'apiKey' ? apiKey : undefined;\n logger.debug(`Authenticating with ${JSON.stringify(authenticationType)}`);\n const result = await handler({\n payload,\n canonicalUri,\n appSyncGraphqlEndpoint,\n apiKey: resolvedApiKey,\n region,\n host,\n additionalCustomHeaders,\n });\n return result;\n }\n};\n\nexport { awsRealTimeHeaderBasedAuth };\n//# sourceMappingURL=authHeaders.mjs.map\n","import { Observable } from 'rxjs';\nimport { GraphQLError } from 'graphql';\nimport { ConsoleLogger, Hub } from '@aws-amplify/core';\nimport { NonRetryableError, amplifyUuid, isNonRetryableError, base64Encoder, jitteredExponentialRetry, AMPLIFY_SYMBOL } from '@aws-amplify/core/internals/utils';\nimport { ConnectionState, CONTROL_MSG } from '../../types/PubSub.mjs';\nimport { SOCKET_STATUS, NON_RETRYABLE_CODES, NON_RETRYABLE_ERROR_TYPES, SUBSCRIPTION_STATUS, START_ACK_TIMEOUT, DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT, MESSAGE_TYPES, MAX_DELAY_MS, CONNECTION_INIT_TIMEOUT, DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT, CONNECTION_STATE_CHANGE } from '../constants.mjs';\nimport { ConnectionStateMonitor, CONNECTION_CHANGE } from '../../utils/ConnectionStateMonitor.mjs';\nimport { ReconnectionMonitor, ReconnectEvent } from '../../utils/ReconnectionMonitor.mjs';\nimport { additionalHeadersFromOptions, queryParamsFromCustomHeaders, realtimeUrlWithQueryString } from './appsyncUrl.mjs';\nimport { awsRealTimeHeaderBasedAuth } from './authHeaders.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst dispatchApiEvent = (payload) => {\n Hub.dispatch('api', payload, 'PubSub', AMPLIFY_SYMBOL);\n};\nclass AWSWebSocketProvider {\n constructor(args) {\n this.subscriptionObserverMap = new Map();\n this.socketStatus = SOCKET_STATUS.CLOSED;\n this.keepAliveTimestamp = Date.now();\n this.promiseArray = [];\n this.connectionStateMonitor = new ConnectionStateMonitor();\n this.reconnectionMonitor = new ReconnectionMonitor();\n /**\n * Open WebSocket connection & perform handshake\n * Ref: https://docs.aws.amazon.com/appsync/latest/devguide/real-time-websocket-client.html#appsynclong-real-time-websocket-client-implementation-guide-for-graphql-subscriptions\n *\n * @param subprotocol -\n */\n this._establishConnection = async (awsRealTimeUrl, subprotocol) => {\n this.logger.debug(`Establishing WebSocket connection to ${awsRealTimeUrl}`);\n try {\n await this._openConnection(awsRealTimeUrl, subprotocol);\n await this._initiateHandshake();\n }\n catch (err) {\n const { errorType, errorCode } = err;\n if (NON_RETRYABLE_CODES.includes(errorCode) ||\n // Event API does not currently return `errorCode`. This may change in the future.\n // For now fall back to also checking known non-retryable error types\n NON_RETRYABLE_ERROR_TYPES.includes(errorType)) {\n throw new NonRetryableError(errorType);\n }\n else if (errorType) {\n throw new Error(errorType);\n }\n else {\n throw err;\n }\n }\n };\n this.logger = new ConsoleLogger(args.providerName);\n this.wsProtocolName = args.wsProtocolName;\n this.wsConnectUri = args.connectUri;\n this.connectionStateMonitorSubscription =\n this._startConnectionStateMonitoring();\n }\n /**\n * Mark the socket closed and release all active listeners\n */\n close() {\n // Mark the socket closed both in status and the connection monitor\n this.socketStatus = SOCKET_STATUS.CLOSED;\n this.connectionStateMonitor.record(CONNECTION_CHANGE.CONNECTION_FAILED);\n // Turn off the subscription monitor Hub publishing\n this.connectionStateMonitorSubscription.unsubscribe();\n // Complete all reconnect observers\n this.reconnectionMonitor.close();\n return new Promise((resolve, reject) => {\n if (this.awsRealTimeSocket) {\n this.awsRealTimeSocket.onclose = (_) => {\n this._closeSocket();\n this.subscriptionObserverMap = new Map();\n this.awsRealTimeSocket = undefined;\n resolve();\n };\n this.awsRealTimeSocket.onerror = (err) => {\n reject(err);\n };\n this.awsRealTimeSocket.close();\n }\n else {\n resolve();\n }\n });\n }\n subscribe(options, customUserAgentDetails) {\n return new Observable(observer => {\n if (!options?.appSyncGraphqlEndpoint) {\n observer.error({\n errors: [\n {\n ...new GraphQLError(`Subscribe only available for AWS AppSync endpoint`),\n },\n ],\n });\n observer.complete();\n return;\n }\n let subscriptionStartInProgress = false;\n const subscriptionId = amplifyUuid();\n const startSubscription = () => {\n if (!subscriptionStartInProgress) {\n subscriptionStartInProgress = true;\n this._startSubscriptionWithAWSAppSyncRealTime({\n options,\n observer,\n subscriptionId,\n customUserAgentDetails,\n })\n .catch(err => {\n this.logger.debug(`${CONTROL_MSG.REALTIME_SUBSCRIPTION_INIT_ERROR}: ${err}`);\n this._closeSocket();\n })\n .finally(() => {\n subscriptionStartInProgress = false;\n });\n }\n };\n // Add an observable to the reconnection list to manage reconnection for this subscription\n const reconnectSubscription = new Observable(reconnectSubscriptionObserver => {\n this.reconnectionMonitor.addObserver(reconnectSubscriptionObserver);\n }).subscribe(() => {\n startSubscription();\n });\n startSubscription();\n return async () => {\n await this._cleanupSubscription(subscriptionId, reconnectSubscription);\n };\n });\n }\n async connect(options) {\n if (this.socketStatus === SOCKET_STATUS.READY) {\n return;\n }\n await this._connectWebSocket(options);\n }\n async publish(options, customUserAgentDetails) {\n if (this.socketStatus !== SOCKET_STATUS.READY) {\n throw new Error('Subscription has not been initialized');\n }\n return this._publishMessage(options, customUserAgentDetails);\n }\n async _connectWebSocket(options) {\n const { apiKey, appSyncGraphqlEndpoint, authenticationType, region } = options;\n const { additionalCustomHeaders } = await additionalHeadersFromOptions(options);\n this.connectionStateMonitor.record(CONNECTION_CHANGE.OPENING_CONNECTION);\n await this._initializeWebSocketConnection({\n apiKey,\n appSyncGraphqlEndpoint,\n authenticationType,\n region,\n additionalCustomHeaders,\n });\n }\n async _publishMessage(options, customUserAgentDetails) {\n const subscriptionId = amplifyUuid();\n const { additionalCustomHeaders, libraryConfigHeaders } = await additionalHeadersFromOptions(options);\n const serializedSubscriptionMessage = await this._prepareSubscriptionPayload({\n options,\n subscriptionId,\n customUserAgentDetails,\n additionalCustomHeaders,\n libraryConfigHeaders,\n publish: true,\n });\n return new Promise((resolve, reject) => {\n if (this.awsRealTimeSocket) {\n const publishListener = (event) => {\n const data = JSON.parse(event.data);\n if (data.id === subscriptionId && data.type === 'publish_success') {\n this.awsRealTimeSocket &&\n this.awsRealTimeSocket.removeEventListener('message', publishListener);\n resolve();\n }\n if (data.erroredEvents && data.erroredEvents.length > 0) ;\n };\n this.awsRealTimeSocket.addEventListener('message', publishListener);\n this.awsRealTimeSocket.addEventListener('close', () => {\n reject(new Error('WebSocket is closed'));\n });\n //\n // this.awsRealTimeSocket.addEventListener('error', publishListener);\n this.awsRealTimeSocket.send(serializedSubscriptionMessage);\n }\n });\n }\n async _cleanupSubscription(subscriptionId, reconnectSubscription) {\n // Cleanup reconnection subscription\n reconnectSubscription?.unsubscribe();\n // Cleanup after unsubscribing or observer.complete was called after _startSubscriptionWithAWSAppSyncRealTime\n try {\n // Waiting that subscription has been connected before trying to unsubscribe\n await this._waitForSubscriptionToBeConnected(subscriptionId);\n const { subscriptionState } = this.subscriptionObserverMap.get(subscriptionId) || {};\n if (!subscriptionState) {\n // subscription already unsubscribed\n return;\n }\n if (subscriptionState === SUBSCRIPTION_STATUS.CONNECTED) {\n this._sendUnsubscriptionMessage(subscriptionId);\n }\n else {\n throw new Error('Subscription never connected');\n }\n }\n catch (err) {\n this.logger.debug(`Error while unsubscribing ${err}`);\n }\n finally {\n this._removeSubscriptionObserver(subscriptionId);\n }\n }\n // Monitor the connection state and pass changes along to Hub\n _startConnectionStateMonitoring() {\n return this.connectionStateMonitor.connectionStateObservable.subscribe(connectionState => {\n dispatchApiEvent({\n event: CONNECTION_STATE_CHANGE,\n data: {\n provider: this,\n connectionState,\n },\n message: `Connection state is ${connectionState}`,\n });\n this.connectionState = connectionState;\n // Trigger START_RECONNECT when the connection is disrupted\n if (connectionState === ConnectionState.ConnectionDisrupted) {\n this.reconnectionMonitor.record(ReconnectEvent.START_RECONNECT);\n }\n // Trigger HALT_RECONNECT to halt reconnection attempts when the state is anything other than\n // ConnectionDisrupted or Connecting\n if ([\n ConnectionState.Connected,\n ConnectionState.ConnectedPendingDisconnect,\n ConnectionState.ConnectedPendingKeepAlive,\n ConnectionState.ConnectedPendingNetwork,\n ConnectionState.ConnectionDisruptedPendingNetwork,\n ConnectionState.Disconnected,\n ].includes(connectionState)) {\n this.reconnectionMonitor.record(ReconnectEvent.HALT_RECONNECT);\n }\n });\n }\n async _startSubscriptionWithAWSAppSyncRealTime({ options, observer, subscriptionId, customUserAgentDetails, }) {\n const { query, variables } = options;\n const { additionalCustomHeaders, libraryConfigHeaders } = await additionalHeadersFromOptions(options);\n this.subscriptionObserverMap.set(subscriptionId, {\n observer,\n query: query ?? '',\n variables: variables ?? {},\n subscriptionState: SUBSCRIPTION_STATUS.PENDING,\n startAckTimeoutId: undefined,\n });\n const serializedSubscriptionMessage = await this._prepareSubscriptionPayload({\n options,\n subscriptionId,\n customUserAgentDetails,\n additionalCustomHeaders,\n libraryConfigHeaders,\n });\n try {\n await this._connectWebSocket(options);\n }\n catch (err) {\n this._logStartSubscriptionError(subscriptionId, observer, err);\n return;\n }\n // Potential race condition can occur when unsubscribe is called during _initializeWebSocketConnection.\n // E.g.unsubscribe gets invoked prior to finishing WebSocket handshake or START_ACK.\n // Both subscriptionFailedCallback and subscriptionReadyCallback are used to synchronized this.\n const { subscriptionFailedCallback, subscriptionReadyCallback } = this.subscriptionObserverMap.get(subscriptionId) ?? {};\n // This must be done before sending the message in order to be listening immediately\n this.subscriptionObserverMap.set(subscriptionId, {\n observer,\n subscriptionState: SUBSCRIPTION_STATUS.PENDING,\n query: query ?? '',\n variables: variables ?? {},\n subscriptionReadyCallback,\n subscriptionFailedCallback,\n startAckTimeoutId: setTimeout(() => {\n this._timeoutStartSubscriptionAck(subscriptionId);\n }, START_ACK_TIMEOUT),\n });\n if (this.awsRealTimeSocket) {\n this.awsRealTimeSocket.send(serializedSubscriptionMessage);\n }\n }\n // Log logic for start subscription failures\n _logStartSubscriptionError(subscriptionId, observer, err) {\n this.logger.debug({ err });\n const message = String(err.message ?? '');\n // Resolving to give the state observer time to propogate the update\n this._closeSocket();\n // Capture the error only when the network didn't cause disruption\n if (this.connectionState !== ConnectionState.ConnectionDisruptedPendingNetwork) {\n // When the error is non-retriable, error out the observable\n if (isNonRetryableError(err)) {\n observer.error({\n errors: [\n {\n ...new GraphQLError(`${CONTROL_MSG.CONNECTION_FAILED}: ${message}`),\n },\n ],\n });\n }\n else {\n this.logger.debug(`${CONTROL_MSG.CONNECTION_FAILED}: ${message}`);\n }\n const { subscriptionFailedCallback } = this.subscriptionObserverMap.get(subscriptionId) || {};\n // Notify concurrent unsubscription\n if (typeof subscriptionFailedCallback === 'function') {\n subscriptionFailedCallback();\n }\n }\n }\n // Waiting that subscription has been connected before trying to unsubscribe\n async _waitForSubscriptionToBeConnected(subscriptionId) {\n const subscriptionObserver = this.subscriptionObserverMap.get(subscriptionId);\n if (subscriptionObserver) {\n const { subscriptionState } = subscriptionObserver;\n // This in case unsubscribe is invoked before sending start subscription message\n if (subscriptionState === SUBSCRIPTION_STATUS.PENDING) {\n return new Promise((resolve, reject) => {\n const { observer, subscriptionState: observedSubscriptionState, variables, query, } = subscriptionObserver;\n this.subscriptionObserverMap.set(subscriptionId, {\n observer,\n subscriptionState: observedSubscriptionState,\n variables,\n query,\n subscriptionReadyCallback: resolve,\n subscriptionFailedCallback: reject,\n });\n });\n }\n }\n }\n _sendUnsubscriptionMessage(subscriptionId) {\n try {\n if (this.awsRealTimeSocket &&\n this.awsRealTimeSocket.readyState === WebSocket.OPEN &&\n this.socketStatus === SOCKET_STATUS.READY) {\n // Preparing unsubscribe message to stop receiving messages for that subscription\n const unsubscribeMessage = this._unsubscribeMessage(subscriptionId);\n const stringToAWSRealTime = JSON.stringify(unsubscribeMessage);\n this.awsRealTimeSocket.send(stringToAWSRealTime);\n }\n }\n catch (err) {\n // If GQL_STOP is not sent because of disconnection issue, then there is nothing the client can do\n this.logger.debug({ err });\n }\n }\n _removeSubscriptionObserver(subscriptionId) {\n this.subscriptionObserverMap.delete(subscriptionId);\n // Verifying 1000ms after removing subscription in case there are new subscription unmount/mount\n setTimeout(this._closeSocketIfRequired.bind(this), 1000);\n }\n _closeSocketIfRequired() {\n if (this.subscriptionObserverMap.size > 0) {\n // Active subscriptions on the WebSocket\n return;\n }\n if (!this.awsRealTimeSocket) {\n this.socketStatus = SOCKET_STATUS.CLOSED;\n return;\n }\n this.connectionStateMonitor.record(CONNECTION_CHANGE.CLOSING_CONNECTION);\n if (this.awsRealTimeSocket.bufferedAmount > 0) {\n // Still data on the WebSocket\n setTimeout(this._closeSocketIfRequired.bind(this), 1000);\n }\n else {\n this.logger.debug('closing WebSocket...');\n const tempSocket = this.awsRealTimeSocket;\n // Cleaning callbacks to avoid race condition, socket still exists\n tempSocket.onclose = null;\n tempSocket.onerror = null;\n tempSocket.close(1000);\n this.awsRealTimeSocket = undefined;\n this.socketStatus = SOCKET_STATUS.CLOSED;\n this._closeSocket();\n }\n }\n maintainKeepAlive() {\n this.keepAliveTimestamp = Date.now();\n }\n keepAliveHeartbeat(connectionTimeoutMs) {\n const currentTime = Date.now();\n // Check for missed KA message\n if (currentTime - this.keepAliveTimestamp >\n DEFAULT_KEEP_ALIVE_ALERT_TIMEOUT) {\n this.connectionStateMonitor.record(CONNECTION_CHANGE.KEEP_ALIVE_MISSED);\n }\n else {\n this.connectionStateMonitor.record(CONNECTION_CHANGE.KEEP_ALIVE);\n }\n // Recognize we are disconnected if we haven't seen messages in the keep alive timeout period\n if (currentTime - this.keepAliveTimestamp > connectionTimeoutMs) {\n this._errorDisconnect(CONTROL_MSG.TIMEOUT_DISCONNECT);\n }\n }\n _handleIncomingSubscriptionMessage(message) {\n if (typeof message.data !== 'string') {\n return;\n }\n const [isData, data] = this._handleSubscriptionData(message);\n if (isData) {\n this.maintainKeepAlive();\n return;\n }\n const { type, id, payload } = data;\n const { observer = null, query = '', variables = {}, startAckTimeoutId, subscriptionReadyCallback, subscriptionFailedCallback, } = this.subscriptionObserverMap.get(id) || {};\n if (type === MESSAGE_TYPES.GQL_START_ACK ||\n type === MESSAGE_TYPES.EVENT_SUBSCRIBE_ACK) {\n this.logger.debug(`subscription ready for ${JSON.stringify({ query, variables })}`);\n if (typeof subscriptionReadyCallback === 'function') {\n subscriptionReadyCallback();\n }\n if (startAckTimeoutId)\n clearTimeout(startAckTimeoutId);\n dispatchApiEvent({\n event: CONTROL_MSG.SUBSCRIPTION_ACK,\n data: { query, variables },\n message: 'Connection established for subscription',\n });\n const subscriptionState = SUBSCRIPTION_STATUS.CONNECTED;\n if (observer) {\n this.subscriptionObserverMap.set(id, {\n observer,\n query,\n variables,\n startAckTimeoutId: undefined,\n subscriptionState,\n subscriptionReadyCallback,\n subscriptionFailedCallback,\n });\n }\n this.connectionStateMonitor.record(CONNECTION_CHANGE.CONNECTION_ESTABLISHED);\n return;\n }\n if (type === MESSAGE_TYPES.GQL_CONNECTION_KEEP_ALIVE) {\n this.maintainKeepAlive();\n return;\n }\n if (type === MESSAGE_TYPES.GQL_ERROR) {\n const subscriptionState = SUBSCRIPTION_STATUS.FAILED;\n if (observer) {\n this.subscriptionObserverMap.set(id, {\n observer,\n query,\n variables,\n startAckTimeoutId,\n subscriptionReadyCallback,\n subscriptionFailedCallback,\n subscriptionState,\n });\n this.logger.debug(`${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload ?? data)}`);\n observer.error({\n errors: [\n {\n ...new GraphQLError(`${CONTROL_MSG.CONNECTION_FAILED}: ${JSON.stringify(payload ?? data)}`),\n },\n ],\n });\n if (startAckTimeoutId)\n clearTimeout(startAckTimeoutId);\n if (typeof subscriptionFailedCallback === 'function') {\n subscriptionFailedCallback();\n }\n }\n }\n }\n _errorDisconnect(msg) {\n this.logger.debug(`Disconnect error: ${msg}`);\n if (this.awsRealTimeSocket) {\n this._closeSocket();\n this.awsRealTimeSocket.close();\n }\n this.socketStatus = SOCKET_STATUS.CLOSED;\n }\n _closeSocket() {\n if (this.keepAliveHeartbeatIntervalId) {\n clearInterval(this.keepAliveHeartbeatIntervalId);\n this.keepAliveHeartbeatIntervalId = undefined;\n }\n this.connectionStateMonitor.record(CONNECTION_CHANGE.CLOSED);\n }\n _timeoutStartSubscriptionAck(subscriptionId) {\n const subscriptionObserver = this.subscriptionObserverMap.get(subscriptionId);\n if (subscriptionObserver) {\n const { observer, query, variables } = subscriptionObserver;\n if (!observer) {\n return;\n }\n this.subscriptionObserverMap.set(subscriptionId, {\n observer,\n query,\n variables,\n subscriptionState: SUBSCRIPTION_STATUS.FAILED,\n });\n this._closeSocket();\n this.logger.debug('timeoutStartSubscription', JSON.stringify({ query, variables }));\n }\n }\n _initializeWebSocketConnection({ appSyncGraphqlEndpoint, authenticationType, apiKey, region, additionalCustomHeaders, }) {\n if (this.socketStatus === SOCKET_STATUS.READY) {\n return;\n }\n // TODO(Eslint): refactor to now use async function as the promise executor\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n this.promiseArray.push({ res: resolve, rej: reject });\n if (this.socketStatus === SOCKET_STATUS.CLOSED) {\n try {\n this.socketStatus = SOCKET_STATUS.CONNECTING;\n // Empty payload on connect\n const payloadString = '{}';\n const authHeader = await awsRealTimeHeaderBasedAuth({\n authenticationType,\n payload: payloadString,\n canonicalUri: this.wsConnectUri,\n apiKey,\n appSyncGraphqlEndpoint,\n region,\n additionalCustomHeaders,\n });\n const headerString = authHeader ? JSON.stringify(authHeader) : '';\n // base64url-encoded string\n const encodedHeader = base64Encoder.convert(headerString, {\n urlSafe: true,\n skipPadding: true,\n });\n const authTokenSubprotocol = `header-${encodedHeader}`;\n const queryParams = queryParamsFromCustomHeaders(additionalCustomHeaders);\n const awsRealTimeUrl = realtimeUrlWithQueryString(appSyncGraphqlEndpoint, queryParams);\n await this._establishRetryableConnection(awsRealTimeUrl, authTokenSubprotocol);\n this.promiseArray.forEach(({ res }) => {\n this.logger.debug('Notifying connection successful');\n res();\n });\n this.socketStatus = SOCKET_STATUS.READY;\n this.promiseArray = [];\n }\n catch (err) {\n this.logger.debug('Connection exited with', err);\n this.promiseArray.forEach(({ rej }) => {\n rej(err);\n });\n this.promiseArray = [];\n if (this.awsRealTimeSocket &&\n this.awsRealTimeSocket.readyState === WebSocket.OPEN) {\n this.awsRealTimeSocket.close(3001);\n }\n this.awsRealTimeSocket = undefined;\n this.socketStatus = SOCKET_STATUS.CLOSED;\n }\n }\n });\n }\n async _establishRetryableConnection(awsRealTimeUrl, subprotocol) {\n this.logger.debug(`Establishing retryable connection`);\n await jitteredExponentialRetry(this._establishConnection.bind(this), [awsRealTimeUrl, subprotocol], MAX_DELAY_MS);\n }\n async _openConnection(awsRealTimeUrl, subprotocol) {\n return new Promise((resolve, reject) => {\n const newSocket = this._getNewWebSocket(awsRealTimeUrl, [\n this.wsProtocolName,\n subprotocol,\n ]);\n newSocket.onerror = () => {\n this.logger.debug(`WebSocket connection error`);\n };\n newSocket.onclose = () => {\n this._closeSocket();\n reject(new Error('Connection handshake error'));\n };\n newSocket.onopen = () => {\n this.awsRealTimeSocket = newSocket;\n resolve();\n };\n });\n }\n _getNewWebSocket(url, protocol) {\n return new WebSocket(url, protocol);\n }\n async _initiateHandshake() {\n return new Promise((resolve, reject) => {\n if (!this.awsRealTimeSocket) {\n reject(new Error('awsRealTimeSocket undefined'));\n return;\n }\n let ackOk = false;\n this.awsRealTimeSocket.onerror = error => {\n this.logger.debug(`WebSocket error ${JSON.stringify(error)}`);\n };\n this.awsRealTimeSocket.onclose = event => {\n this.logger.debug(`WebSocket closed ${event.reason}`);\n this._closeSocket();\n reject(new Error(JSON.stringify(event)));\n };\n this.awsRealTimeSocket.onmessage = (message) => {\n if (typeof message.data !== 'string') {\n return;\n }\n this.logger.debug(`subscription message from AWS AppSyncRealTime: ${message.data} `);\n const data = JSON.parse(message.data);\n const { type } = data;\n const connectionTimeoutMs = this._extractConnectionTimeout(data);\n if (type === MESSAGE_TYPES.GQL_CONNECTION_ACK) {\n ackOk = true;\n this._registerWebsocketHandlers(connectionTimeoutMs);\n resolve('Connected to AWS AppSyncRealTime');\n return;\n }\n if (type === MESSAGE_TYPES.GQL_CONNECTION_ERROR) {\n const { errorType, errorCode } = this._extractErrorCodeAndType(data);\n // TODO(Eslint): refactor to reject an Error object instead of a plain object\n // eslint-disable-next-line prefer-promise-reject-errors\n reject({ errorType, errorCode });\n }\n };\n const gqlInit = {\n type: MESSAGE_TYPES.GQL_CONNECTION_INIT,\n };\n this.awsRealTimeSocket.send(JSON.stringify(gqlInit));\n const checkAckOk = (targetAckOk) => {\n if (!targetAckOk) {\n this.connectionStateMonitor.record(CONNECTION_CHANGE.CONNECTION_FAILED);\n reject(new Error(`Connection timeout: ack from AWSAppSyncRealTime was not received after ${CONNECTION_INIT_TIMEOUT} ms`));\n }\n };\n setTimeout(() => {\n checkAckOk(ackOk);\n }, CONNECTION_INIT_TIMEOUT);\n });\n }\n _registerWebsocketHandlers(connectionTimeoutMs) {\n if (!this.awsRealTimeSocket) {\n return;\n }\n // Set up a keep alive heartbeat for this connection\n this.keepAliveHeartbeatIntervalId = setInterval(() => {\n this.keepAliveHeartbeat(connectionTimeoutMs);\n }, DEFAULT_KEEP_ALIVE_HEARTBEAT_TIMEOUT);\n this.awsRealTimeSocket.onmessage =\n this._handleIncomingSubscriptionMessage.bind(this);\n this.awsRealTimeSocket.onerror = err => {\n this.logger.debug(err);\n this._errorDisconnect(CONTROL_MSG.CONNECTION_CLOSED);\n };\n this.awsRealTimeSocket.onclose = event => {\n this.logger.debug(`WebSocket closed ${event.reason}`);\n this._closeSocket();\n this._errorDisconnect(CONTROL_MSG.CONNECTION_CLOSED);\n };\n }\n}\n\nexport { AWSWebSocketProvider };\n//# sourceMappingURL=index.mjs.map\n","import { USER_AGENT_HEADER, getAmplifyUserAgent } from '@aws-amplify/core/internals/utils';\nimport { MESSAGE_TYPES, DEFAULT_KEEP_ALIVE_TIMEOUT } from '../constants.mjs';\nimport { AWSWebSocketProvider } from '../AWSWebSocketProvider/index.mjs';\nimport { awsRealTimeHeaderBasedAuth } from '../AWSWebSocketProvider/authHeaders.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst PROVIDER_NAME = 'AWSAppSyncRealTimeProvider';\nconst WS_PROTOCOL_NAME = 'graphql-ws';\nconst CONNECT_URI = '/connect';\nclass AWSAppSyncRealTimeProvider extends AWSWebSocketProvider {\n constructor() {\n super({\n providerName: PROVIDER_NAME,\n wsProtocolName: WS_PROTOCOL_NAME,\n connectUri: CONNECT_URI,\n });\n }\n getProviderName() {\n return PROVIDER_NAME;\n }\n subscribe(options, customUserAgentDetails) {\n return super.subscribe(options, customUserAgentDetails);\n }\n async _prepareSubscriptionPayload({ options, subscriptionId, customUserAgentDetails, additionalCustomHeaders, libraryConfigHeaders, }) {\n const { appSyncGraphqlEndpoint, authenticationType, query, variables, apiKey, region, } = options;\n const data = {\n query,\n variables,\n };\n const serializedData = JSON.stringify(data);\n const headers = {\n ...(await awsRealTimeHeaderBasedAuth({\n apiKey,\n appSyncGraphqlEndpoint,\n authenticationType,\n payload: serializedData,\n canonicalUri: '',\n region,\n additionalCustomHeaders,\n })),\n ...libraryConfigHeaders,\n ...additionalCustomHeaders,\n [USER_AGENT_HEADER]: getAmplifyUserAgent(customUserAgentDetails),\n };\n const subscriptionMessage = {\n id: subscriptionId,\n payload: {\n data: serializedData,\n extensions: {\n authorization: {\n ...headers,\n },\n },\n },\n type: MESSAGE_TYPES.GQL_START,\n };\n const serializedSubscriptionMessage = JSON.stringify(subscriptionMessage);\n return serializedSubscriptionMessage;\n }\n _handleSubscriptionData(message) {\n this.logger.debug(`subscription message from AWS AppSync RealTime: ${message.data}`);\n const { id = '', payload, type } = JSON.parse(String(message.data));\n const { observer = null, query = '', variables = {}, } = this.subscriptionObserverMap.get(id) || {};\n this.logger.debug({ id, observer, query, variables });\n if (type === MESSAGE_TYPES.DATA && payload && payload.data) {\n if (observer) {\n observer.next(payload);\n }\n else {\n this.logger.debug(`observer not found for id: ${id}`);\n }\n return [true, { id, type, payload }];\n }\n return [false, { id, type, payload }];\n }\n _unsubscribeMessage(subscriptionId) {\n return {\n id: subscriptionId,\n type: MESSAGE_TYPES.GQL_STOP,\n };\n }\n _extractConnectionTimeout(data) {\n const { payload: { connectionTimeoutMs = DEFAULT_KEEP_ALIVE_TIMEOUT } = {}, } = data;\n return connectionTimeoutMs;\n }\n _extractErrorCodeAndType(data) {\n const { payload: { errors: [{ errorType = '', errorCode = 0 } = {}] = [] } = {}, } = data;\n return { errorCode, errorType };\n }\n}\n\nexport { AWSAppSyncRealTimeProvider };\n//# sourceMappingURL=index.mjs.map\n","import { AmplifyError } from '@aws-amplify/core/internals/utils';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @internal\n */\nclass GraphQLApiError extends AmplifyError {\n constructor(params) {\n super(params);\n // Hack for making the custom error class work when transpiled to es5\n // TODO: Delete the following 2 lines after we change the build target to >= es2015\n this.constructor = GraphQLApiError;\n Object.setPrototypeOf(this, GraphQLApiError.prototype);\n }\n}\n\nexport { GraphQLApiError };\n//# sourceMappingURL=GraphQLApiError.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nvar APIValidationErrorCode;\n(function (APIValidationErrorCode) {\n APIValidationErrorCode[\"NoAuthSession\"] = \"NoAuthSession\";\n APIValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n APIValidationErrorCode[\"NoCustomEndpoint\"] = \"NoCustomEndpoint\";\n})(APIValidationErrorCode || (APIValidationErrorCode = {}));\nconst validationErrorMap = {\n [APIValidationErrorCode.NoAuthSession]: {\n message: 'Auth session should not be empty.',\n },\n // TODO: re-enable when working in all test environments:\n // [APIValidationErrorCode.NoEndpoint]: {\n // \tmessage: 'Missing endpoint',\n // },\n [APIValidationErrorCode.NoRegion]: {\n message: 'Missing region.',\n },\n [APIValidationErrorCode.NoCustomEndpoint]: {\n message: 'Custom endpoint region is present without custom endpoint.',\n },\n};\n\nexport { APIValidationErrorCode, validationErrorMap };\n//# sourceMappingURL=validation.mjs.map\n","import { GraphQLApiError } from './GraphQLApiError.mjs';\nimport { validationErrorMap } from './validation.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @internal\n */\nfunction assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validationErrorMap[name];\n if (!assertion) {\n throw new GraphQLApiError({ name, message, recoverySuggestion });\n }\n}\n\nexport { assertValidationError };\n//# sourceMappingURL=assertValidationError.mjs.map\n","import { ConsoleLogger } from '@aws-amplify/core';\nimport '@aws-amplify/core/internals/utils';\nimport { assertValidationError } from './errors/assertValidationError.mjs';\nimport { APIValidationErrorCode } from './errors/validation.mjs';\nimport 'graphql';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst logger = new ConsoleLogger('GraphQLAPI resolveConfig');\n/**\n * @internal\n */\nconst resolveConfig = (amplify) => {\n const config = amplify.getConfig();\n if (!config.API?.GraphQL) {\n logger.warn('The API configuration is missing. This is likely due to Amplify.configure() not being called prior to generateClient().');\n }\n const { apiKey, customEndpoint, customEndpointRegion, defaultAuthMode, endpoint, region, } = config.API?.GraphQL ?? {};\n // TODO: re-enable when working in all test environments:\n // assertValidationError(!!endpoint, APIValidationErrorCode.NoEndpoint);\n assertValidationError(!(!customEndpoint && customEndpointRegion), APIValidationErrorCode.NoCustomEndpoint);\n return {\n apiKey,\n customEndpoint,\n customEndpointRegion,\n defaultAuthMode,\n endpoint,\n region,\n };\n};\n\nexport { resolveConfig };\n//# sourceMappingURL=resolveConfig.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @internal\n */\nconst resolveLibraryOptions = (amplify) => {\n const headers = amplify.libraryOptions?.API?.GraphQL?.headers;\n const withCredentials = amplify.libraryOptions?.API?.GraphQL?.withCredentials;\n return { headers, withCredentials };\n};\n\nexport { resolveLibraryOptions };\n//# sourceMappingURL=resolveLibraryOptions.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Checks to see if the given response or subscription message contains an\n * Unauthorized error. If it does, it changes the error message to include instructions\n * for the app developer.\n */\nfunction repackageUnauthorizedError(content) {\n if (content.errors && Array.isArray(content.errors)) {\n content.errors.forEach(e => {\n if (isUnauthorizedError(e)) {\n e.message = 'Unauthorized';\n e.recoverySuggestion =\n `If you're calling an Amplify-generated API, make sure ` +\n `to set the \"authMode\" in generateClient({ authMode: '...' }) to the backend authorization ` +\n `rule's auth provider ('apiKey', 'userPool', 'iam', 'oidc', 'lambda')`;\n }\n });\n }\n return content;\n}\nfunction isUnauthorizedError(error) {\n // Error pattern corresponding to appsync calls\n if (error?.originalError?.name?.startsWith('UnauthorizedException')) {\n return true;\n }\n // Error pattern corresponding to appsync subscriptions\n if (error.message?.startsWith('Connection failed:') &&\n error.message?.includes('Permission denied')) {\n return true;\n }\n return false;\n}\n\nexport { repackageUnauthorizedError };\n//# sourceMappingURL=repackageAuthError.mjs.map\n","import { GraphQLAuthError } from '../../types/index.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst NO_API_KEY = {\n name: 'NoApiKey',\n // ideal: No API key configured.\n message: GraphQLAuthError.NO_API_KEY,\n recoverySuggestion: 'The API request was made with `authMode: \"apiKey\"` but no API Key was passed into `Amplify.configure()`. Review if your API key is passed into the `Amplify.configure()` function.',\n};\nconst NO_VALID_CREDENTIALS = {\n name: 'NoCredentials',\n // ideal: No auth credentials available.\n message: GraphQLAuthError.NO_CREDENTIALS,\n recoverySuggestion: `The API request was made with \\`authMode: \"iam\"\\` but no authentication credentials are available.\n\nIf you intended to make a request using an authenticated role, review if your user is signed in before making the request.\n\nIf you intend to make a request using an unauthenticated role or also known as \"guest access\", verify if \"Auth.Cognito.allowGuestAccess\" is set to \"true\" in the \\`Amplify.configure()\\` function.`,\n};\nconst NO_VALID_AUTH_TOKEN = {\n name: 'NoValidAuthTokens',\n // ideal: No valid JWT auth token provided to make the API request..\n message: GraphQLAuthError.NO_FEDERATED_JWT,\n recoverySuggestion: 'If you intended to make an authenticated API request, review if the current user is signed in.',\n};\nconst NO_SIGNED_IN_USER = {\n name: 'NoSignedUser',\n // ideal: Couldn't retrieve authentication credentials to make the API request.\n message: GraphQLAuthError.NO_CURRENT_USER,\n recoverySuggestion: 'Review the underlying exception field for more details. If you intended to make an authenticated API request, review if the current user is signed in.',\n};\nconst NO_AUTH_TOKEN_HEADER = {\n name: 'NoAuthorizationHeader',\n // ideal: Authorization header not specified.\n message: GraphQLAuthError.NO_AUTH_TOKEN,\n recoverySuggestion: 'The API request was made with `authMode: \"lambda\"` but no `authToken` is set. Review if a valid authToken is passed into the request options or in the `Amplify.configure()` function.',\n};\nconst NO_ENDPOINT = {\n name: 'NoEndpoint',\n message: 'No GraphQL endpoint configured in `Amplify.configure()`.',\n recoverySuggestion: 'Review if the GraphQL API endpoint is set in the `Amplify.configure()` function.',\n};\n\nexport { NO_API_KEY, NO_AUTH_TOKEN_HEADER, NO_ENDPOINT, NO_SIGNED_IN_USER, NO_VALID_AUTH_TOKEN, NO_VALID_CREDENTIALS };\n//# sourceMappingURL=constants.mjs.map\n","import { GraphQLError } from 'graphql';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst createGraphQLResultWithError = (error) => {\n return {\n data: {},\n errors: [new GraphQLError(error.message, null, null, null, null, error)],\n };\n};\n\nexport { createGraphQLResultWithError };\n//# sourceMappingURL=createGraphQLResultWithError.mjs.map\n","// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nfunction isGraphQLResponseWithErrors(response) {\n if (!response) {\n return false;\n }\n const r = response;\n return Array.isArray(r.errors) && r.errors.length > 0;\n}\n\nexport { isGraphQLResponseWithErrors };\n//# sourceMappingURL=isGraphQLResponseWithErrors.mjs.map\n","import { GraphQLApiError } from '../utils/errors/GraphQLApiError.mjs';\nimport '../utils/errors/validation.mjs';\nimport 'graphql';\nimport { NO_AUTH_TOKEN_HEADER, NO_SIGNED_IN_USER, NO_VALID_AUTH_TOKEN, NO_VALID_CREDENTIALS, NO_API_KEY } from '../utils/errors/constants.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nasync function headerBasedAuth(amplify, authMode, apiKey, additionalHeaders = {}) {\n let headers = {};\n switch (authMode) {\n case 'apiKey':\n if (!apiKey) {\n throw new GraphQLApiError(NO_API_KEY);\n }\n headers = {\n 'X-Api-Key': apiKey,\n };\n break;\n case 'iam': {\n const session = await amplify.Auth.fetchAuthSession();\n if (session.credentials === undefined) {\n throw new GraphQLApiError(NO_VALID_CREDENTIALS);\n }\n break;\n }\n case 'oidc':\n case 'userPool': {\n let token;\n try {\n token = (await amplify.Auth.fetchAuthSession()).tokens?.accessToken.toString();\n }\n catch (e) {\n // fetchAuthSession failed\n throw new GraphQLApiError({\n ...NO_SIGNED_IN_USER,\n underlyingError: e,\n });\n }\n // `fetchAuthSession()` succeeded but didn't return `tokens`.\n // This may happen when unauthenticated access is enabled and there is\n // no user signed in.\n if (!token) {\n throw new GraphQLApiError(NO_VALID_AUTH_TOKEN);\n }\n headers = {\n Authorization: token,\n };\n break;\n }\n case 'lambda':\n if (typeof additionalHeaders === 'object' &&\n !additionalHeaders.Authorization) {\n throw new GraphQLApiError(NO_AUTH_TOKEN_HEADER);\n }\n headers = {\n Authorization: additionalHeaders.Authorization,\n };\n break;\n }\n return headers;\n}\n\nexport { headerBasedAuth };\n//# sourceMappingURL=graphqlAuth.mjs.map\n","import { parse, print } from 'graphql';\nimport { catchError } from 'rxjs';\nimport { AmplifyUrl, getAmplifyUserAgent } from '@aws-amplify/core/internals/utils';\nimport { isCancelError } from '@aws-amplify/api-rest';\nimport { post, cancel, updateRequestToBeCancellable } from '@aws-amplify/api-rest/internals';\nimport { AWSAppSyncRealTimeProvider } from '../Providers/AWSAppSyncRealTimeProvider/index.mjs';\nimport { resolveConfig } from '../utils/resolveConfig.mjs';\nimport { resolveLibraryOptions } from '../utils/resolveLibraryOptions.mjs';\nimport { repackageUnauthorizedError } from '../utils/errors/repackageAuthError.mjs';\nimport { NO_ENDPOINT } from '../utils/errors/constants.mjs';\nimport { GraphQLApiError } from '../utils/errors/GraphQLApiError.mjs';\nimport '../utils/errors/validation.mjs';\nimport { createGraphQLResultWithError } from '../utils/errors/createGraphQLResultWithError.mjs';\nimport { isGraphQLResponseWithErrors } from './utils/runtimeTypeGuards/isGraphQLResponseWithErrors.mjs';\nimport { headerBasedAuth } from './graphqlAuth.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst USER_AGENT_HEADER = 'x-amz-user-agent';\nconst isAmplifyInstance = (amplify) => {\n return typeof amplify !== 'function';\n};\n/**\n * Export Cloud Logic APIs\n */\nclass InternalGraphQLAPIClass {\n constructor() {\n /**\n * @private\n */\n this.appSyncRealTime = new Map();\n this._api = {\n post,\n cancelREST: cancel,\n isCancelErrorREST: isCancelError,\n updateRequestToBeCancellable,\n };\n }\n getModuleName() {\n return 'InternalGraphQLAPI';\n }\n /**\n * to get the operation type\n * @param operation\n */\n getGraphqlOperationType(operation) {\n const doc = parse(operation);\n const definitions = doc.definitions;\n const [{ operation: operationType }] = definitions;\n return operationType;\n }\n /**\n * Executes a GraphQL operation\n *\n * @param options - GraphQL Options\n * @param [additionalHeaders] - headers to merge in after any `libraryConfigHeaders` set in the config\n * @returns An Observable if the query is a subscription query, else a promise of the graphql result.\n */\n graphql(amplify, { query: paramQuery, variables = {}, authMode, authToken, endpoint, apiKey, }, additionalHeaders, customUserAgentDetails) {\n const query = typeof paramQuery === 'string'\n ? parse(paramQuery)\n : parse(print(paramQuery));\n const [operationDef = {}] = query.definitions.filter(def => def.kind === 'OperationDefinition');\n const { operation: operationType } = operationDef;\n const headers = additionalHeaders || {};\n switch (operationType) {\n case 'query':\n case 'mutation': {\n const abortController = new AbortController();\n let responsePromise;\n if (isAmplifyInstance(amplify)) {\n responsePromise = this._graphql(amplify, { query, variables, authMode, apiKey, endpoint }, headers, abortController, customUserAgentDetails, authToken);\n }\n else {\n // NOTE: this wrapper function must be await-able so the Amplify server context manager can\n // destroy the context only after it completes\n const wrapper = async (amplifyInstance) => {\n const result = await this._graphql(amplifyInstance, { query, variables, authMode, apiKey, endpoint }, headers, abortController, customUserAgentDetails, authToken);\n return result;\n };\n responsePromise = amplify(wrapper);\n }\n this._api.updateRequestToBeCancellable(responsePromise, abortController);\n return responsePromise;\n }\n case 'subscription':\n return this._graphqlSubscribe(amplify, { query, variables, authMode, apiKey, endpoint }, headers, customUserAgentDetails, authToken);\n default:\n throw new Error(`invalid operation type: ${operationType}`);\n }\n }\n async _graphql(amplify, { query, variables, authMode: authModeOverride, endpoint: endpointOverride, apiKey: apiKeyOverride, }, additionalHeaders = {}, abortController, customUserAgentDetails, authToken) {\n const { apiKey, region, endpoint: appSyncGraphqlEndpoint, customEndpoint, customEndpointRegion, defaultAuthMode, } = resolveConfig(amplify);\n const initialAuthMode = authModeOverride || defaultAuthMode || 'iam';\n // identityPool is an alias for iam. TODO: remove 'iam' in v7\n const authMode = initialAuthMode === 'identityPool' ? 'iam' : initialAuthMode;\n /**\n * Retrieve library options from Amplify configuration.\n * `customHeaders` here are from the Amplify configuration options,\n * and are for non-AppSync endpoints only. These are *not* the same as\n * `additionalHeaders`, which are custom headers that are either 1)\n * included when configuring the API client or 2) passed along with\n * individual requests.\n */\n const { headers: customHeaders, withCredentials } = resolveLibraryOptions(amplify);\n /**\n * Client or request-specific custom headers that may or may not be\n * returned by a function:\n */\n let additionalCustomHeaders;\n if (typeof additionalHeaders === 'function') {\n const requestOptions = {\n method: 'POST',\n url: new AmplifyUrl(endpointOverride || customEndpoint || appSyncGraphqlEndpoint || '').toString(),\n queryString: print(query),\n };\n additionalCustomHeaders = await additionalHeaders(requestOptions);\n }\n else {\n additionalCustomHeaders = additionalHeaders;\n }\n // if an authorization header is set, have the explicit authToken take precedence\n if (authToken) {\n additionalCustomHeaders = {\n ...additionalCustomHeaders,\n Authorization: authToken,\n };\n }\n const authHeaders = await headerBasedAuth(amplify, authMode, apiKeyOverride ?? apiKey, additionalCustomHeaders);\n const headers = {\n ...(!customEndpoint && authHeaders),\n /**\n * Custom endpoint headers.\n * If there is both a custom endpoint and custom region present, we get the headers.\n * If there is a custom endpoint but no region, we return an empty object.\n * If neither are present, we return an empty object.\n */\n ...((customEndpoint && (customEndpointRegion ? authHeaders : {})) || {}),\n // Custom headers included in Amplify configuration options:\n ...(customHeaders &&\n (await customHeaders({\n query: print(query),\n variables,\n }))),\n // Custom headers from individual requests or API client configuration:\n ...additionalCustomHeaders,\n // User agent headers:\n ...(!customEndpoint && {\n [USER_AGENT_HEADER]: getAmplifyUserAgent(customUserAgentDetails),\n }),\n };\n const body = {\n query: print(query),\n variables: variables || null,\n };\n let signingServiceInfo;\n /**\n * We do not send the signing service info to the REST API under the\n * following conditions (i.e. it will not sign the request):\n * - there is a custom endpoint but no region\n * - the auth mode is `none`, or `apiKey`\n * - the auth mode is a type other than the types listed below\n */\n if ((customEndpoint && !customEndpointRegion) ||\n (authMode !== 'oidc' &&\n authMode !== 'userPool' &&\n authMode !== 'iam' &&\n authMode !== 'lambda')) {\n signingServiceInfo = undefined;\n }\n else {\n signingServiceInfo = {\n service: !customEndpointRegion ? 'appsync' : 'execute-api',\n region: !customEndpointRegion ? region : customEndpointRegion,\n };\n }\n const endpoint = endpointOverride || customEndpoint || appSyncGraphqlEndpoint;\n if (!endpoint) {\n throw createGraphQLResultWithError(new GraphQLApiError(NO_ENDPOINT));\n }\n let response;\n try {\n // \t// // See the inline doc of the REST `post()` API for possible errors to be thrown.\n // \t// // As these errors are catastrophic they should be caught and handled by GraphQL\n // \t// // API consumers.\n const { body: responseBody } = await this._api.post(amplify, {\n url: new AmplifyUrl(endpoint),\n options: {\n headers,\n body,\n signingServiceInfo,\n withCredentials,\n },\n abortController,\n });\n response = await responseBody.json();\n }\n catch (error) {\n if (this.isCancelError(error)) {\n throw error;\n }\n response = createGraphQLResultWithError(error);\n }\n if (isGraphQLResponseWithErrors(response)) {\n throw repackageUnauthorizedError(response);\n }\n return response;\n }\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @return {boolean} - A boolean indicating if the error was from an api request cancellation\n */\n isCancelError(error) {\n return this._api.isCancelErrorREST(error);\n }\n /**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns - A boolean indicating if the request was cancelled\n */\n cancel(request, message) {\n return this._api.cancelREST(request, message);\n }\n _graphqlSubscribe(amplify, { query, variables, authMode: authModeOverride, apiKey: apiKeyOverride, endpoint, }, additionalHeaders = {}, customUserAgentDetails, authToken) {\n const config = resolveConfig(amplify);\n const initialAuthMode = authModeOverride || config?.defaultAuthMode || 'iam';\n // identityPool is an alias for iam. TODO: remove 'iam' in v7\n const authMode = initialAuthMode === 'identityPool' ? 'iam' : initialAuthMode;\n /**\n * Retrieve library options from Amplify configuration.\n * `libraryConfigHeaders` are from the Amplify configuration options,\n * and will not be overwritten by other custom headers. These are *not*\n * the same as `additionalHeaders`, which are custom headers that are\n * either 1)included when configuring the API client or 2) passed along\n * with individual requests.\n */\n const { headers: libraryConfigHeaders } = resolveLibraryOptions(amplify);\n const appSyncGraphqlEndpoint = endpoint ?? config?.endpoint;\n // TODO: This could probably be an exception. But, lots of tests rely on\n // attempting to connect to nowhere. So, I'm treating as the opposite of\n // a Chesterton's fence for now. (A fence I shouldn't build, because I don't\n // know why somethings depends on its absence!)\n const memoKey = appSyncGraphqlEndpoint ?? 'none';\n const realtimeProvider = this.appSyncRealTime.get(memoKey) ?? new AWSAppSyncRealTimeProvider();\n this.appSyncRealTime.set(memoKey, realtimeProvider);\n return realtimeProvider\n .subscribe({\n query: print(query),\n variables,\n appSyncGraphqlEndpoint,\n region: config?.region,\n authenticationType: authMode,\n apiKey: apiKeyOverride ?? config?.apiKey,\n additionalHeaders,\n authToken,\n libraryConfigHeaders,\n }, customUserAgentDetails)\n .pipe(catchError(e => {\n if (e.errors) {\n throw repackageUnauthorizedError(e);\n }\n throw e;\n }));\n }\n}\nconst InternalGraphQLAPI = new InternalGraphQLAPIClass();\n\nexport { InternalGraphQLAPI, InternalGraphQLAPIClass };\n//# sourceMappingURL=InternalGraphQLAPI.mjs.map\n","import { Category, ApiAction } from '@aws-amplify/core/internals/utils';\nimport { INTERNAL_USER_AGENT_OVERRIDE } from '@aws-amplify/data-schema/runtime';\nimport { InternalGraphQLAPIClass } from './internals/InternalGraphQLAPI.mjs';\n\nfunction isGraphQLOptionsWithOverride(options) {\n return INTERNAL_USER_AGENT_OVERRIDE in options;\n}\nconst graphqlOperation = (query, variables = {}, authToken) => ({\n query,\n variables,\n authToken,\n});\n/**\n * Export Cloud Logic APIs\n */\nclass GraphQLAPIClass extends InternalGraphQLAPIClass {\n getModuleName() {\n return 'GraphQLAPI';\n }\n /**\n * Executes a GraphQL operation\n *\n * @param options - GraphQL Options\n * @param [additionalHeaders] - headers to merge in after any `libraryConfigHeaders` set in the config\n * @returns An Observable if the query is a subscription query, else a promise of the graphql result.\n */\n graphql(amplify, options, additionalHeaders) {\n const userAgentDetails = {\n category: Category.API,\n action: ApiAction.GraphQl,\n };\n if (isGraphQLOptionsWithOverride(options)) {\n const { [INTERNAL_USER_AGENT_OVERRIDE]: internalUserAgentOverride, ...cleanOptions } = options;\n return super.graphql(amplify, cleanOptions, additionalHeaders, {\n ...userAgentDetails,\n ...internalUserAgentOverride,\n });\n }\n return super.graphql(amplify, options, additionalHeaders, {\n ...userAgentDetails,\n });\n }\n /**\n * Checks to see if an error thrown is from an api request cancellation\n * @param error - Any error\n * @returns A boolean indicating if the error was from an api request cancellation\n */\n isCancelError(error) {\n return super.isCancelError(error);\n }\n /**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns A boolean indicating if the request was cancelled\n */\n cancel(request, message) {\n return super.cancel(request, message);\n }\n}\nconst GraphQLAPI = new GraphQLAPIClass();\n\nexport { GraphQLAPI, GraphQLAPIClass, graphqlOperation };\n//# sourceMappingURL=GraphQLAPI.mjs.map\n","import { GraphQLAPI } from '../GraphQLAPI.mjs';\nimport { getInternals } from '../types/index.mjs';\n\n/**\n * Invokes graphql operations against a graphql service, providing correct input and\n * output types if Amplify-generated graphql from a recent version of the CLI/codegen\n * are used *or* correct typing is provided via the type argument.\n *\n * Amplify-generated \"branded\" graphql queries will look similar to this:\n *\n * ```ts\n * //\n * // |-- branding\n * // v\n * export const getModel = `...` as GeneratedQuery<\n * \tGetModelQueryVariables,\n * \tGetModelQuery\n * >;\n * ```\n *\n * If this branding is not in your generated graphql, update to a newer version of\n * CLI/codegen and regenerate your graphql using `amplify codegen`.\n *\n * ## Using Amplify-generated graphql\n *\n * ```ts\n * import * as queries from './graphql/queries';\n *\n * //\n * // |-- correctly typed graphql response containing a Widget\n * // v\n * const queryResult = await graphql({\n * \tquery: queries.getWidget,\n * \tvariables: {\n * \t\tid: \"abc\", // <-- type hinted/enforced\n * \t},\n * });\n *\n * //\n * // |-- a correctly typed Widget\n * // v\n * const fetchedWidget = queryResult.data?.getWidget!;\n * ```\n *\n * ## Custom input + result types\n *\n * To provide input types (`variables`) and result types:\n *\n * ```ts\n * type GetById_NameOnly = {\n * \tvariables: {\n * \t\tid: string\n * \t},\n * \tresult: Promise<{\n * \t\tdata: { getWidget: { name: string } }\n * \t}>\n * }\n *\n * //\n * // |-- type is GetById_NameOnly[\"result\"]\n * // v\n * const result = graphql({\n * \tquery: \"...\",\n * \tvariables: { id: \"abc\" } // <-- type of GetById_NameOnly[\"variables\"]\n * });\n * ```\n *\n * ## Custom result type only\n *\n * To specify result types only, use a type that is *not* in the `{variables, result}` shape:\n *\n * ```ts\n * type MyResultType = Promise<{\n * \tdata: {\n * \t\tgetWidget: { name: string }\n * \t}\n * }>\n *\n * //\n * // |-- type is MyResultType\n * // v\n * const result = graphql({query: \"...\"});\n * ```\n *\n * @param options\n * @param additionalHeaders\n */\nfunction graphql(options, additionalHeaders) {\n // inject client-level auth\n const internals = getInternals(this);\n /**\n * The custom `endpoint` specific to the client\n */\n const clientEndpoint = internals.endpoint;\n /**\n * The `authMode` specific to the client.\n */\n const clientAuthMode = internals.authMode;\n /**\n * The `apiKey` specific to the client.\n */\n const clientApiKey = internals.apiKey;\n /**\n * The most specific `authMode` wins. Setting an `endpoint` value without also\n * setting an `authMode` value is invalid. This helps to prevent customers apps\n * from unexpectedly sending auth details to endpoints the auth details do not\n * belong to.\n *\n * This is especially pronounced for `apiKey`. When both an `endpoint` *and*\n * `authMode: 'apiKey'` are provided, an explicit `apiKey` override is required\n * to prevent inadvertent sending of an API's `apiKey` to an endpoint is does\n * not belong to.\n */\n options.authMode = options.authMode || clientAuthMode;\n options.apiKey = options.apiKey ?? clientApiKey;\n options.authToken = options.authToken || internals.authToken;\n if (clientEndpoint && options.authMode === 'apiKey' && !options.apiKey) {\n throw new Error(\"graphql() requires an explicit `apiKey` for a custom `endpoint` when `authMode = 'apiKey'`.\");\n }\n const headers = additionalHeaders || internals.headers;\n /**\n * The correctness of these typings depends on correct string branding or overrides.\n * Neither of these can actually be validated at runtime. Hence, we don't perform\n * any validation or type-guarding here.\n */\n const result = GraphQLAPI.graphql(\n // TODO: move V6Client back into this package?\n internals.amplify, {\n ...options,\n endpoint: clientEndpoint,\n }, headers);\n return result;\n}\n/**\n * Cancels an inflight request. Only applicable for graphql queries and mutations\n * @param {any} request - request to cancel\n * @returns - A boolean indicating if the request was cancelled\n */\nfunction cancel(promise, message) {\n return GraphQLAPI.cancel(promise, message);\n}\n/**\n * Checks to see if an error thrown is from an api request cancellation\n * @param {any} error - Any error\n * @returns - A boolean indicating if the error was from an api request cancellation\n */\nfunction isCancelError(error) {\n return GraphQLAPI.isCancelError(error);\n}\n\nexport { cancel, graphql, isCancelError };\n//# sourceMappingURL=v6.mjs.map\n","import { Hub } from '@aws-amplify/core';\nimport { addSchemaToClient } from '@aws-amplify/data-schema/runtime';\nimport { __amplify, __authMode, __authToken, __apiKey, __endpoint, __headers, getInternals } from '../types/index.mjs';\nimport { isApiGraphQLConfig } from './utils/runtimeTypeGuards/isApiGraphQLProviderConfig.mjs';\nimport { isConfigureEventWithResourceConfig } from './utils/runtimeTypeGuards/isConfigureEventWithResourceConfig.mjs';\nimport { graphql, cancel, isCancelError } from './v6.mjs';\n\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * @private\n *\n * Creates a client that can be used to make GraphQL requests, using a provided `AmplifyClassV6`\n * compatible context object for config and auth fetching.\n *\n * @param params\n * @returns\n */\nfunction generateClient(params) {\n const client = {\n [__amplify]: params.amplify,\n [__authMode]: params.authMode,\n [__authToken]: params.authToken,\n [__apiKey]: 'apiKey' in params ? params.apiKey : undefined,\n [__endpoint]: 'endpoint' in params ? params.endpoint : undefined,\n [__headers]: params.headers,\n graphql,\n cancel,\n isCancelError,\n models: emptyProperty,\n enums: emptyProperty,\n queries: emptyProperty,\n mutations: emptyProperty,\n subscriptions: emptyProperty,\n };\n const apiGraphqlConfig = params.amplify.getConfig().API?.GraphQL;\n if (client[__endpoint]) {\n if (!client[__authMode]) {\n throw new Error('generateClient() requires an explicit `authMode` when `endpoint` is provided.');\n }\n if (client[__authMode] === 'apiKey' && !client[__apiKey]) {\n throw new Error(\"generateClient() requires an explicit `apiKey` when `endpoint` is provided and `authMode = 'apiKey'`.\");\n }\n }\n if (!client[__endpoint]) {\n if (isApiGraphQLConfig(apiGraphqlConfig)) {\n addSchemaToClient(client, apiGraphqlConfig, getInternals);\n }\n else {\n // This happens when the `Amplify.configure()` call gets evaluated after the `generateClient()` call.\n //\n // Cause: when the `generateClient()` and the `Amplify.configure()` calls are located in\n // different source files, script bundlers may randomly arrange their orders in the production\n // bundle.\n //\n // With the current implementation, the `client.models` instance created by `generateClient()`\n // will be rebuilt on every `Amplify.configure()` call that's provided with a valid GraphQL\n // provider configuration.\n //\n // TODO: revisit, and reverify this approach when enabling multiple clients for multi-endpoints\n // configuration.\n generateModelsPropertyOnAmplifyConfigure(client);\n }\n }\n return client;\n}\nconst generateModelsPropertyOnAmplifyConfigure = (clientRef) => {\n Hub.listen('core', coreEvent => {\n if (!isConfigureEventWithResourceConfig(coreEvent.payload)) {\n return;\n }\n const apiGraphQLConfig = coreEvent.payload.data.API?.GraphQL;\n if (isApiGraphQLConfig(apiGraphQLConfig)) {\n addSchemaToClient(clientRef, apiGraphQLConfig, getInternals);\n }\n });\n};\nconst emptyProperty = new Proxy({}, {\n get() {\n throw new Error('Client could not be generated. This is likely due to `Amplify.configure()` not being called prior to `generateClient()` or because the configuration passed to `Amplify.configure()` is missing GraphQL provider configuration.');\n },\n});\n\nexport { generateClient };\n//# sourceMappingURL=generateClient.mjs.map\n","import { generateClient as generateClient$1 } from '@aws-amplify/api-graphql/internals';\nimport { Amplify } from '@aws-amplify/core';\n\n/**\n * Generates an API client that can work with models or raw GraphQL\n *\n * @returns {@link V6Client}\n * @throws {@link Error} - Throws error when client cannot be generated due to configuration issues.\n */\nfunction generateClient(options) {\n return generateClient$1({\n ...(options || {}),\n amplify: Amplify,\n });\n}\n\nexport { generateClient };\n//# sourceMappingURL=API.mjs.map\n"],"names":[],"sourceRoot":"","ignoreList":[0,1,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165]}