1{"version":3,"sources":["webpack:///./node_modules/monaco-editor/esm/vs/language/typescript/languageFeatures.js","webpack:///./node_modules/monaco-editor/esm/vs/language/typescript/lib/lib.index.js","webpack:///./node_modules/monaco-editor/esm/vs/language/typescript/tsMode.js","webpack:///./node_modules/monaco-editor/esm/vs/language/typescript/workerManager.js"],"names":[],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACa;AACb,iBAAiB,SAAI,IAAI,SAAI;AAC7B;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,8EAA8E;AAC3G;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD,iBAAiB,SAAI,IAAI,SAAI;AAC7B,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;AACA,mBAAmB,SAAI,IAAI,SAAI;AAC/B,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;AACgD;AAC2D;AAC3G;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,kCAAkC;AAC5B;AACP,4BAA4B,YAAY;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uBAAuB,YAAY;AACnC;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,gBAAgB;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wDAAwD,yBAAyB,EAAE;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA,CAAC;AACkB;AACnB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,4DAAU;AAC/B;AACA;AACA;AACA;AACA,oBAAoB,qEAAM;AAC1B;AACA;AACA;AACA;AACA,mBAAmB,qEAAM;AACzB;AACA;AACA;AACA;AACA,uCAAuC,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,oCAAoC,wBAAwB,EAAE;AAC9D;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,CAAC;AACmB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,gDAAgD;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,iCAAiC,EAAE;AACpF,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAY,qEAAM;AAClB;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,qEAAM;AACtC,gCAAgC,qEAAM;AACtC,gCAAgC,qEAAM;AACtC;AACA;AACA,SAAS;AACT;AACA;AACA,sCAAsC,qEAAM,aAAa,gBAAgB;AACzE;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,kCAAkC,qEAAM,aAAa,gBAAgB;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ,qEAAM;AACd;AACA;AACA;AACA,gDAAgD,yBAAyB,EAAE;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qDAAqD,oBAAoB,EAAE;AAC3E;AACA;AACA;AACA,yBAAyB;AACzB;AACA,+CAA+C,mCAAmC,EAAE;AACpF,qDAAqD,oBAAoB,EAAE;AAC3E;AACA,6DAA6D,kEAAG;AAChE,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,qEAAM,sEAAsE,4CAA4C,EAAE;AAClJ;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,wEAAS;AAC/B;AACA;AACA,sBAAsB,wEAAS;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,kEAAG;AAC5C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,uBAAuB,6EAAc;AACrC;AACA,uBAAuB,6EAAc;AACrC;AACA,uBAAuB,6EAAc;AACrC;AACA,uBAAuB,6EAAc;AACrC;AACA,eAAe,6EAAc;AAC7B;AACA;AACA,CAAC;AAC6B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wCAAwC,oEAAK;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,oEAAK;AACjD;AACA;AACA;AACA,0CAA0C,wEAAS;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,6BAA6B;AAC7B;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,uBAAuB,wEAAS;AAChC;AACA;AACA,uBAAuB,wEAAS;AAChC;AACA;AACA;AACA,uBAAuB,wEAAS;AAChC;AACA;AACA;AACA;AACA;AACA,uBAAuB,wEAAS;AAChC;AACA,uBAAuB,wEAAS;AAChC;AACA,uBAAuB,wEAAS;AAChC;AACA,uBAAuB,wEAAS;AAChC;AACA,uBAAuB,wEAAS;AAChC;AACA,uBAAuB,wEAAS;AAChC;AACA,eAAe,wEAAS;AACxB;AACA;AACA;AACA;AACA,+CAA+C,gBAAgB;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACyB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA,yBAAyB;AACzB;AACA;AACA,sDAAsD;AACtD,6BAA6B;AAC7B;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AAC+B;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,yBAAyB,EAAE;AACpG;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC;AACrC;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AAC2B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,wEAAS;AACnD,0CAA0C,wEAAS;AACnD;AACA,6BAA6B;AAC7B;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AAC6B;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mHAAmH,QAAQ,kEAAG,uBAAuB,EAAE;AACvJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,uBAAuB;AAChF;AACA,kCAAkC,kEAAG;AACrC;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AAC4B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mHAAmH,QAAQ,kEAAG,uBAAuB,EAAE;AACvJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD,uBAAuB;AAChF;AACA,kCAAkC,kEAAG;AACrC;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AAC2B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,wEAAS;AAC/E;AACA;AACA;AACA;AACA;AACA;AACA,sEAAsE,gBAAgB;AACtF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,8BAA8B,EAAE;AACvF;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AACyB;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACe;AAChB;AACA,gCAAgC,wEAAS;AACzC,+BAA+B,wEAAS;AACxC,8BAA8B,wEAAS;AACvC,mCAAmC,wEAAS;AAC5C,wCAAwC,wEAAS;AACjD,wCAAwC,wEAAS;AACjD,2CAA2C,wEAAS;AACpD,2CAA2C,wEAAS;AACpD,kCAAkC,wEAAS;AAC3C,+BAA+B,wEAAS;AACxC,uCAAuC,wEAAS;AAChD,kCAAkC,wEAAS;AAC3C,kCAAkC,wEAAS;AAC3C,uCAAuC,wEAAS;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACuB;AACxB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,+CAA+C,EAAE;AAC1H;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AACwB;AACzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,KAAK;AAC3B,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,+CAA+C,EAAE;AAC1H;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AAC8B;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA,kDAAkD,eAAe,EAAE;AACnE,+CAA+C,eAAe,EAAE;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mDAAmD,oCAAoC,EAAE,EAAE;AAC3F;AACA;AACA;AACA;AACA,yEAAyE,yBAAyB,EAAE;AACpG,yBAAyB;AACzB;AACA;AACA,yBAAyB;AACzB;AACA;AACA,sDAAsD;AACtD,6BAA6B;AAC7B;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA,8CAA8C,gBAAgB;AAC9D;AACA,qDAAqD,gBAAgB;AACrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA,mBAAmB,eAAe;AAClC;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAC4B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE,+BAA+B;AACxG;AACA;AACA,0CAA0C,kEAAG;AAC7C;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA,+CAA+C,eAAe;AAC9D;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA,CAAC;AACwB;;;;;;;;;;;;;ACjnCzB;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AC7DA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACa;AACsC;AACO;AACE;AAC5D;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACO;AACP;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA,qBAAqB,+DAAa;AAClC;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA,uBAAuB,6DAAyB;AAChD,IAAI,wEAAS,4CAA4C,mEAA+B;AACxF,IAAI,wEAAS,2CAA2C,yEAAqC;AAC7F,IAAI,wEAAS,mCAAmC,qEAAiC;AACjF,IAAI,wEAAS,+CAA+C,uEAAmC;AAC/F,IAAI,wEAAS,wCAAwC,sEAAkC;AACvF,IAAI,wEAAS,uCAAuC,qEAAiC;AACrF,IAAI,wEAAS,4CAA4C,mEAA+B;AACxF,IAAI,wEAAS,yDAAyD,kEAA8B;AACpG,IAAI,wEAAS,kDAAkD,wEAAoC;AACnG,IAAI,wEAAS,wCAAwC,sEAAkC;AACvF,IAAI,wEAAS,oCAAoC,kEAA8B;AAC/E,QAAQ,uEAAmC;AAC3C;AACA;;;;;;;;;;;;;ACvDA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACa;AACb,iBAAiB,SAAI,IAAI,SAAI;AAC7B,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;AACA,mBAAmB,SAAI,IAAI,SAAI;AAC/B,aAAa,6BAA6B,0BAA0B,aAAa,EAAE,qBAAqB;AACxG,gBAAgB,qDAAqD,oEAAoE,aAAa,EAAE;AACxJ,sBAAsB,sBAAsB,qBAAqB,GAAG;AACpE;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC,kCAAkC,SAAS;AAC3C,kCAAkC,WAAW,UAAU;AACvD,yCAAyC,cAAc;AACvD;AACA,6GAA6G,OAAO,UAAU;AAC9H,gFAAgF,iBAAiB,OAAO;AACxG,wDAAwD,gBAAgB,QAAQ,OAAO;AACvF,8CAA8C,gBAAgB,gBAAgB,OAAO;AACrF;AACA,iCAAiC;AACjC;AACA;AACA,SAAS,YAAY,aAAa,OAAO,EAAE,UAAU,WAAW;AAChE,mCAAmC,SAAS;AAC5C;AACA;AACyD;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6EAA6E,4BAA4B,EAAE;AAC3G;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb,SAAS;AACT;AACA;AACA;AACA;AACA,2BAA2B,qEAAM;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA,iEAAiE,qEAAM;AACvE;AACA,sDAAsD,4CAA4C,EAAE;AACpG,mDAAmD,kBAAkB,EAAE;AACvE;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,uBAAuB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA,SAAS;AACT,gCAAgC,gBAAgB,EAAE;AAClD;AACA;AACA,CAAC;AACwB","file":"5.5.js","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { libFileSet } from './lib/lib.index.js';\nimport { editor, languages, Uri, Range, MarkerTag, MarkerSeverity } from './fillers/monaco-editor-core.js';\n//#region utils copied from typescript to prevent loading the entire typescriptServices ---\nvar IndentStyle;\n(function (IndentStyle) {\n IndentStyle[IndentStyle[\"None\"] = 0] = \"None\";\n IndentStyle[IndentStyle[\"Block\"] = 1] = \"Block\";\n IndentStyle[IndentStyle[\"Smart\"] = 2] = \"Smart\";\n})(IndentStyle || (IndentStyle = {}));\nexport function flattenDiagnosticMessageText(diag, newLine, indent) {\n if (indent === void 0) { indent = 0; }\n if (typeof diag === 'string') {\n return diag;\n }\n else if (diag === undefined) {\n return '';\n }\n var result = '';\n if (indent) {\n result += newLine;\n for (var i = 0; i < indent; i++) {\n result += ' ';\n }\n }\n result += diag.messageText;\n indent++;\n if (diag.next) {\n for (var _i = 0, _a = diag.next; _i < _a.length; _i++) {\n var kid = _a[_i];\n result += flattenDiagnosticMessageText(kid, newLine, indent);\n }\n }\n return result;\n}\nfunction displayPartsToString(displayParts) {\n if (displayParts) {\n return displayParts.map(function (displayPart) { return displayPart.text; }).join('');\n }\n return '';\n}\n//#endregion\nvar Adapter = /** @class */ (function () {\n function Adapter(_worker) {\n this._worker = _worker;\n }\n // protected _positionToOffset(model: editor.ITextModel, position: monaco.IPosition): number {\n // \treturn model.getOffsetAt(position);\n // }\n // protected _offsetToPosition(model: editor.ITextModel, offset: number): monaco.IPosition {\n // \treturn model.getPositionAt(offset);\n // }\n Adapter.prototype._textSpanToRange = function (model, span) {\n var p1 = model.getPositionAt(span.start);\n var p2 = model.getPositionAt(span.start + span.length);\n var startLineNumber = p1.lineNumber, startColumn = p1.column;\n var endLineNumber = p2.lineNumber, endColumn = p2.column;\n return { startLineNumber: startLineNumber, startColumn: startColumn, endLineNumber: endLineNumber, endColumn: endColumn };\n };\n return Adapter;\n}());\nexport { Adapter };\n// --- lib files\nvar LibFiles = /** @class */ (function () {\n function LibFiles(_worker) {\n this._worker = _worker;\n this._libFiles = {};\n this._hasFetchedLibFiles = false;\n this._fetchLibFilesPromise = null;\n }\n LibFiles.prototype.isLibFile = function (uri) {\n if (!uri) {\n return false;\n }\n if (uri.path.indexOf('/lib.') === 0) {\n return !!libFileSet[uri.path.slice(1)];\n }\n return false;\n };\n LibFiles.prototype.getOrCreateModel = function (uri) {\n var model = editor.getModel(uri);\n if (model) {\n return model;\n }\n if (this.isLibFile(uri) && this._hasFetchedLibFiles) {\n return editor.createModel(this._libFiles[uri.path.slice(1)], 'javascript', uri);\n }\n return null;\n };\n LibFiles.prototype._containsLibFile = function (uris) {\n for (var _i = 0, uris_1 = uris; _i < uris_1.length; _i++) {\n var uri = uris_1[_i];\n if (this.isLibFile(uri)) {\n return true;\n }\n }\n return false;\n };\n LibFiles.prototype.fetchLibFilesIfNecessary = function (uris) {\n return __awaiter(this, void 0, void 0, function () {\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this._containsLibFile(uris)) {\n // no lib files necessary\n return [2 /*return*/];\n }\n return [4 /*yield*/, this._fetchLibFiles()];\n case 1:\n _a.sent();\n return [2 /*return*/];\n }\n });\n });\n };\n LibFiles.prototype._fetchLibFiles = function () {\n var _this = this;\n if (!this._fetchLibFilesPromise) {\n this._fetchLibFilesPromise = this._worker()\n .then(function (w) { return w.getLibFiles(); })\n .then(function (libFiles) {\n _this._hasFetchedLibFiles = true;\n _this._libFiles = libFiles;\n });\n }\n return this._fetchLibFilesPromise;\n };\n return LibFiles;\n}());\nexport { LibFiles };\n// --- diagnostics --- ---\nvar DiagnosticCategory;\n(function (DiagnosticCategory) {\n DiagnosticCategory[DiagnosticCategory[\"Warning\"] = 0] = \"Warning\";\n DiagnosticCategory[DiagnosticCategory[\"Error\"] = 1] = \"Error\";\n DiagnosticCategory[DiagnosticCategory[\"Suggestion\"] = 2] = \"Suggestion\";\n DiagnosticCategory[DiagnosticCategory[\"Message\"] = 3] = \"Message\";\n})(DiagnosticCategory || (DiagnosticCategory = {}));\nvar DiagnosticsAdapter = /** @class */ (function (_super) {\n __extends(DiagnosticsAdapter, _super);\n function DiagnosticsAdapter(_libFiles, _defaults, _selector, worker) {\n var _this = _super.call(this, worker) || this;\n _this._libFiles = _libFiles;\n _this._defaults = _defaults;\n _this._selector = _selector;\n _this._disposables = [];\n _this._listener = Object.create(null);\n var onModelAdd = function (model) {\n if (model.getModeId() !== _selector) {\n return;\n }\n var handle;\n var changeSubscription = model.onDidChangeContent(function () {\n clearTimeout(handle);\n handle = setTimeout(function () { return _this._doValidate(model); }, 500);\n });\n _this._listener[model.uri.toString()] = {\n dispose: function () {\n changeSubscription.dispose();\n clearTimeout(handle);\n }\n };\n _this._doValidate(model);\n };\n var onModelRemoved = function (model) {\n editor.setModelMarkers(model, _this._selector, []);\n var key = model.uri.toString();\n if (_this._listener[key]) {\n _this._listener[key].dispose();\n delete _this._listener[key];\n }\n };\n _this._disposables.push(editor.onDidCreateModel(onModelAdd));\n _this._disposables.push(editor.onWillDisposeModel(onModelRemoved));\n _this._disposables.push(editor.onDidChangeModelLanguage(function (event) {\n onModelRemoved(event.model);\n onModelAdd(event.model);\n }));\n _this._disposables.push({\n dispose: function () {\n for (var _i = 0, _a = editor.getModels(); _i < _a.length; _i++) {\n var model = _a[_i];\n onModelRemoved(model);\n }\n }\n });\n var recomputeDiagostics = function () {\n // redo diagnostics when options change\n for (var _i = 0, _a = editor.getModels(); _i < _a.length; _i++) {\n var model = _a[_i];\n onModelRemoved(model);\n onModelAdd(model);\n }\n };\n _this._disposables.push(_this._defaults.onDidChange(recomputeDiagostics));\n _this._disposables.push(_this._defaults.onDidExtraLibsChange(recomputeDiagostics));\n editor.getModels().forEach(onModelAdd);\n return _this;\n }\n DiagnosticsAdapter.prototype.dispose = function () {\n this._disposables.forEach(function (d) { return d && d.dispose(); });\n this._disposables = [];\n };\n DiagnosticsAdapter.prototype._doValidate = function (model) {\n return __awaiter(this, void 0, void 0, function () {\n var worker, promises, _a, noSyntaxValidation, noSemanticValidation, noSuggestionDiagnostics, allDiagnostics, diagnostics, relatedUris;\n var _this = this;\n return __generator(this, function (_b) {\n switch (_b.label) {\n case 0: return [4 /*yield*/, this._worker(model.uri)];\n case 1:\n worker = _b.sent();\n if (model.isDisposed()) {\n // model was disposed in the meantime\n return [2 /*return*/];\n }\n promises = [];\n _a = this._defaults.getDiagnosticsOptions(), noSyntaxValidation = _a.noSyntaxValidation, noSemanticValidation = _a.noSemanticValidation, noSuggestionDiagnostics = _a.noSuggestionDiagnostics;\n if (!noSyntaxValidation) {\n promises.push(worker.getSyntacticDiagnostics(model.uri.toString()));\n }\n if (!noSemanticValidation) {\n promises.push(worker.getSemanticDiagnostics(model.uri.toString()));\n }\n if (!noSuggestionDiagnostics) {\n promises.push(worker.getSuggestionDiagnostics(model.uri.toString()));\n }\n return [4 /*yield*/, Promise.all(promises)];\n case 2:\n allDiagnostics = _b.sent();\n if (!allDiagnostics || model.isDisposed()) {\n // model was disposed in the meantime\n return [2 /*return*/];\n }\n diagnostics = allDiagnostics\n .reduce(function (p, c) { return c.concat(p); }, [])\n .filter(function (d) {\n return (_this._defaults.getDiagnosticsOptions().diagnosticCodesToIgnore || []).indexOf(d.code) ===\n -1;\n });\n relatedUris = diagnostics\n .map(function (d) { return d.relatedInformation || []; })\n .reduce(function (p, c) { return c.concat(p); }, [])\n .map(function (relatedInformation) {\n return relatedInformation.file ? Uri.parse(relatedInformation.file.fileName) : null;\n });\n return [4 /*yield*/, this._libFiles.fetchLibFilesIfNecessary(relatedUris)];\n case 3:\n _b.sent();\n if (model.isDisposed()) {\n // model was disposed in the meantime\n return [2 /*return*/];\n }\n editor.setModelMarkers(model, this._selector, diagnostics.map(function (d) { return _this._convertDiagnostics(model, d); }));\n return [2 /*return*/];\n }\n });\n });\n };\n DiagnosticsAdapter.prototype._convertDiagnostics = function (model, diag) {\n var diagStart = diag.start || 0;\n var diagLength = diag.length || 1;\n var _a = model.getPositionAt(diagStart), startLineNumber = _a.lineNumber, startColumn = _a.column;\n var _b = model.getPositionAt(diagStart + diagLength), endLineNumber = _b.lineNumber, endColumn = _b.column;\n var tags = [];\n if (diag.reportsUnnecessary) {\n tags.push(MarkerTag.Unnecessary);\n }\n if (diag.reportsDeprecated) {\n tags.push(MarkerTag.Deprecated);\n }\n return {\n severity: this._tsDiagnosticCategoryToMarkerSeverity(diag.category),\n startLineNumber: startLineNumber,\n startColumn: startColumn,\n endLineNumber: endLineNumber,\n endColumn: endColumn,\n message: flattenDiagnosticMessageText(diag.messageText, '\\n'),\n code: diag.code.toString(),\n tags: tags,\n relatedInformation: this._convertRelatedInformation(model, diag.relatedInformation)\n };\n };\n DiagnosticsAdapter.prototype._convertRelatedInformation = function (model, relatedInformation) {\n var _this = this;\n if (!relatedInformation) {\n return;\n }\n var result = [];\n relatedInformation.forEach(function (info) {\n var relatedResource = model;\n if (info.file) {\n var relatedResourceUri = Uri.parse(info.file.fileName);\n relatedResource = _this._libFiles.getOrCreateModel(relatedResourceUri);\n }\n if (!relatedResource) {\n return;\n }\n var infoStart = info.start || 0;\n var infoLength = info.length || 1;\n var _a = relatedResource.getPositionAt(infoStart), startLineNumber = _a.lineNumber, startColumn = _a.column;\n var _b = relatedResource.getPositionAt(infoStart + infoLength), endLineNumber = _b.lineNumber, endColumn = _b.column;\n result.push({\n resource: relatedResource.uri,\n startLineNumber: startLineNumber,\n startColumn: startColumn,\n endLineNumber: endLineNumber,\n endColumn: endColumn,\n message: flattenDiagnosticMessageText(info.messageText, '\\n')\n });\n });\n return result;\n };\n DiagnosticsAdapter.prototype._tsDiagnosticCategoryToMarkerSeverity = function (category) {\n switch (category) {\n case DiagnosticCategory.Error:\n return MarkerSeverity.Error;\n case DiagnosticCategory.Message:\n return MarkerSeverity.Info;\n case DiagnosticCategory.Warning:\n return MarkerSeverity.Warning;\n case DiagnosticCategory.Suggestion:\n return MarkerSeverity.Hint;\n }\n return MarkerSeverity.Info;\n };\n return DiagnosticsAdapter;\n}(Adapter));\nexport { DiagnosticsAdapter };\nvar SuggestAdapter = /** @class */ (function (_super) {\n __extends(SuggestAdapter, _super);\n function SuggestAdapter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(SuggestAdapter.prototype, \"triggerCharacters\", {\n get: function () {\n return ['.'];\n },\n enumerable: false,\n configurable: true\n });\n SuggestAdapter.prototype.provideCompletionItems = function (model, position, _context, token) {\n return __awaiter(this, void 0, void 0, function () {\n var wordInfo, wordRange, resource, offset, worker, info, suggestions;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n wordInfo = model.getWordUntilPosition(position);\n wordRange = new Range(position.lineNumber, wordInfo.startColumn, position.lineNumber, wordInfo.endColumn);\n resource = model.uri;\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getCompletionsAtPosition(resource.toString(), offset)];\n case 2:\n info = _a.sent();\n if (!info || model.isDisposed()) {\n return [2 /*return*/];\n }\n suggestions = info.entries.map(function (entry) {\n var _a;\n var range = wordRange;\n if (entry.replacementSpan) {\n var p1 = model.getPositionAt(entry.replacementSpan.start);\n var p2 = model.getPositionAt(entry.replacementSpan.start + entry.replacementSpan.length);\n range = new Range(p1.lineNumber, p1.column, p2.lineNumber, p2.column);\n }\n var tags = [];\n if (((_a = entry.kindModifiers) === null || _a === void 0 ? void 0 : _a.indexOf('deprecated')) !== -1) {\n tags.push(languages.CompletionItemTag.Deprecated);\n }\n return {\n uri: resource,\n position: position,\n offset: offset,\n range: range,\n label: entry.name,\n insertText: entry.name,\n sortText: entry.sortText,\n kind: SuggestAdapter.convertKind(entry.kind),\n tags: tags\n };\n });\n return [2 /*return*/, {\n suggestions: suggestions\n }];\n }\n });\n });\n };\n SuggestAdapter.prototype.resolveCompletionItem = function (item, token) {\n return __awaiter(this, void 0, void 0, function () {\n var myItem, resource, position, offset, worker, details;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n myItem = item;\n resource = myItem.uri;\n position = myItem.position;\n offset = myItem.offset;\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getCompletionEntryDetails(resource.toString(), offset, myItem.label)];\n case 2:\n details = _a.sent();\n if (!details) {\n return [2 /*return*/, myItem];\n }\n return [2 /*return*/, {\n uri: resource,\n position: position,\n label: details.name,\n kind: SuggestAdapter.convertKind(details.kind),\n detail: displayPartsToString(details.displayParts),\n documentation: {\n value: SuggestAdapter.createDocumentationString(details)\n }\n }];\n }\n });\n });\n };\n SuggestAdapter.convertKind = function (kind) {\n switch (kind) {\n case Kind.primitiveType:\n case Kind.keyword:\n return languages.CompletionItemKind.Keyword;\n case Kind.variable:\n case Kind.localVariable:\n return languages.CompletionItemKind.Variable;\n case Kind.memberVariable:\n case Kind.memberGetAccessor:\n case Kind.memberSetAccessor:\n return languages.CompletionItemKind.Field;\n case Kind.function:\n case Kind.memberFunction:\n case Kind.constructSignature:\n case Kind.callSignature:\n case Kind.indexSignature:\n return languages.CompletionItemKind.Function;\n case Kind.enum:\n return languages.CompletionItemKind.Enum;\n case Kind.module:\n return languages.CompletionItemKind.Module;\n case Kind.class:\n return languages.CompletionItemKind.Class;\n case Kind.interface:\n return languages.CompletionItemKind.Interface;\n case Kind.warning:\n return languages.CompletionItemKind.File;\n }\n return languages.CompletionItemKind.Property;\n };\n SuggestAdapter.createDocumentationString = function (details) {\n var documentationString = displayPartsToString(details.documentation);\n if (details.tags) {\n for (var _i = 0, _a = details.tags; _i < _a.length; _i++) {\n var tag = _a[_i];\n documentationString += \"\\n\\n\" + tagToString(tag);\n }\n }\n return documentationString;\n };\n return SuggestAdapter;\n}(Adapter));\nexport { SuggestAdapter };\nfunction tagToString(tag) {\n var tagLabel = \"*@\" + tag.name + \"*\";\n if (tag.name === 'param' && tag.text) {\n var _a = tag.text.split(' '), paramName = _a[0], rest = _a.slice(1);\n tagLabel += \"`\" + paramName + \"`\";\n if (rest.length > 0)\n tagLabel += \" \\u2014 \" + rest.join(' ');\n }\n else if (tag.text) {\n tagLabel += \" \\u2014 \" + tag.text;\n }\n return tagLabel;\n}\nvar SignatureHelpAdapter = /** @class */ (function (_super) {\n __extends(SignatureHelpAdapter, _super);\n function SignatureHelpAdapter() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.signatureHelpTriggerCharacters = ['(', ','];\n return _this;\n }\n SignatureHelpAdapter.prototype.provideSignatureHelp = function (model, position, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, offset, worker, info, ret;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getSignatureHelpItems(resource.toString(), offset)];\n case 2:\n info = _a.sent();\n if (!info || model.isDisposed()) {\n return [2 /*return*/];\n }\n ret = {\n activeSignature: info.selectedItemIndex,\n activeParameter: info.argumentIndex,\n signatures: []\n };\n info.items.forEach(function (item) {\n var signature = {\n label: '',\n parameters: []\n };\n signature.documentation = {\n value: displayPartsToString(item.documentation)\n };\n signature.label += displayPartsToString(item.prefixDisplayParts);\n item.parameters.forEach(function (p, i, a) {\n var label = displayPartsToString(p.displayParts);\n var parameter = {\n label: label,\n documentation: {\n value: displayPartsToString(p.documentation)\n }\n };\n signature.label += label;\n signature.parameters.push(parameter);\n if (i < a.length - 1) {\n signature.label += displayPartsToString(item.separatorDisplayParts);\n }\n });\n signature.label += displayPartsToString(item.suffixDisplayParts);\n ret.signatures.push(signature);\n });\n return [2 /*return*/, {\n value: ret,\n dispose: function () { }\n }];\n }\n });\n });\n };\n return SignatureHelpAdapter;\n}(Adapter));\nexport { SignatureHelpAdapter };\n// --- hover ------\nvar QuickInfoAdapter = /** @class */ (function (_super) {\n __extends(QuickInfoAdapter, _super);\n function QuickInfoAdapter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n QuickInfoAdapter.prototype.provideHover = function (model, position, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, offset, worker, info, documentation, tags, contents;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getQuickInfoAtPosition(resource.toString(), offset)];\n case 2:\n info = _a.sent();\n if (!info || model.isDisposed()) {\n return [2 /*return*/];\n }\n documentation = displayPartsToString(info.documentation);\n tags = info.tags ? info.tags.map(function (tag) { return tagToString(tag); }).join(' \\n\\n') : '';\n contents = displayPartsToString(info.displayParts);\n return [2 /*return*/, {\n range: this._textSpanToRange(model, info.textSpan),\n contents: [\n {\n value: '```typescript\\n' + contents + '\\n```\\n'\n },\n {\n value: documentation + (tags ? '\\n\\n' + tags : '')\n }\n ]\n }];\n }\n });\n });\n };\n return QuickInfoAdapter;\n}(Adapter));\nexport { QuickInfoAdapter };\n// --- occurrences ------\nvar OccurrencesAdapter = /** @class */ (function (_super) {\n __extends(OccurrencesAdapter, _super);\n function OccurrencesAdapter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n OccurrencesAdapter.prototype.provideDocumentHighlights = function (model, position, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, offset, worker, entries;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getOccurrencesAtPosition(resource.toString(), offset)];\n case 2:\n entries = _a.sent();\n if (!entries || model.isDisposed()) {\n return [2 /*return*/];\n }\n return [2 /*return*/, entries.map(function (entry) {\n return {\n range: _this._textSpanToRange(model, entry.textSpan),\n kind: entry.isWriteAccess\n ? languages.DocumentHighlightKind.Write\n : languages.DocumentHighlightKind.Text\n };\n })];\n }\n });\n });\n };\n return OccurrencesAdapter;\n}(Adapter));\nexport { OccurrencesAdapter };\n// --- definition ------\nvar DefinitionAdapter = /** @class */ (function (_super) {\n __extends(DefinitionAdapter, _super);\n function DefinitionAdapter(_libFiles, worker) {\n var _this = _super.call(this, worker) || this;\n _this._libFiles = _libFiles;\n return _this;\n }\n DefinitionAdapter.prototype.provideDefinition = function (model, position, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, offset, worker, entries, result, _i, entries_1, entry, uri, refModel;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getDefinitionAtPosition(resource.toString(), offset)];\n case 2:\n entries = _a.sent();\n if (!entries || model.isDisposed()) {\n return [2 /*return*/];\n }\n // Fetch lib files if necessary\n return [4 /*yield*/, this._libFiles.fetchLibFilesIfNecessary(entries.map(function (entry) { return Uri.parse(entry.fileName); }))];\n case 3:\n // Fetch lib files if necessary\n _a.sent();\n if (model.isDisposed()) {\n return [2 /*return*/];\n }\n result = [];\n for (_i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n entry = entries_1[_i];\n uri = Uri.parse(entry.fileName);\n refModel = this._libFiles.getOrCreateModel(uri);\n if (refModel) {\n result.push({\n uri: uri,\n range: this._textSpanToRange(refModel, entry.textSpan)\n });\n }\n }\n return [2 /*return*/, result];\n }\n });\n });\n };\n return DefinitionAdapter;\n}(Adapter));\nexport { DefinitionAdapter };\n// --- references ------\nvar ReferenceAdapter = /** @class */ (function (_super) {\n __extends(ReferenceAdapter, _super);\n function ReferenceAdapter(_libFiles, worker) {\n var _this = _super.call(this, worker) || this;\n _this._libFiles = _libFiles;\n return _this;\n }\n ReferenceAdapter.prototype.provideReferences = function (model, position, context, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, offset, worker, entries, result, _i, entries_2, entry, uri, refModel;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getReferencesAtPosition(resource.toString(), offset)];\n case 2:\n entries = _a.sent();\n if (!entries || model.isDisposed()) {\n return [2 /*return*/];\n }\n // Fetch lib files if necessary\n return [4 /*yield*/, this._libFiles.fetchLibFilesIfNecessary(entries.map(function (entry) { return Uri.parse(entry.fileName); }))];\n case 3:\n // Fetch lib files if necessary\n _a.sent();\n if (model.isDisposed()) {\n return [2 /*return*/];\n }\n result = [];\n for (_i = 0, entries_2 = entries; _i < entries_2.length; _i++) {\n entry = entries_2[_i];\n uri = Uri.parse(entry.fileName);\n refModel = this._libFiles.getOrCreateModel(uri);\n if (refModel) {\n result.push({\n uri: uri,\n range: this._textSpanToRange(refModel, entry.textSpan)\n });\n }\n }\n return [2 /*return*/, result];\n }\n });\n });\n };\n return ReferenceAdapter;\n}(Adapter));\nexport { ReferenceAdapter };\n// --- outline ------\nvar OutlineAdapter = /** @class */ (function (_super) {\n __extends(OutlineAdapter, _super);\n function OutlineAdapter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n OutlineAdapter.prototype.provideDocumentSymbols = function (model, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, worker, items, convert, result;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getNavigationBarItems(resource.toString())];\n case 2:\n items = _a.sent();\n if (!items || model.isDisposed()) {\n return [2 /*return*/];\n }\n convert = function (bucket, item, containerLabel) {\n var result = {\n name: item.text,\n detail: '',\n kind: (outlineTypeTable[item.kind] || languages.SymbolKind.Variable),\n range: _this._textSpanToRange(model, item.spans[0]),\n selectionRange: _this._textSpanToRange(model, item.spans[0]),\n tags: [],\n containerName: containerLabel\n };\n if (item.childItems && item.childItems.length > 0) {\n for (var _i = 0, _a = item.childItems; _i < _a.length; _i++) {\n var child = _a[_i];\n convert(bucket, child, result.name);\n }\n }\n bucket.push(result);\n };\n result = [];\n items.forEach(function (item) { return convert(result, item); });\n return [2 /*return*/, result];\n }\n });\n });\n };\n return OutlineAdapter;\n}(Adapter));\nexport { OutlineAdapter };\nvar Kind = /** @class */ (function () {\n function Kind() {\n }\n Kind.unknown = '';\n Kind.keyword = 'keyword';\n Kind.script = 'script';\n Kind.module = 'module';\n Kind.class = 'class';\n Kind.interface = 'interface';\n Kind.type = 'type';\n Kind.enum = 'enum';\n Kind.variable = 'var';\n Kind.localVariable = 'local var';\n Kind.function = 'function';\n Kind.localFunction = 'local function';\n Kind.memberFunction = 'method';\n Kind.memberGetAccessor = 'getter';\n Kind.memberSetAccessor = 'setter';\n Kind.memberVariable = 'property';\n Kind.constructorImplementation = 'constructor';\n Kind.callSignature = 'call';\n Kind.indexSignature = 'index';\n Kind.constructSignature = 'construct';\n Kind.parameter = 'parameter';\n Kind.typeParameter = 'type parameter';\n Kind.primitiveType = 'primitive type';\n Kind.label = 'label';\n Kind.alias = 'alias';\n Kind.const = 'const';\n Kind.let = 'let';\n Kind.warning = 'warning';\n return Kind;\n}());\nexport { Kind };\nvar outlineTypeTable = Object.create(null);\noutlineTypeTable[Kind.module] = languages.SymbolKind.Module;\noutlineTypeTable[Kind.class] = languages.SymbolKind.Class;\noutlineTypeTable[Kind.enum] = languages.SymbolKind.Enum;\noutlineTypeTable[Kind.interface] = languages.SymbolKind.Interface;\noutlineTypeTable[Kind.memberFunction] = languages.SymbolKind.Method;\noutlineTypeTable[Kind.memberVariable] = languages.SymbolKind.Property;\noutlineTypeTable[Kind.memberGetAccessor] = languages.SymbolKind.Property;\noutlineTypeTable[Kind.memberSetAccessor] = languages.SymbolKind.Property;\noutlineTypeTable[Kind.variable] = languages.SymbolKind.Variable;\noutlineTypeTable[Kind.const] = languages.SymbolKind.Variable;\noutlineTypeTable[Kind.localVariable] = languages.SymbolKind.Variable;\noutlineTypeTable[Kind.variable] = languages.SymbolKind.Variable;\noutlineTypeTable[Kind.function] = languages.SymbolKind.Function;\noutlineTypeTable[Kind.localFunction] = languages.SymbolKind.Function;\n// --- formatting ----\nvar FormatHelper = /** @class */ (function (_super) {\n __extends(FormatHelper, _super);\n function FormatHelper() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FormatHelper._convertOptions = function (options) {\n return {\n ConvertTabsToSpaces: options.insertSpaces,\n TabSize: options.tabSize,\n IndentSize: options.tabSize,\n IndentStyle: IndentStyle.Smart,\n NewLineCharacter: '\\n',\n InsertSpaceAfterCommaDelimiter: true,\n InsertSpaceAfterSemicolonInForStatements: true,\n InsertSpaceBeforeAndAfterBinaryOperators: true,\n InsertSpaceAfterKeywordsInControlFlowStatements: true,\n InsertSpaceAfterFunctionKeywordForAnonymousFunctions: true,\n InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false,\n InsertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets: false,\n InsertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces: false,\n PlaceOpenBraceOnNewLineForControlBlocks: false,\n PlaceOpenBraceOnNewLineForFunctions: false\n };\n };\n FormatHelper.prototype._convertTextChanges = function (model, change) {\n return {\n text: change.newText,\n range: this._textSpanToRange(model, change.span)\n };\n };\n return FormatHelper;\n}(Adapter));\nexport { FormatHelper };\nvar FormatAdapter = /** @class */ (function (_super) {\n __extends(FormatAdapter, _super);\n function FormatAdapter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FormatAdapter.prototype.provideDocumentRangeFormattingEdits = function (model, range, options, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, startOffset, endOffset, worker, edits;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n startOffset = model.getOffsetAt({\n lineNumber: range.startLineNumber,\n column: range.startColumn\n });\n endOffset = model.getOffsetAt({\n lineNumber: range.endLineNumber,\n column: range.endColumn\n });\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getFormattingEditsForRange(resource.toString(), startOffset, endOffset, FormatHelper._convertOptions(options))];\n case 2:\n edits = _a.sent();\n if (!edits || model.isDisposed()) {\n return [2 /*return*/];\n }\n return [2 /*return*/, edits.map(function (edit) { return _this._convertTextChanges(model, edit); })];\n }\n });\n });\n };\n return FormatAdapter;\n}(FormatHelper));\nexport { FormatAdapter };\nvar FormatOnTypeAdapter = /** @class */ (function (_super) {\n __extends(FormatOnTypeAdapter, _super);\n function FormatOnTypeAdapter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(FormatOnTypeAdapter.prototype, \"autoFormatTriggerCharacters\", {\n get: function () {\n return [';', '}', '\\n'];\n },\n enumerable: false,\n configurable: true\n });\n FormatOnTypeAdapter.prototype.provideOnTypeFormattingEdits = function (model, position, ch, options, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, offset, worker, edits;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getFormattingEditsAfterKeystroke(resource.toString(), offset, ch, FormatHelper._convertOptions(options))];\n case 2:\n edits = _a.sent();\n if (!edits || model.isDisposed()) {\n return [2 /*return*/];\n }\n return [2 /*return*/, edits.map(function (edit) { return _this._convertTextChanges(model, edit); })];\n }\n });\n });\n };\n return FormatOnTypeAdapter;\n}(FormatHelper));\nexport { FormatOnTypeAdapter };\n// --- code actions ------\nvar CodeActionAdaptor = /** @class */ (function (_super) {\n __extends(CodeActionAdaptor, _super);\n function CodeActionAdaptor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CodeActionAdaptor.prototype.provideCodeActions = function (model, range, context, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, start, end, formatOptions, errorCodes, worker, codeFixes, actions;\n var _this = this;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n start = model.getOffsetAt({\n lineNumber: range.startLineNumber,\n column: range.startColumn\n });\n end = model.getOffsetAt({\n lineNumber: range.endLineNumber,\n column: range.endColumn\n });\n formatOptions = FormatHelper._convertOptions(model.getOptions());\n errorCodes = context.markers\n .filter(function (m) { return m.code; })\n .map(function (m) { return m.code; })\n .map(Number);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getCodeFixesAtPosition(resource.toString(), start, end, errorCodes, formatOptions)];\n case 2:\n codeFixes = _a.sent();\n if (!codeFixes || model.isDisposed()) {\n return [2 /*return*/, { actions: [], dispose: function () { } }];\n }\n actions = codeFixes\n .filter(function (fix) {\n // Removes any 'make a new file'-type code fix\n return fix.changes.filter(function (change) { return change.isNewFile; }).length === 0;\n })\n .map(function (fix) {\n return _this._tsCodeFixActionToMonacoCodeAction(model, context, fix);\n });\n return [2 /*return*/, {\n actions: actions,\n dispose: function () { }\n }];\n }\n });\n });\n };\n CodeActionAdaptor.prototype._tsCodeFixActionToMonacoCodeAction = function (model, context, codeFix) {\n var edits = [];\n for (var _i = 0, _a = codeFix.changes; _i < _a.length; _i++) {\n var change = _a[_i];\n for (var _b = 0, _c = change.textChanges; _b < _c.length; _b++) {\n var textChange = _c[_b];\n edits.push({\n resource: model.uri,\n edit: {\n range: this._textSpanToRange(model, textChange.span),\n text: textChange.newText\n }\n });\n }\n }\n var action = {\n title: codeFix.description,\n edit: { edits: edits },\n diagnostics: context.markers,\n kind: 'quickfix'\n };\n return action;\n };\n return CodeActionAdaptor;\n}(FormatHelper));\nexport { CodeActionAdaptor };\n// --- rename ----\nvar RenameAdapter = /** @class */ (function (_super) {\n __extends(RenameAdapter, _super);\n function RenameAdapter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RenameAdapter.prototype.provideRenameEdits = function (model, position, newName, token) {\n return __awaiter(this, void 0, void 0, function () {\n var resource, fileName, offset, worker, renameInfo, renameLocations, edits, _i, renameLocations_1, renameLocation;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n resource = model.uri;\n fileName = resource.toString();\n offset = model.getOffsetAt(position);\n return [4 /*yield*/, this._worker(resource)];\n case 1:\n worker = _a.sent();\n return [4 /*yield*/, worker.getRenameInfo(fileName, offset, {\n allowRenameOfImportPath: false\n })];\n case 2:\n renameInfo = _a.sent();\n if (renameInfo.canRename === false) {\n // use explicit comparison so that the discriminated union gets resolved properly\n return [2 /*return*/, {\n edits: [],\n rejectReason: renameInfo.localizedErrorMessage\n }];\n }\n if (renameInfo.fileToRename !== undefined) {\n throw new Error('Renaming files is not supported.');\n }\n return [4 /*yield*/, worker.findRenameLocations(fileName, offset, \n /*strings*/ false, \n /*comments*/ false, \n /*prefixAndSuffix*/ false)];\n case 3:\n renameLocations = _a.sent();\n if (!renameLocations || model.isDisposed()) {\n return [2 /*return*/];\n }\n edits = [];\n for (_i = 0, renameLocations_1 = renameLocations; _i < renameLocations_1.length; _i++) {\n renameLocation = renameLocations_1[_i];\n edits.push({\n resource: Uri.parse(renameLocation.fileName),\n edit: {\n range: this._textSpanToRange(model, renameLocation.textSpan),\n text: newName\n }\n });\n }\n return [2 /*return*/, { edits: edits }];\n }\n });\n });\n };\n return RenameAdapter;\n}(Adapter));\nexport { RenameAdapter };\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n//\n// **NOTE**: Do not edit directly! This file is generated using `npm run import-typescript`\n//\n/** Contains all the lib files */\nexport var libFileSet = {};\nlibFileSet['lib.d.ts'] = true;\nlibFileSet['lib.dom.d.ts'] = true;\nlibFileSet['lib.dom.iterable.d.ts'] = true;\nlibFileSet['lib.es2015.collection.d.ts'] = true;\nlibFileSet['lib.es2015.core.d.ts'] = true;\nlibFileSet['lib.es2015.d.ts'] = true;\nlibFileSet['lib.es2015.generator.d.ts'] = true;\nlibFileSet['lib.es2015.iterable.d.ts'] = true;\nlibFileSet['lib.es2015.promise.d.ts'] = true;\nlibFileSet['lib.es2015.proxy.d.ts'] = true;\nlibFileSet['lib.es2015.reflect.d.ts'] = true;\nlibFileSet['lib.es2015.symbol.d.ts'] = true;\nlibFileSet['lib.es2015.symbol.wellknown.d.ts'] = true;\nlibFileSet['lib.es2016.array.include.d.ts'] = true;\nlibFileSet['lib.es2016.d.ts'] = true;\nlibFileSet['lib.es2016.full.d.ts'] = true;\nlibFileSet['lib.es2017.d.ts'] = true;\nlibFileSet['lib.es2017.full.d.ts'] = true;\nlibFileSet['lib.es2017.intl.d.ts'] = true;\nlibFileSet['lib.es2017.object.d.ts'] = true;\nlibFileSet['lib.es2017.sharedmemory.d.ts'] = true;\nlibFileSet['lib.es2017.string.d.ts'] = true;\nlibFileSet['lib.es2017.typedarrays.d.ts'] = true;\nlibFileSet['lib.es2018.asyncgenerator.d.ts'] = true;\nlibFileSet['lib.es2018.asynciterable.d.ts'] = true;\nlibFileSet['lib.es2018.d.ts'] = true;\nlibFileSet['lib.es2018.full.d.ts'] = true;\nlibFileSet['lib.es2018.intl.d.ts'] = true;\nlibFileSet['lib.es2018.promise.d.ts'] = true;\nlibFileSet['lib.es2018.regexp.d.ts'] = true;\nlibFileSet['lib.es2019.array.d.ts'] = true;\nlibFileSet['lib.es2019.d.ts'] = true;\nlibFileSet['lib.es2019.full.d.ts'] = true;\nlibFileSet['lib.es2019.object.d.ts'] = true;\nlibFileSet['lib.es2019.string.d.ts'] = true;\nlibFileSet['lib.es2019.symbol.d.ts'] = true;\nlibFileSet['lib.es2020.bigint.d.ts'] = true;\nlibFileSet['lib.es2020.d.ts'] = true;\nlibFileSet['lib.es2020.full.d.ts'] = true;\nlibFileSet['lib.es2020.intl.d.ts'] = true;\nlibFileSet['lib.es2020.promise.d.ts'] = true;\nlibFileSet['lib.es2020.string.d.ts'] = true;\nlibFileSet['lib.es2020.symbol.wellknown.d.ts'] = true;\nlibFileSet['lib.es5.d.ts'] = true;\nlibFileSet['lib.es6.d.ts'] = true;\nlibFileSet['lib.esnext.d.ts'] = true;\nlibFileSet['lib.esnext.full.d.ts'] = true;\nlibFileSet['lib.esnext.intl.d.ts'] = true;\nlibFileSet['lib.esnext.promise.d.ts'] = true;\nlibFileSet['lib.esnext.string.d.ts'] = true;\nlibFileSet['lib.scripthost.d.ts'] = true;\nlibFileSet['lib.webworker.d.ts'] = true;\nlibFileSet['lib.webworker.importscripts.d.ts'] = true;\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nimport { WorkerManager } from './workerManager.js';\nimport * as languageFeatures from './languageFeatures.js';\nimport { languages } from './fillers/monaco-editor-core.js';\nvar javaScriptWorker;\nvar typeScriptWorker;\nexport function setupTypeScript(defaults) {\n typeScriptWorker = setupMode(defaults, 'typescript');\n}\nexport function setupJavaScript(defaults) {\n javaScriptWorker = setupMode(defaults, 'javascript');\n}\nexport function getJavaScriptWorker() {\n return new Promise(function (resolve, reject) {\n if (!javaScriptWorker) {\n return reject('JavaScript not registered!');\n }\n resolve(javaScriptWorker);\n });\n}\nexport function getTypeScriptWorker() {\n return new Promise(function (resolve, reject) {\n if (!typeScriptWorker) {\n return reject('TypeScript not registered!');\n }\n resolve(typeScriptWorker);\n });\n}\nfunction setupMode(defaults, modeId) {\n var client = new WorkerManager(modeId, defaults);\n var worker = function () {\n var uris = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n uris[_i] = arguments[_i];\n }\n return client.getLanguageServiceWorker.apply(client, uris);\n };\n var libFiles = new languageFeatures.LibFiles(worker);\n languages.registerCompletionItemProvider(modeId, new languageFeatures.SuggestAdapter(worker));\n languages.registerSignatureHelpProvider(modeId, new languageFeatures.SignatureHelpAdapter(worker));\n languages.registerHoverProvider(modeId, new languageFeatures.QuickInfoAdapter(worker));\n languages.registerDocumentHighlightProvider(modeId, new languageFeatures.OccurrencesAdapter(worker));\n languages.registerDefinitionProvider(modeId, new languageFeatures.DefinitionAdapter(libFiles, worker));\n languages.registerReferenceProvider(modeId, new languageFeatures.ReferenceAdapter(libFiles, worker));\n languages.registerDocumentSymbolProvider(modeId, new languageFeatures.OutlineAdapter(worker));\n languages.registerDocumentRangeFormattingEditProvider(modeId, new languageFeatures.FormatAdapter(worker));\n languages.registerOnTypeFormattingEditProvider(modeId, new languageFeatures.FormatOnTypeAdapter(worker));\n languages.registerCodeActionProvider(modeId, new languageFeatures.CodeActionAdaptor(worker));\n languages.registerRenameProvider(modeId, new languageFeatures.RenameAdapter(worker));\n new languageFeatures.DiagnosticsAdapter(libFiles, defaults, modeId, worker);\n return worker;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { editor } from './fillers/monaco-editor-core.js';\nvar WorkerManager = /** @class */ (function () {\n function WorkerManager(modeId, defaults) {\n var _this = this;\n this._modeId = modeId;\n this._defaults = defaults;\n this._worker = null;\n this._client = null;\n this._configChangeListener = this._defaults.onDidChange(function () { return _this._stopWorker(); });\n this._updateExtraLibsToken = 0;\n this._extraLibsChangeListener = this._defaults.onDidExtraLibsChange(function () {\n return _this._updateExtraLibs();\n });\n }\n WorkerManager.prototype._stopWorker = function () {\n if (this._worker) {\n this._worker.dispose();\n this._worker = null;\n }\n this._client = null;\n };\n WorkerManager.prototype.dispose = function () {\n this._configChangeListener.dispose();\n this._extraLibsChangeListener.dispose();\n this._stopWorker();\n };\n WorkerManager.prototype._updateExtraLibs = function () {\n return __awaiter(this, void 0, void 0, function () {\n var myToken, proxy;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n if (!this._worker) {\n return [2 /*return*/];\n }\n myToken = ++this._updateExtraLibsToken;\n return [4 /*yield*/, this._worker.getProxy()];\n case 1:\n proxy = _a.sent();\n if (this._updateExtraLibsToken !== myToken) {\n // avoid multiple calls\n return [2 /*return*/];\n }\n proxy.updateExtraLibs(this._defaults.getExtraLibs());\n return [2 /*return*/];\n }\n });\n });\n };\n WorkerManager.prototype._getClient = function () {\n var _this = this;\n if (!this._client) {\n this._worker = editor.createWebWorker({\n // module that exports the create() method and returns a `TypeScriptWorker` instance\n moduleId: 'vs/language/typescript/tsWorker',\n label: this._modeId,\n keepIdleModels: true,\n // passed in to the create() method\n createData: {\n compilerOptions: this._defaults.getCompilerOptions(),\n extraLibs: this._defaults.getExtraLibs(),\n customWorkerPath: this._defaults.workerOptions.customWorkerPath\n }\n });\n var p = this._worker.getProxy();\n if (this._defaults.getEagerModelSync()) {\n p = p.then(function (worker) {\n if (_this._worker) {\n return _this._worker.withSyncedResources(editor\n .getModels()\n .filter(function (model) { return model.getModeId() === _this._modeId; })\n .map(function (model) { return model.uri; }));\n }\n return worker;\n });\n }\n this._client = p;\n }\n return this._client;\n };\n WorkerManager.prototype.getLanguageServiceWorker = function () {\n var _this = this;\n var resources = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n resources[_i] = arguments[_i];\n }\n var _client;\n return this._getClient()\n .then(function (client) {\n _client = client;\n })\n .then(function (_) {\n if (_this._worker) {\n return _this._worker.withSyncedResources(resources);\n }\n })\n .then(function (_) { return _client; });\n };\n return WorkerManager;\n}());\nexport { WorkerManager };\n"],"sourceRoot":""}