"use strict";var __awaiter=this&&this.__awaiter||function(c,f,n,u){function r(t){return t instanceof n?t:new n(function(i){i(t)})}return new(n||(n=Promise))(function(t,i){function l(a){try{e(u.next(a))}catch(s){i(s)}}function o(a){try{e(u["throw"](a))}catch(s){i(s)}}function e(a){a.done?t(a.value):r(a.value).then(l,o)}e((u=u.apply(c,f||[])).next())})};var __generator=this&&this.__generator||function(c,f){var n={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},u,r,t,i=Object.create((typeof Iterator==="function"?Iterator:Object).prototype);return i.next=l(0),i["throw"]=l(1),i["return"]=l(2),typeof Symbol==="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(e){return function(a){return o([e,a])}}function o(e){if(u)throw new TypeError("Generator is already executing.");while(i&&(i=0,e[0]&&(n=0)),n)try{if(u=1,r&&(t=e[0]&2?r["return"]:e[0]?r["throw"]||((t=r["return"])&&t.call(r),0):r.next)&&!(t=t.call(r,e[1])).done)return t;if(r=0,t)e=[e[0]&2,t.value];switch(e[0]){case 0:case 1:t=e;break;case 4:n.label++;return{value:e[1],done:false};case 5:n.label++;r=e[1];e=[0];continue;case 7:e=n.ops.pop();n.trys.pop();continue;default:if(!(t=n.trys,t=t.length>0&&t[t.length-1])&&(e[0]===6||e[0]===2)){n=0;continue}if(e[0]===3&&(!t||e[1]>t[0]&&e[1]<t[3])){n.label=e[1];break}if(e[0]===6&&n.label<t[1]){n.label=t[1];t=e;break}if(t&&n.label<t[2]){n.label=t[2];n.ops.push(e);break}if(t[2])n.ops.pop();n.trys.pop();continue}e=f.call(c,n)}catch(a){e=[6,a];r=0}finally{u=t=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:true}}};Object.defineProperty(exports,"__esModule",{value:true});exports.WrapCallback=WrapCallback;var utils_1=require("./utils");function WrapCallback(){return function(c,f,n){var u=n.value;n.value=function(r){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(t){return[2,(0,utils_1.wrapCallback)(u,this)(r)]})})}}}