"use strict";function t(t,e){return t.slice(0,e.length)==e}var e=/[\\^$.*+?()[\]{}|]/g,n=RegExp(e.source);function r(t){return t&&n.test(t)?t.replace(e,"\\$&"):t}function i(t,e){null!==e&&t.push(e)}function o(t){console.log(t)}function s(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var u=require("format-util"),a="skip",l="reportAsIgnoredTest",c="reportAllInnerTestsAsIgnored";var f=["log","info","warn","error","debug"];function p(t,e){return{suite:function(e,n,r){t.suite(e,n,r)},test:function(n,r,i){t.test(n,r,(function(){var t=console,r=f.map((function(r){var i,o=t[r];return t[r]=(i=r,function(t){for(var r,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];t=String(t),r="warn"==i||"error"==i?"testStdErr":"testStdOut",e.sendMessage(r,function(t,e){return(e=e||{}).name=t,e}(n,{out:"["+i+"] "+u.apply(void 0,s([t],o))+"\n"}))}),function(){return t[r]=o}}));try{return i()}catch(t){throw t}finally{r.forEach((function(t){return t()}))}}))}}}var g=function(){function e(t,e){this.description=t,this.onFail=e}return e.prototype.printUsage=function(){var t=this.description;for(var e in o("v"+t.version+" - "+t.description),o(),o("Usage: "+t.usage),o(),t.args){var n=t.args[e];o(" "+n.keys.join(", "));var r=" ";if(o(""+r+n.help),n.values&&n.valuesHelp){o(r+"Possible values:");for(var i=0;i<n.values.length;i++){o(r+' - "'+n.values[i]+'": '+n.valuesHelp[i])}}n.default&&o(r+"By default: "+n.default),o("")}},e.prototype.badArgsExit=function(t){o(t),o(),this.printUsage(),this.onFail(1)},e.prototype.parse=function(e){var n=this.description,r={free:[]};for(var i in n.args)n.args[i].single||(r[i]=[]);t:for(;0!=e.length;){var o=e.shift();if(t(o,"--"))for(var s in n.args){var u=n.args[s];if(-1!=u.keys.indexOf(o)){0==e.length&&this.badArgsExit("Missed value after option "+o);var a=e.shift();u.values&&-1==u.values.indexOf(a)&&this.badArgsExit("Unsupported value for option "+o),u.single?r[s]=a:r[s].push(a);continue t}}else r.free.push(o)}return n.freeArgsTitle&&0==r.free.length&&this.badArgsExit("At least one "+n.freeArgsTitle+" should be provided"),r},e}();function h(e){if(null==e)return null;if(0==(e=(e=e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")).replace(/\*+/,"*")).length)return null;if("*"==e)return d;if(-1==e.indexOf("*"))return new y(e);if(t(e,"*"))return new m(e);var n=e.split("*",2),r=n[0],i=n[1];return new v(r,i?new m(e):null)}var d=new(function(){function t(){}return t.prototype.mayContainTestsFromSuite=function(t){return!0},t.prototype.containsTest=function(t){return!0},t}()),v=function(){function e(t,e){this.prefix=t,this.filter=e}return e.prototype.mayContainTestsFromSuite=function(e){return t(this.prefix,e)||t(e,this.prefix)},e.prototype.containsAllTestsFromSuite=function(e){return null==this.filter&&t(e,this.prefix)},e.prototype.containsTest=function(e){return t(e,this.prefix)&&(null==this.filter||this.filter.containsTest(e))},e}(),y=function(){function e(t){this.fqn=t,this.classNameOnlyRegExp=RegExp("^"+r(this.fqn+".")+"[^.]+$")}return e.prototype.mayContainTestsFromSuite=function(e){return t(this.fqn,e)},e.prototype.containsTest=function(t){return t===this.fqn||this.classNameOnlyRegExp.test(t)},e}(),m=function(){function t(t){this.regexp=RegExp("^"+t.split("*").map((function(t){return r(t)})).join(".*")+"$")}return t.prototype.mayContainTestsFromSuite=function(t){return!0},t.prototype.containsTest=function(t){return this.regexp.test(t)},t.prototype.toString=function(){return this.regexp.toString()},t}(),x=function(){function t(t,e){var n=this;this.include=t,this.exclude=e,this.excludePrefix=[],this.exclude.forEach((function(t){t instanceof v&&null==t.filter&&n.excludePrefix.push(t)}))}return t.prototype.mayContainTestsFromSuite=function(t,e){for(var n=0,r=this.excludePrefix;n<r.length;n++){var i=r[n];if(i.containsAllTestsFromSuite(t)||i.containsAllTestsFromSuite(e))return!1}for(var o=0,s=this.include;o<s.length;o++){var u=s[o];if(u.mayContainTestsFromSuite(t)||u.mayContainTestsFromSuite(e))return!0}return!1},t.prototype.containsTest=function(t,e){for(var n=0,r=this.exclude;n<r.length;n++){var i=r[n];if(i.containsTest(t)||i.containsTest(e))return!1}for(var o=0,s=this.include;o<s.length;o++){var u=s[o];if(u.containsTest(t)||u.containsTest(e))return!0}return!1},t}();require("format-util");var T=function(){function t(t,e){this.send=e,this.id=t||Math.floor(9999000001*Math.random())+1e6}return t.prototype.sendMessage=function(t,e){e.flowId=this.id,e.timestamp=(new Date).toISOString().slice(0,-1);var n=Object.keys(e).map((function(t){return t+"='"+(((n=e[t])?n.toString().replace(/\x1B.*?m/g,"").replace(/\|/g,"||").replace(/\n/g,"|n").replace(/\r/g,"|r").replace(/\[/g,"|[").replace(/\]/g,"|]").replace(/\u0085/g,"|x").replace(/\u2028/g,"|l").replace(/\u2029/g,"|p").replace(/'/g,"|'"):"")+"'");var n})).join(" ");this.send("##teamcity["+t+" "+n+"]")},t}();function w(t,e){var n=console.log,r=new T(null,(function(t){return n(t)}));return p(function(t,e){var n={include:e.include,exclude:e.exclude},r=t;return r=function(t,e,n){var r=[],o=[];function s(t,e,n){var r,o,s;(r=t,o=function(t){return t.split(",")},s=[],r.forEach((function(t){o(t).forEach((function(t){s.push(t)}))})),s).map((function(t){t.length&&"!"==t[0]?i(n,h(t.substring(1))):i(e,h(t))}))}if(s(e,r,o),s(n,o,r),0==r.length&&0==o.length)return t;0==r.length&&r.push(d);var u=new x(r,o);return function(t,e){var n=[];function r(){return n[0]?n.join("."):n.slice(1).join(".")}function i(){var t=""+n.slice(1).join("$");return n[0]?t?n[0]+"."+t:n[0]:t}return{suite:function(o,s,u){n.push(o);try{if(n.length>0&&!e.mayContainTestsFromSuite(r(),i()))return;t.suite(o,s,u)}finally{n.pop()}},test:function(n,o,s){try{if(!e.containsTest(r()+"."+n,i()+"."+n))return;t.test(n,o,s)}finally{}}}}(t,u)}(r,n.include,n.exclude)}(t,e),r)}var S,E=new g({version:"2.0.0",description:"Kotlin/JS and Kotlin/Wasm utilities to work with Kotlin Gradle Plugin",usage:"[-t --tests] [-e --exclude] <module_name1>, <module_name2>, ..",args:{include:{keys:["--tests","--include"],help:"Tests to include. Example: MySuite.test1,MySuite.MySubSuite.*,*unix*,!*windows*",default:"*"},exclude:{keys:["--exclude"],help:"Tests to exclude. Example: MySuite.test1,MySuite.MySubSuite.*,*unix*"},ignoredTestSuites:{keys:["--ignoredTestSuites"],help:"How to deal with ignored test suites",single:!0,values:[a,l,c],valuesHelp:["don't report ignored test suites","useful to speedup large ignored test suites","will cause visiting all inner tests"],default:c}},freeArgsTitle:null},(function(t){throw new Error("Exit with "+t)})).parse(window.__karma__.config.args);if(window.kotlinTest){var F=window.kotlinTest.adapterTransformer;S=function(t){return w(F(t),E)}}else S=function(t){return w(t,E)};window.kotlinTest={adapterTransformer:S};var A=window.__karma__.result;window.__karma__.result=function(t){console.log("--END_KOTLIN_TEST--\n"+JSON.stringify(t)),A(t)};
//# sourceMappingURL=kotlin-test-karma-runner.js.map