From d75d7890d0f6a20dd1abd70a5363b7d274aa7212 Mon Sep 17 00:00:00 2001 From: Webber Date: Sun, 26 Apr 2020 20:22:09 +0200 Subject: [PATCH] =?UTF-8?q?Implement=20versioning=20strategies=20in=20js?= =?UTF-8?q?=20=F0=9F=A7=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Editor/Builder.cs | 2 +- .../Assets/Editor/Versioning/Git.cs | 8 +- .../Editor/Versioning/VersionApplicator.cs | 49 +---- action/index.js | 2 +- jest.config.js | 1 + src/index.js | 4 +- src/jest.setup.js | 15 ++ src/model/__mocks__/input.js | 17 ++ src/model/__mocks__/versioning.js | 5 + src/model/build-parameters.js | 10 +- src/model/build-parameters.test.js | 6 +- src/model/docker.js | 10 +- src/model/error/command-execution-error.js | 8 + .../error/command-execution-error.test.js | 14 ++ src/model/error/not-implemented-exception.js | 8 + .../error/not-implemented-exception.test.js | 14 ++ src/model/index.js | 14 +- src/model/index.test.js | 2 +- src/model/input.js | 27 +-- src/model/input.test.js | 23 ++- src/model/project.js | 2 +- src/model/system.js | 26 +++ src/model/versioning.js | 187 ++++++++++++++++++ 23 files changed, 361 insertions(+), 93 deletions(-) create mode 100644 src/jest.setup.js create mode 100644 src/model/__mocks__/input.js create mode 100644 src/model/__mocks__/versioning.js create mode 100644 src/model/error/command-execution-error.js create mode 100644 src/model/error/command-execution-error.test.js create mode 100644 src/model/error/not-implemented-exception.js create mode 100644 src/model/error/not-implemented-exception.test.js create mode 100644 src/model/system.js create mode 100644 src/model/versioning.js diff --git a/action/default-build-script/Assets/Editor/Builder.cs b/action/default-build-script/Assets/Editor/Builder.cs index 62eeaad1..adb60912 100644 --- a/action/default-build-script/Assets/Editor/Builder.cs +++ b/action/default-build-script/Assets/Editor/Builder.cs @@ -27,7 +27,7 @@ namespace UnityBuilderAction }; // Set version for this build - VersionApplicator.SetVersion(options["versioning"], options["version"]); + VersionApplicator.SetVersion(options["version"]); // Perform build BuildReport buildReport = BuildPipeline.BuildPlayer(buildOptions); diff --git a/action/default-build-script/Assets/Editor/Versioning/Git.cs b/action/default-build-script/Assets/Editor/Versioning/Git.cs index 28388e5b..87c0cda8 100644 --- a/action/default-build-script/Assets/Editor/Versioning/Git.cs +++ b/action/default-build-script/Assets/Editor/Versioning/Git.cs @@ -10,7 +10,7 @@ namespace UnityBuilderAction.Versioning /// /// Generate a version based on the latest tag and the amount of commits. /// Format: 0.1.2 (where 2 is the amount of commits). - /// + /// /// If no tag is present in the repository then v0.0 is assumed. /// This would result in 0.0.# where # is the amount of commits. /// @@ -32,7 +32,7 @@ namespace UnityBuilderAction.Versioning /// /// Get the version of the current tag. - /// + /// /// The tag must point at HEAD for this method to work. /// /// Output Format: @@ -85,7 +85,7 @@ namespace UnityBuilderAction.Versioning /// /// Get version string. - /// + /// /// Format: `v0.1-2-g12345678` (where 2 is the amount of commits since the last tag) /// /// See: https://softwareengineering.stackexchange.com/questions/141973/how-do-you-achieve-a-numeric-versioning-scheme-with-git @@ -95,7 +95,7 @@ namespace UnityBuilderAction.Versioning return Run(@"describe --tags --long --match ""v[0-9]*"""); // Todo - implement split function based on this more complete query - return Run(@"git describe --long --tags --dirty --always"); + // return Run(@"describe --long --tags --dirty --always"); } /// diff --git a/action/default-build-script/Assets/Editor/Versioning/VersionApplicator.cs b/action/default-build-script/Assets/Editor/Versioning/VersionApplicator.cs index c3aed64d..bc844b48 100644 --- a/action/default-build-script/Assets/Editor/Versioning/VersionApplicator.cs +++ b/action/default-build-script/Assets/Editor/Versioning/VersionApplicator.cs @@ -6,53 +6,12 @@ namespace UnityBuilderAction.Versioning { public class VersionApplicator { - enum Strategy + public static void SetVersion(string version) { - None, - Custom, - Semantic, - Tag, - } - - public static void SetVersion(string strategy, [CanBeNull] string version) - { - if (!Enum.TryParse(strategy, out Strategy validatedStrategy)) { - throw new Exception($"Invalid versioning argument provided. {strategy} is not a valid strategy."); + if (version == "none") { + return; } - - switch (validatedStrategy) { - case Strategy.None: - return; - case Strategy.Custom: - ApplyCustomVersion(version); - return; - case Strategy.Semantic: - ApplySemanticCommitVersion(); - return; - case Strategy.Tag: - ApplyVersionFromCurrentTag(); - return; - default: - throw new NotImplementedException("Version strategy has not been implemented."); - } - } - - static void ApplyCustomVersion(string version) - { - Apply(version); - } - - static void ApplySemanticCommitVersion() - { - string version = Git.GenerateSemanticCommitVersion(); - - Apply(version); - } - - static void ApplyVersionFromCurrentTag() - { - string version = Git.GetTagVersion(); - + Apply(version); } diff --git a/action/index.js b/action/index.js index ff68e5b9..2a65d0c0 100644 --- a/action/index.js +++ b/action/index.js @@ -1 +1 @@ -module.exports=function(e,r){"use strict";var t={};function __webpack_require__(r){if(t[r]){return t[r].exports}var n=t[r]={i:r,l:false,exports:{}};e[r].call(n.exports,n,n.exports,__webpack_require__);n.l=true;return n.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(939)}r(__webpack_require__);return startup()}({1:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:true});const a=t(129);const i=t(622);const o=t(669);const u=t(672);const s=o.promisify(a.exec);function cp(e,r,t={}){return n(this,void 0,void 0,function*(){const{force:n,recursive:a}=readCopyOptions(t);const o=(yield u.exists(r))?yield u.stat(r):null;if(o&&o.isFile()&&!n){return}const s=o&&o.isDirectory()?i.join(r,i.basename(e)):r;if(!(yield u.exists(e))){throw new Error(`no such file or directory: ${e}`)}const c=yield u.stat(e);if(c.isDirectory()){if(!a){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,n)}}else{if(i.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,n)}})}r.cp=cp;function mv(e,r,t={}){return n(this,void 0,void 0,function*(){if(yield u.exists(r)){let n=true;if(yield u.isDirectory(r)){r=i.join(r,i.basename(e));n=yield u.exists(r)}if(n){if(t.force==null||t.force){yield rmRF(r)}else{throw new Error("Destination already exists")}}}yield mkdirP(i.dirname(r));yield u.rename(e,r)})}r.mv=mv;function rmRF(e){return n(this,void 0,void 0,function*(){if(u.IS_WINDOWS){try{if(yield u.isDirectory(e,true)){yield s(`rd /s /q "${e}"`)}else{yield s(`del /f /a "${e}"`)}}catch(e){if(e.code!=="ENOENT")throw e}try{yield u.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let r=false;try{r=yield u.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(r){yield s(`rm -rf "${e}"`)}else{yield u.unlink(e)}}})}r.rmRF=rmRF;function mkdirP(e){return n(this,void 0,void 0,function*(){yield u.mkdirP(e)})}r.mkdirP=mkdirP;function which(e,r){return n(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(r){const r=yield which(e,false);if(!r){if(u.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}}try{const r=[];if(u.IS_WINDOWS&&process.env.PATHEXT){for(const e of process.env.PATHEXT.split(i.delimiter)){if(e){r.push(e)}}}if(u.isRooted(e)){const t=yield u.tryGetExecutablePath(e,r);if(t){return t}return""}if(e.includes("/")||u.IS_WINDOWS&&e.includes("\\")){return""}const t=[];if(process.env.PATH){for(const e of process.env.PATH.split(i.delimiter)){if(e){t.push(e)}}}for(const n of t){const t=yield u.tryGetExecutablePath(n+i.sep+e,r);if(t){return t}}return""}catch(e){throw new Error(`which failed with message ${e.message}`)}})}r.which=which;function readCopyOptions(e){const r=e.force==null?true:e.force;const t=Boolean(e.recursive);return{force:r,recursive:t}}function cpDirRecursive(e,r,t,a){return n(this,void 0,void 0,function*(){if(t>=255)return;t++;yield mkdirP(r);const n=yield u.readdir(e);for(const i of n){const n=`${e}/${i}`;const o=`${r}/${i}`;const s=yield u.lstat(n);if(s.isDirectory()){yield cpDirRecursive(n,o,t,a)}else{yield copyFile(n,o,a)}}yield u.chmod(r,(yield u.stat(e)).mode)})}function copyFile(e,r,t){return n(this,void 0,void 0,function*(){if((yield u.lstat(e)).isSymbolicLink()){try{yield u.lstat(r);yield u.unlink(r)}catch(e){if(e.code==="EPERM"){yield u.chmod(r,"0666");yield u.unlink(r)}}const t=yield u.readlink(e);yield u.symlink(t,r,u.IS_WINDOWS?"junction":null)}else if(!(yield u.exists(r))||t){yield u.copyFile(e,r)}})}},9:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:true});const a=t(87);const i=t(614);const o=t(129);const u=t(622);const s=t(1);const c=t(672);const f=process.platform==="win32";class ToolRunner extends i.EventEmitter{constructor(e,r,t){super();if(!e){throw new Error("Parameter 'toolPath' cannot be null or empty.")}this.toolPath=e;this.args=r||[];this.options=t||{}}_debug(e){if(this.options.listeners&&this.options.listeners.debug){this.options.listeners.debug(e)}}_getCommandString(e,r){const t=this._getSpawnFileName();const n=this._getSpawnArgs(e);let a=r?"":"[command]";if(f){if(this._isCmdFile()){a+=t;for(const e of n){a+=` ${e}`}}else if(e.windowsVerbatimArguments){a+=`"${t}"`;for(const e of n){a+=` ${e}`}}else{a+=this._windowsQuoteCmdArg(t);for(const e of n){a+=` ${this._windowsQuoteCmdArg(e)}`}}}else{a+=t;for(const e of n){a+=` ${e}`}}return a}_processLineBuffer(e,r,t){try{let n=r+e.toString();let i=n.indexOf(a.EOL);while(i>-1){const e=n.substring(0,i);t(e);n=n.substring(i+a.EOL.length);i=n.indexOf(a.EOL)}r=n}catch(e){this._debug(`error processing line. Failed with error ${e}`)}}_getSpawnFileName(){if(f){if(this._isCmdFile()){return process.env["COMSPEC"]||"cmd.exe"}}return this.toolPath}_getSpawnArgs(e){if(f){if(this._isCmdFile()){let r=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(const t of this.args){r+=" ";r+=e.windowsVerbatimArguments?t:this._windowsQuoteCmdArg(t)}r+='"';return[r]}}return this.args}_endsWith(e,r){return e.endsWith(r)}_isCmdFile(){const e=this.toolPath.toUpperCase();return this._endsWith(e,".CMD")||this._endsWith(e,".BAT")}_windowsQuoteCmdArg(e){if(!this._isCmdFile()){return this._uvQuoteCmdArg(e)}if(!e){return'""'}const r=[" ","\t","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">",'"'];let t=false;for(const n of e){if(r.some(e=>e===n)){t=true;break}}if(!t){return e}let n='"';let a=true;for(let r=e.length;r>0;r--){n+=e[r-1];if(a&&e[r-1]==="\\"){n+="\\"}else if(e[r-1]==='"'){a=true;n+='"'}else{a=false}}n+='"';return n.split("").reverse().join("")}_uvQuoteCmdArg(e){if(!e){return'""'}if(!e.includes(" ")&&!e.includes("\t")&&!e.includes('"')){return e}if(!e.includes('"')&&!e.includes("\\")){return`"${e}"`}let r='"';let t=true;for(let n=e.length;n>0;n--){r+=e[n-1];if(t&&e[n-1]==="\\"){r+="\\"}else if(e[n-1]==='"'){t=true;r+="\\"}else{t=false}}r+='"';return r.split("").reverse().join("")}_cloneExecOptions(e){e=e||{};const r={cwd:e.cwd||process.cwd(),env:e.env||process.env,silent:e.silent||false,windowsVerbatimArguments:e.windowsVerbatimArguments||false,failOnStdErr:e.failOnStdErr||false,ignoreReturnCode:e.ignoreReturnCode||false,delay:e.delay||1e4};r.outStream=e.outStream||process.stdout;r.errStream=e.errStream||process.stderr;return r}_getSpawnOptions(e,r){e=e||{};const t={};t.cwd=e.cwd;t.env=e.env;t["windowsVerbatimArguments"]=e.windowsVerbatimArguments||this._isCmdFile();if(e.windowsVerbatimArguments){t.argv0=`"${r}"`}return t}exec(){return n(this,void 0,void 0,function*(){if(!c.isRooted(this.toolPath)&&(this.toolPath.includes("/")||f&&this.toolPath.includes("\\"))){this.toolPath=u.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)}this.toolPath=yield s.which(this.toolPath,true);return new Promise((e,r)=>{this._debug(`exec tool: ${this.toolPath}`);this._debug("arguments:");for(const e of this.args){this._debug(` ${e}`)}const t=this._cloneExecOptions(this.options);if(!t.silent&&t.outStream){t.outStream.write(this._getCommandString(t)+a.EOL)}const n=new ExecState(t,this.toolPath);n.on("debug",e=>{this._debug(e)});const i=this._getSpawnFileName();const u=o.spawn(i,this._getSpawnArgs(t),this._getSpawnOptions(this.options,i));const s="";if(u.stdout){u.stdout.on("data",e=>{if(this.options.listeners&&this.options.listeners.stdout){this.options.listeners.stdout(e)}if(!t.silent&&t.outStream){t.outStream.write(e)}this._processLineBuffer(e,s,e=>{if(this.options.listeners&&this.options.listeners.stdline){this.options.listeners.stdline(e)}})})}const c="";if(u.stderr){u.stderr.on("data",e=>{n.processStderr=true;if(this.options.listeners&&this.options.listeners.stderr){this.options.listeners.stderr(e)}if(!t.silent&&t.errStream&&t.outStream){const r=t.failOnStdErr?t.errStream:t.outStream;r.write(e)}this._processLineBuffer(e,c,e=>{if(this.options.listeners&&this.options.listeners.errline){this.options.listeners.errline(e)}})})}u.on("error",e=>{n.processError=e.message;n.processExited=true;n.processClosed=true;n.CheckComplete()});u.on("exit",e=>{n.processExitCode=e;n.processExited=true;this._debug(`Exit code ${e} received from tool '${this.toolPath}'`);n.CheckComplete()});u.on("close",e=>{n.processExitCode=e;n.processExited=true;n.processClosed=true;this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);n.CheckComplete()});n.on("done",(t,n)=>{if(s.length>0){this.emit("stdline",s)}if(c.length>0){this.emit("errline",c)}u.removeAllListeners();if(t){r(t)}else{e(n)}})})})}}r.ToolRunner=ToolRunner;function argStringToArray(e){const r=[];let t=false;let n=false;let a="";function append(e){if(n&&e!=='"'){a+="\\"}a+=e;n=false}for(let i=0;i0){r.push(a);a=""}continue}append(o)}if(a.length>0){r.push(a.trim())}return r}r.argStringToArray=argStringToArray;class ExecState extends i.EventEmitter{constructor(e,r){super();this.processClosed=false;this.processError="";this.processExitCode=0;this.processExited=false;this.processStderr=false;this.delay=1e4;this.done=false;this.timeout=null;if(!r){throw new Error("toolPath must not be empty")}this.options=e;this.toolPath=r;if(e.delay){this.delay=e.delay}}CheckComplete(){if(this.done){return}if(this.processClosed){this._setResult()}else if(this.processExited){this.timeout=setTimeout(ExecState.HandleTimeout,this.delay,this)}}_debug(e){this.emit("debug",e)}_setResult(){let e;if(this.processExited){if(this.processError){e=new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`)}else if(this.processExitCode!==0&&!this.options.ignoreReturnCode){e=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`)}else if(this.processStderr&&this.options.failOnStdErr){e=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`)}}if(this.timeout){clearTimeout(this.timeout);this.timeout=null}this.done=true;this.emit("done",e,this.processExitCode)}static HandleTimeout(e){if(e.done){return}if(!e.processClosed&&e.processExited){const r=`The STDIO streams did not close within ${e.delay/1e3} seconds of the exit event from process '${e.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;e._debug(r)}e._setResult()}}},87:function(e){e.exports=require("os")},129:function(e){e.exports=require("child_process")},357:function(e){e.exports=require("assert")},431:function(e,r,t){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(Object.hasOwnProperty.call(e,t))r[t]=e[t];r["default"]=e;return r};Object.defineProperty(r,"__esModule",{value:true});const a=n(t(87));function issueCommand(e,r,t){const n=new Command(e,r,t);process.stdout.write(n.toString()+a.EOL)}r.issueCommand=issueCommand;function issue(e,r=""){issueCommand(e,{},r)}r.issue=issue;const i="::";class Command{constructor(e,r,t){if(!e){e="missing.command"}this.command=e;this.properties=r;this.message=t}toString(){let e=i+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let r=true;for(const t in this.properties){if(this.properties.hasOwnProperty(t)){const n=this.properties[t];if(n){if(r){r=false}else{e+=","}e+=`${t}=${escapeProperty(n)}`}}}}e+=`${i}${escapeData(this.message)}`;return e}}function escapeData(e){return(e||"").replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return(e||"").replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},470:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(Object.hasOwnProperty.call(e,t))r[t]=e[t];r["default"]=e;return r};Object.defineProperty(r,"__esModule",{value:true});const i=t(431);const o=a(t(87));const u=a(t(622));var s;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(s=r.ExitCode||(r.ExitCode={}));function exportVariable(e,r){process.env[e]=r;i.issueCommand("set-env",{name:e},r)}r.exportVariable=exportVariable;function setSecret(e){i.issueCommand("add-mask",{},e)}r.setSecret=setSecret;function addPath(e){i.issueCommand("add-path",{},e);process.env["PATH"]=`${e}${u.delimiter}${process.env["PATH"]}`}r.addPath=addPath;function getInput(e,r){const t=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(r&&r.required&&!t){throw new Error(`Input required and not supplied: ${e}`)}return t.trim()}r.getInput=getInput;function setOutput(e,r){i.issueCommand("set-output",{name:e},r)}r.setOutput=setOutput;function setFailed(e){process.exitCode=s.Failure;error(e)}r.setFailed=setFailed;function debug(e){i.issueCommand("debug",{},e)}r.debug=debug;function error(e){i.issue("error",e)}r.error=error;function warning(e){i.issue("warning",e)}r.warning=warning;function info(e){process.stdout.write(e+o.EOL)}r.info=info;function startGroup(e){i.issue("group",e)}r.startGroup=startGroup;function endGroup(){i.issue("endgroup")}r.endGroup=endGroup;function group(e,r){return n(this,void 0,void 0,function*(){startGroup(e);let t;try{t=yield r()}finally{endGroup()}return t})}r.group=group;function saveState(e,r){i.issueCommand("save-state",{name:e},r)}r.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}r.getState=getState},614:function(e){e.exports=require("events")},622:function(e){e.exports=require("path")},669:function(e){e.exports=require("util")},672:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};var a;Object.defineProperty(r,"__esModule",{value:true});const i=t(357);const o=t(747);const u=t(622);a=o.promises,r.chmod=a.chmod,r.copyFile=a.copyFile,r.lstat=a.lstat,r.mkdir=a.mkdir,r.readdir=a.readdir,r.readlink=a.readlink,r.rename=a.rename,r.rmdir=a.rmdir,r.stat=a.stat,r.symlink=a.symlink,r.unlink=a.unlink;r.IS_WINDOWS=process.platform==="win32";function exists(e){return n(this,void 0,void 0,function*(){try{yield r.stat(e)}catch(e){if(e.code==="ENOENT"){return false}throw e}return true})}r.exists=exists;function isDirectory(e,t=false){return n(this,void 0,void 0,function*(){const n=t?yield r.stat(e):yield r.lstat(e);return n.isDirectory()})}r.isDirectory=isDirectory;function isRooted(e){e=normalizeSeparators(e);if(!e){throw new Error('isRooted() parameter "p" cannot be empty')}if(r.IS_WINDOWS){return e.startsWith("\\")||/^[A-Z]:/i.test(e)}return e.startsWith("/")}r.isRooted=isRooted;function mkdirP(e,t=1e3,a=1){return n(this,void 0,void 0,function*(){i.ok(e,"a path argument must be provided");e=u.resolve(e);if(a>=t)return r.mkdir(e);try{yield r.mkdir(e);return}catch(n){switch(n.code){case"ENOENT":{yield mkdirP(u.dirname(e),t,a+1);yield r.mkdir(e);return}default:{let t;try{t=yield r.stat(e)}catch(e){throw n}if(!t.isDirectory())throw n}}}})}r.mkdirP=mkdirP;function tryGetExecutablePath(e,t){return n(this,void 0,void 0,function*(){let n=undefined;try{n=yield r.stat(e)}catch(r){if(r.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${r}`)}}if(n&&n.isFile()){if(r.IS_WINDOWS){const r=u.extname(e).toUpperCase();if(t.some(e=>e.toUpperCase()===r)){return e}}else{if(isUnixExecutable(n)){return e}}}const a=e;for(const i of t){e=a+i;n=undefined;try{n=yield r.stat(e)}catch(r){if(r.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${r}`)}}if(n&&n.isFile()){if(r.IS_WINDOWS){try{const t=u.dirname(e);const n=u.basename(e).toUpperCase();for(const a of yield r.readdir(t)){if(n===a.toUpperCase()){e=u.join(t,a);break}}}catch(r){console.log(`Unexpected error attempting to determine the actual case of the file '${e}': ${r}`)}return e}else{if(isUnixExecutable(n)){return e}}}}return""})}r.tryGetExecutablePath=tryGetExecutablePath;function normalizeSeparators(e){e=e||"";if(r.IS_WINDOWS){e=e.replace(/\//g,"\\");return e.replace(/\\\\+/g,"\\")}return e.replace(/\/\/+/g,"/")}function isUnixExecutable(e){return(e.mode&1)>0||(e.mode&8)>0&&e.gid===process.getgid()||(e.mode&64)>0&&e.uid===process.getuid()}},747:function(e){e.exports=require("fs")},939:function(e,r,t){"use strict";t.r(r);var n=t(622);var a=t.n(n);class action_Action{static get supportedPlatforms(){return["linux"]}static get isRunningLocally(){return process.env.RUNNER_WORKSPACE===undefined}static get isRunningFromSource(){return a().basename(__dirname)==="model"}static get name(){return"unity-builder"}static get rootFolder(){if(action_Action.isRunningFromSource){return a().dirname(a().dirname(a().dirname(__filename)))}return a().dirname(a().dirname(__filename))}static get actionFolder(){return`${action_Action.rootFolder}/action`}static get dockerfile(){return`${action_Action.actionFolder}/Dockerfile`}static get workspace(){return process.env.GITHUB_WORKSPACE}static checkCompatibility(){const e=process.platform;if(!action_Action.supportedPlatforms.includes(e)){throw new Error(`Currently ${e}-platform is not supported`)}}}var i=action_Action;class Platform{static get default(){return Platform.types.StandaloneWindows64}static get types(){return{StandaloneOSX:"StandaloneOSX",StandaloneWindows:"StandaloneWindows",StandaloneWindows64:"StandaloneWindows64",StandaloneLinux64:"StandaloneLinux64",iOS:"iOS",Android:"Android",WebGL:"WebGL",WSAPlayer:"WSAPlayer",PS4:"PS4",XboxOne:"XboxOne",tvOS:"tvOS",Switch:"Switch",Lumin:"Lumin",BJM:"BJM",Stadia:"Stadia",Facebook:"Facebook",NoTarget:"NoTarget",Test:"Test"}}static isWindows(e){switch(e){case Platform.types.StandaloneWindows:case Platform.types.StandaloneWindows64:return true;default:return false}}static isAndroid(e){switch(e){case Platform.types.Android:return true;default:return false}}}var o=Platform;class build_parameters_BuildParameters{static create(e){const{unityVersion:r,targetPlatform:t,projectPath:n,buildName:a,buildsPath:i,buildMethod:o,versioning:u,version:s,customParameters:c}=e;return{unityVersion:r,platform:t,projectPath:n,buildName:a,buildPath:`${i}/${t}`,buildFile:this.parseBuildFile(a,t),buildMethod:o,versioning:u,version:s,customParameters:c}}static parseBuildFile(e,r){if(o.isWindows(r)){return`${e}.exe`}if(o.isAndroid(r)){return`${e}.apk`}return e}}var u=build_parameters_BuildParameters;var s=t(747);var c=t.n(s);class Unity{static get libraryFolder(){return"Library"}}var f=Unity;class ValidationError extends Error{constructor(e){super(e);this.name="ValidationError"}}var l=ValidationError;const v=t(470);const d=["None","Semantic","Tag","Custom"];class input_Input{static getFromUser(){const e=v.getInput("unityVersion");const r=v.getInput("targetPlatform")||o.default;const t=v.getInput("projectPath")||".";const n=v.getInput("buildName")||r;const a=v.getInput("buildsPath")||"build";const i=v.getInput("buildMethod");const u=v.getInput("versioning")||"Semantic";const s=v.getInput("version")||"";const c=v.getInput("customParameters")||"";const f=t.replace(/\/$/,"");if(!d.includes(u)){throw new l(`Versioning strategy should be one of ${d.join(", ")}.`)}return{unityVersion:e,targetPlatform:r,projectPath:f,buildName:n,buildsPath:a,buildMethod:i,versioning:u,version:s,customParameters:c}}}var p=input_Input;class project_Project{static get relativePath(){const{projectPath:e}=p.getFromUser();return`${e}`}static get absolutePath(){const{workspace:e}=i;return`${e}/${this.relativePath}`}static get libraryFolder(){return`${this.relativePath}/${f.libraryFolder}`}}var h=project_Project;class cache_Cache{static verify(){if(!c().existsSync(h.libraryFolder)){this.notifyAboutCachingPossibility()}}static notifyAboutCachingPossibility(){if(i.isRunningLocally){return}console.log(`\n Library folder does not exist.\n Consider setting up caching to speed up your workflow\n If this is not your first build.`)}}var y=cache_Cache;var g=t(986);var b=typeof global=="object"&&global&&global.Object===Object&&global;var m=b;var _=typeof self=="object"&&self&&self.Object===Object&&self;var w=m||_||Function("return this")();var x=w;var S=x.Symbol;var j=S;var O=Object.prototype;var I=O.hasOwnProperty;var A=O.toString;var E=j?j.toStringTag:undefined;function getRawTag(e){var r=I.call(e,E),t=e[E];try{e[E]=undefined;var n=true}catch(e){}var a=A.call(e);if(n){if(r){e[E]=t}else{delete e[E]}}return a}var P=getRawTag;var k=Object.prototype;var C=k.toString;function objectToString(e){return C.call(e)}var R=objectToString;var W="[object Null]",T="[object Undefined]";var M=j?j.toStringTag:undefined;function baseGetTag(e){if(e==null){return e===undefined?T:W}return M&&M in Object(e)?P(e):R(e)}var B=baseGetTag;function isObjectLike(e){return e!=null&&typeof e=="object"}var L=isObjectLike;var D="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||L(e)&&B(e)==D}var F=isSymbol;var N=0/0;function baseToNumber(e){if(typeof e=="number"){return e}if(F(e)){return N}return+e}var $=baseToNumber;function arrayMap(e,r){var t=-1,n=e==null?0:e.length,a=Array(n);while(++t0){if(++r>=gr){return arguments[0]}}else{r=0}return e.apply(undefined,arguments)}}var _r=shortOut;var wr=_r(Ne);var xr=wr;var Sr=/\{\n\/\* \[wrapped with (.+)\] \*/,jr=/,? & /;function getWrapDetails(e){var r=e.match(Sr);return r?r[1].split(jr):[]}var Or=getWrapDetails;var Ir=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function insertWrapDetails(e,r){var t=r.length;if(!t){return e}var n=t-1;r[n]=(t>1?"& ":"")+r[n];r=r.join(t>2?", ":" ");return e.replace(Ir,"{\n/* [wrapped with "+r+"] */\n")}var Ar=insertWrapDetails;function constant(e){return function(){return e}}var Er=constant;var Pr=function(){try{var e=Te(Object,"defineProperty");e({},"",{});return e}catch(e){}}();var kr=Pr;var Cr=!kr?ve:function(e,r){return kr(e,"toString",{configurable:true,enumerable:false,value:Er(r),writable:true})};var Rr=Cr;var Wr=_r(Rr);var Tr=Wr;function arrayEach(e,r){var t=-1,n=e==null?0:e.length;while(++t-1}var Nr=arrayIncludes;var $r=1,Ur=2,zr=8,qr=16,Hr=32,Vr=64,Gr=128,Kr=256,Zr=512;var Xr=[["ary",Gr],["bind",$r],["bindKey",Ur],["curry",zr],["curryRight",qr],["flip",Zr],["partial",Hr],["partialRight",Vr],["rearg",Kr]];function updateWrapDetails(e,r){Mr(Xr,function(t){var n="_."+t[0];if(r&t[1]&&!Nr(e,n)){e.push(n)}});return e.sort()}var Yr=updateWrapDetails;function setWrapToString(e,r,t){var n=r+"";return Tr(e,Ar(n,Yr(Or(n),t)))}var Jr=setWrapToString;var Qr=1,et=2,rt=4,tt=8,nt=32,at=64;function createRecurry(e,r,t,n,a,i,o,u,s,c){var f=r&tt,l=f?o:undefined,v=f?undefined:o,d=f?i:undefined,p=f?undefined:i;r|=f?nt:at;r&=~(f?at:nt);if(!(r&rt)){r&=~(Qr|et)}var h=[e,r,a,d,l,p,v,u,s,c];var y=t.apply(undefined,h);if(yr(e)){xr(y,h)}y.placeholder=n;return Jr(y,e,r)}var it=createRecurry;function getHolder(e){var r=e;return r.placeholder}var ot=getHolder;var ut=9007199254740991;var st=/^(?:0|[1-9]\d*)$/;function isIndex(e,r){var t=typeof e;r=r==null?ut:r;return!!r&&(t=="number"||t!="symbol"&&st.test(e))&&(e>-1&&e%1==0&&e1){g.reverse()}if(f&&s-1&&e%1==0&&e<=Qt}var en=isLength;function isArrayLike(e){return e!=null&&en(e.length)&&!ge(e)}var rn=isArrayLike;function isIterateeCall(e,r,t){if(!J(t)){return false}var n=typeof r;if(n=="number"?rn(t)&&ct(r,t.length):n=="string"&&r in t){return Ht(t[r],e)}return false}var tn=isIterateeCall;function createAssigner(e){return Jt(function(r,t){var n=-1,a=t.length,i=a>1?t[a-1]:undefined,o=a>2?t[2]:undefined;i=e.length>3&&typeof i=="function"?(a--,i):undefined;if(o&&tn(t[0],t[1],o)){i=a<3?undefined:i;a=1}r=Object(r);while(++n-1}var Qa=listCacheHas;function listCacheSet(e,r){var t=this.__data__,n=Ka(t,e);if(n<0){++this.size;t.push([e,r])}else{t[n][1]=r}return this}var ei=listCacheSet;function ListCache(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r0&&t(u)){if(r>1){baseFlatten(u,r-1,t,n,a)}else{Ai(a,u)}}else if(!n){a[a.length]=u}}return a}var ki=baseFlatten;function flatten(e){var r=e==null?0:e.length;return r?ki(e,1):[]}var Ci=flatten;function flatRest(e){return Tr(Yt(e,undefined,Ci),e+"")}var Ri=flatRest;var Wi=Ri(Ii);var Ti=Wi;var Mi=sa(Object.getPrototypeOf,Object);var Bi=Mi;var Li="[object Object]";var Di=Function.prototype,Fi=Object.prototype;var Ni=Di.toString;var $i=Fi.hasOwnProperty;var Ui=Ni.call(Object);function isPlainObject(e){if(!L(e)||B(e)!=Li){return false}var r=Bi(e);if(r===null){return true}var t=$i.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Ni.call(t)==Ui}var zi=isPlainObject;var qi="[object DOMException]",Hi="[object Error]";function isError(e){if(!L(e)){return false}var r=B(e);return r==Hi||r==qi||typeof e.message=="string"&&typeof e.name=="string"&&!zi(e)}var Vi=isError;var Gi=Jt(function(e,r){try{return Ge(e,undefined,r)}catch(e){return Vi(e)?e:new Error(e)}});var Ki=Gi;var Zi="Expected a function";function before(e,r){var t;if(typeof r!="function"){throw new TypeError(Zi)}e=ce(e);return function(){if(--e>0){t=r.apply(this,arguments)}if(e<=1){r=undefined}return t}}var Xi=before;var Yi=1,Ji=32;var Qi=Jt(function(e,r,t){var n=Yi;if(t.length){var a=dt(t,ot(Qi));n|=Ji}return $t(e,n,r,t,a)});Qi.placeholder={};var eo=Qi;var ro=Ri(function(e,r){Mr(r,function(r){r=Si(r);qt(e,r,eo(e[r],e))});return e});var to=ro;var no=1,ao=2,io=32;var oo=Jt(function(e,r,t){var n=no|ao;if(t.length){var a=dt(t,ot(oo));n|=io}return $t(r,n,e,t,a)});oo.placeholder={};var uo=oo;function baseSlice(e,r,t){var n=-1,a=e.length;if(r<0){r=-r>a?0:a+r}t=t>a?a:t;if(t<0){t+=a}a=r>t?0:t-r>>>0;r>>>=0;var i=Array(a);while(++n=n?e:so(e,r,t)}var co=castSlice;var fo="\\ud800-\\udfff",lo="\\u0300-\\u036f",vo="\\ufe20-\\ufe2f",po="\\u20d0-\\u20ff",ho=lo+vo+po,yo="\\ufe0e\\ufe0f";var go="\\u200d";var bo=RegExp("["+go+fo+ho+yo+"]");function hasUnicode(e){return bo.test(e)}var mo=hasUnicode;function asciiToArray(e){return e.split("")}var _o=asciiToArray;var wo="\\ud800-\\udfff",xo="\\u0300-\\u036f",So="\\ufe20-\\ufe2f",jo="\\u20d0-\\u20ff",Oo=xo+So+jo,Io="\\ufe0e\\ufe0f";var Ao="["+wo+"]",Eo="["+Oo+"]",Po="\\ud83c[\\udffb-\\udfff]",ko="(?:"+Eo+"|"+Po+")",Co="[^"+wo+"]",Ro="(?:\\ud83c[\\udde6-\\uddff]){2}",Wo="[\\ud800-\\udbff][\\udc00-\\udfff]",To="\\u200d";var Mo=ko+"?",Bo="["+Io+"]?",Lo="(?:"+To+"(?:"+[Co,Ro,Wo].join("|")+")"+Bo+Mo+")*",Do=Bo+Mo+Lo,Fo="(?:"+[Co+Eo+"?",Eo,Ro,Wo,Ao].join("|")+")";var No=RegExp(Po+"(?="+Po+")|"+Fo+Do,"g");function unicodeToArray(e){return e.match(No)||[]}var $o=unicodeToArray;function stringToArray(e){return mo(e)?$o(e):_o(e)}var Uo=stringToArray;function createCaseFirst(e){return function(r){r=_i(r);var t=mo(r)?Uo(r):undefined;var n=t?t[0]:r.charAt(0);var a=t?co(t,1).join(""):r.slice(1);return n[e]()+a}}var zo=createCaseFirst;var qo=zo("toUpperCase");var Ho=qo;function capitalize(e){return Ho(_i(e).toLowerCase())}var Vo=capitalize;function arrayReduce(e,r,t,n){var a=-1,i=e==null?0:e.length;if(n&&i){t=e[++a]}while(++a=r?e:r}}return e}var ds=baseClamp;function clamp(e,r,t){if(t===undefined){t=r;r=undefined}if(t!==undefined){t=ie(t);t=t===t?t:0}if(r!==undefined){r=ie(r);r=r===r?r:0}return ds(ie(e),r,t)}var ps=clamp;function stackClear(){this.__data__=new ri;this.size=0}var hs=stackClear;function stackDelete(e){var r=this.__data__,t=r["delete"](e);this.size=r.size;return t}var ys=stackDelete;function stackGet(e){return this.__data__.get(e)}var gs=stackGet;function stackHas(e){return this.__data__.has(e)}var bs=stackHas;var ms=200;function stackSet(e,r){var t=this.__data__;if(t instanceof ri){var n=t.__data__;if(!ni||n.lengthu)){return false}var c=i.get(e);if(c&&i.get(r)){return c==r}var f=-1,l=true,v=t&Jf?new Kf:undefined;i.set(e,r);i.set(r,e);while(++f=r||t<0||l&&n>=i}function timerExpired(){var e=_v();if(shouldInvoke(e)){return trailingEdge(e)}u=setTimeout(timerExpired,remainingWait(e))}function trailingEdge(e){u=undefined;if(v&&n){return invokeFunc(e)}n=a=undefined;return o}function cancel(){if(u!==undefined){clearTimeout(u)}c=0;n=s=a=u=undefined}function flush(){return u===undefined?o:trailingEdge(_v())}function debounced(){var e=_v(),t=shouldInvoke(e);n=arguments;a=this;s=e;if(t){if(u===undefined){return leadingEdge(s)}if(l){clearTimeout(u);u=setTimeout(timerExpired,r);return invokeFunc(s)}}if(u===undefined){u=setTimeout(timerExpired,r)}return o}debounced.cancel=cancel;debounced.flush=flush;return debounced}var jv=debounce;function defaultTo(e,r){return e==null||e!==e?r:e}var Ov=defaultTo;var Iv=Object.prototype;var Av=Iv.hasOwnProperty;var Ev=Jt(function(e,r){e=Object(e);var t=-1;var n=r.length;var a=n>2?r[2]:undefined;if(a&&tn(r[0],r[1],a)){n=1}while(++t=Kv){i=Xf;o=false;r=new Kf(r)}e:while(++a=0&&e.slice(t,a)==r}var md=endsWith;function baseToPairs(e,r){return U(r,function(r){return[r,e[r]]})}var _d=baseToPairs;function setToPairs(e){var r=-1,t=Array(e.size);e.forEach(function(e){t[++r]=[e,e]});return t}var wd=setToPairs;var xd="[object Map]",Sd="[object Set]";function createToPairs(e){return function(r){var t=cc(r);if(t==xd){return el(r)}if(t==Sd){return wd(r)}return _d(r,e(r))}}var jd=createToPairs;var Od=jd(pa);var Id=Od;var Ad=jd(Sa);var Ed=Ad;var Pd={"&":"&","<":"<",">":">",'"':""","'":"'"};var kd=Ko(Pd);var Cd=kd;var Rd=/[&<>"']/g,Wd=RegExp(Rd.source);function escape_escape(e){e=_i(e);return e&&Wd.test(e)?e.replace(Rd,Cd):e}var Td=escape_escape;var Md=/[\\^$.*+?()[\]{}|]/g,Bd=RegExp(Md.source);function escapeRegExp(e){e=_i(e);return e&&Bd.test(e)?e.replace(Md,"\\$&"):e}var Ld=escapeRegExp;function arrayEvery(e,r){var t=-1,n=e==null?0:e.length;while(++ta?0:a+t}n=n===undefined||n>a?a:ce(n);if(n<0){n+=a}n=t>n?0:Ud(n);while(t-1?a[i?r[o]:o]:undefined}}var Gd=createFind;var Kd=Math.max;function findIndex(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=t==null?0:ce(t);if(a<0){a=Kd(n+a,0)}return Br(e,Vl(r,3),a)}var Zd=findIndex;var Xd=Gd(Zd);var Yd=Xd;function baseFindKey(e,r,t){var n;t(e,function(e,t,a){if(r(e,t,a)){n=t;return false}});return n}var Jd=baseFindKey;function findKey(e,r){return Jd(e,Vl(r,3),av)}var Qd=findKey;var ep=Math.max,rp=Math.min;function findLastIndex(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=n-1;if(t!==undefined){a=ce(t);a=t<0?ep(n+a,0):rp(a,n-1)}return Br(e,Vl(r,3),a,true)}var tp=findLastIndex;var np=Gd(tp);var ap=np;function findLastKey(e,r){return Jd(e,Vl(r,3),hd)}var ip=findLastKey;function head(e){return e&&e.length?e[0]:undefined}var op=head;function baseMap(e,r){var t=-1,n=rn(e)?Array(e.length):[];uv(e,function(e,a,i){n[++t]=r(e,a,i)});return n}var up=baseMap;function map_map(e,r){var t=q(e)?U:up;return t(e,Vl(r,3))}var sp=map_map;function flatMap(e,r){return ki(sp(e,r),1)}var cp=flatMap;var fp=1/0;function flatMapDeep(e,r){return ki(sp(e,r),fp)}var lp=flatMapDeep;function flatMapDepth(e,r,t){t=t===undefined?1:ce(t);return ki(sp(e,r),t)}var vp=flatMapDepth;var dp=1/0;function flattenDeep(e){var r=e==null?0:e.length;return r?ki(e,dp):[]}var pp=flattenDeep;function flattenDepth(e,r){var t=e==null?0:e.length;if(!t){return[]}r=r===undefined?1:ce(r);return ki(e,r)}var hp=flattenDepth;var yp=512;function flip(e){return $t(e,yp)}var gp=flip;var bp=os("floor");var mp=bp;var _p="Expected a function";var wp=8,xp=32,Sp=128,jp=256;function createFlow(e){return Ri(function(r){var t=r.length,n=t,a=fr.prototype.thru;if(e){r.reverse()}while(n--){var i=r[n];if(typeof i!="function"){throw new TypeError(_p)}if(a&&!o&&cr(i)=="wrapper"){var o=new fr([],true)}}n=o?n:t;while(++nr}var Up=baseGt;function createRelationalOperation(e){return function(r,t){if(!(typeof r=="string"&&typeof t=="string")){r=ie(r);t=ie(t)}return e(r,t)}}var zp=createRelationalOperation;var qp=zp(Up);var Hp=qp;var Vp=zp(function(e,r){return e>=r});var Gp=Vp;var Kp=Object.prototype;var Zp=Kp.hasOwnProperty;function baseHas(e,r){return e!=null&&Zp.call(e,r)}var Xp=baseHas;function has(e,r){return e!=null&&Dl(e,r,Xp)}var Yp=has;var Jp=Math.max,Qp=Math.min;function baseInRange(e,r,t){return e>=Qp(r,t)&&e-1:!!a&&Fr(e,r,t)>-1}var uh=includes_includes;var sh=Math.max;function indexOf_indexOf(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=t==null?0:ce(t);if(a<0){a=sh(n+a,0)}return Fr(e,r,a)}var ch=indexOf_indexOf;function initial(e){var r=e==null?0:e.length;return r?so(e,0,-1):[]}var fh=initial;var lh=Math.min;function baseIntersection(e,r,t){var n=t?Gv:Nr,a=e[0].length,i=e.length,o=i,u=Array(i),s=Infinity,c=[];while(o--){var f=e[o];if(o&&r){f=U(f,Zn(r))}s=lh(f.length,s);u[o]=!t&&(r||a>=120&&f.length>=120)?new Kf(o&&f):undefined}f=e[0];var l=-1,v=u[0];e:while(++l=-xy&&e<=xy}var Sy=isSafeInteger;function isUndefined(e){return e===undefined}var jy=isUndefined;var Oy="[object WeakMap]";function isWeakMap(e){return L(e)&&cc(e)==Oy}var Iy=isWeakMap;var Ay="[object WeakSet]";function isWeakSet(e){return L(e)&&B(e)==Ay}var Ey=isWeakSet;var Py=1;function iteratee_iteratee(e){return Vl(typeof e=="function"?e:Cf(e,Py))}var ky=iteratee_iteratee;var Cy=Array.prototype;var Ry=Cy.join;function join(e,r){return e==null?"":Ry.call(e,r)}var Wy=join;var Ty=es(function(e,r,t){return e+(t?"-":"")+r.toLowerCase()});var My=Ty;var By=cv(function(e,r,t){qt(e,t,r)});var Ly=By;function strictLastIndexOf(e,r,t){var n=t+1;while(n--){if(e[n]===r){return n}}return n}var Dy=strictLastIndexOf;var Fy=Math.max,Ny=Math.min;function lastIndexOf(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=n;if(t!==undefined){a=ce(t);a=a<0?Fy(n+a,0):Ny(a,n-1)}return r===r?Dy(e,r,a):Br(e,Lr,a,true)}var $y=lastIndexOf;var Uy=es(function(e,r,t){return e+(t?" ":"")+r.toLowerCase()});var zy=Uy;var qy=zo("toLowerCase");var Hy=qy;function baseLt(e,r){return e=this.__values__.length,r=e?undefined:this.__values__[this.__index__++];return{done:e,value:r}}var Pg=wrapperNext;function baseNth(e,r){var t=e.length;if(!t){return}r+=r<0?t:0;return ct(r,t)?e[r]:undefined}var kg=baseNth;function nth(e,r){return e&&e.length?kg(e,ce(r)):undefined}var Cg=nth;function nthArg(e){e=ce(e);return Jt(function(r){return kg(r,e)})}var Rg=nthArg;function baseUnset(e,r){r=wi(r,e);e=Ch(e,r);return e==null||delete e[Si(Jv(r))]}var Wg=baseUnset;function customOmitClone(e){return zi(e)?undefined:e}var Tg=customOmitClone;var Mg=1,Bg=2,Lg=4;var Dg=Ri(function(e,r){var t={};if(e==null){return t}var n=false;r=U(r,function(r){r=wi(r,e);n||(n=r.length>1);return r});Zt(e,qs(e),t);if(n){t=Cf(t,Mg|Bg|Lg,Tg)}var a=r.length;while(a--){Wg(t,r[a])}return t});var Fg=Dg;function baseSet(e,r,t,n){if(!J(e)){return e}r=wi(r,e);var a=-1,i=r.length,o=i-1,u=e;while(u!=null&&++ar||i&&o&&s&&!u&&!c||n&&o&&s||!t&&s||!a){return 1}if(!n&&!i&&!c&&e=u){return s}var c=t[n];return s*(c=="desc"?-1:1)}}return e.index-r.index}var Gg=compareMultiple;function baseOrderBy(e,r,t){var n=-1;r=U(r.length?r:[ve],Zn(Vl));var a=up(e,function(e,t,a){var i=U(r,function(r){return r(e)});return{criteria:i,index:++n,value:e}});return Hg(a,function(e,r){return Gg(e,r,t)})}var Kg=baseOrderBy;function orderBy(e,r,t,n){if(e==null){return[]}if(!q(r)){r=r==null?[]:[r]}t=n?undefined:t;if(!q(t)){t=t==null?[]:[t]}return Kg(e,r,t)}var Zg=orderBy;function createOver(e){return Ri(function(r){r=U(r,Zn(Vl));return Jt(function(t){var n=this;return e(r,function(e){return Ge(e,n,t)})})})}var Xg=createOver;var Yg=Xg(U);var Jg=Yg;var Qg=Jt;var eb=Qg;var rb=Math.min;var tb=eb(function(e,r){r=r.length==1&&q(r[0])?U(r[0],Zn(Vl)):U(ki(r,1),Zn(Vl));var t=r.length;return Jt(function(n){var a=-1,i=rb(n.length,t);while(++asb){return t}do{if(r%2){t+=e}r=cb(r/2);if(r){e+=e}}while(r);return t}var fb=baseRepeat;var lb=zl("length");var vb=lb;var db="\\ud800-\\udfff",pb="\\u0300-\\u036f",hb="\\ufe20-\\ufe2f",yb="\\u20d0-\\u20ff",gb=pb+hb+yb,bb="\\ufe0e\\ufe0f";var mb="["+db+"]",_b="["+gb+"]",wb="\\ud83c[\\udffb-\\udfff]",xb="(?:"+_b+"|"+wb+")",Sb="[^"+db+"]",jb="(?:\\ud83c[\\udde6-\\uddff]){2}",Ob="[\\ud800-\\udbff][\\udc00-\\udfff]",Ib="\\u200d";var Ab=xb+"?",Eb="["+bb+"]?",Pb="(?:"+Ib+"(?:"+[Sb,jb,Ob].join("|")+")"+Eb+Ab+")*",kb=Eb+Ab+Pb,Cb="(?:"+[Sb+_b+"?",_b,jb,Ob,mb].join("|")+")";var Rb=RegExp(wb+"(?="+wb+")|"+Cb+kb,"g");function unicodeSize(e){var r=Rb.lastIndex=0;while(Rb.test(e)){++r}return r}var Wb=unicodeSize;function stringSize(e){return mo(e)?Wb(e):vb(e)}var Tb=stringSize;var Mb=Math.ceil;function createPadding(e,r){r=r===undefined?" ":K(r);var t=r.length;if(t<2){return t?fb(r,e):r}var n=fb(r,Mb(e/Tb(r)));return mo(r)?co(Uo(n),0,e).join(""):n.slice(0,e)}var Bb=createPadding;var Lb=Math.ceil,Db=Math.floor;function pad(e,r,t){e=_i(e);r=ce(r);var n=r?Tb(e):0;if(!r||n>=r){return e}var a=(r-n)/2;return Bb(Db(a),t)+e+Bb(Lb(a),t)}var Fb=pad;function padEnd(e,r,t){e=_i(e);r=ce(r);var n=r?Tb(e):0;return r&&n-1){if(u!==e){om.call(u,s,1)}om.call(e,s,1)}}return e}var um=basePullAll;function pullAll(e,r){return e&&e.length&&r&&r.length?um(e,r):e}var sm=pullAll;var cm=Jt(sm);var fm=cm;function pullAllBy(e,r,t){return e&&e.length&&r&&r.length?um(e,r,Vl(t,2)):e}var lm=pullAllBy;function pullAllWith(e,r,t){return e&&e.length&&r&&r.length?um(e,r,undefined,t):e}var vm=pullAllWith;var dm=Array.prototype;var pm=dm.splice;function basePullAt(e,r){var t=e?r.length:0,n=t-1;while(t--){var a=r[t];if(t==n||a!==i){var i=a;if(ct(a)){pm.call(e,a,1)}else{Wg(e,a)}}}return e}var hm=basePullAt;var ym=Ri(function(e,r){var t=e==null?0:e.length,n=Ii(e,r);hm(e,U(r,function(e){return ct(e,t)?+e:e}).sort(Vg));return n});var gm=ym;var bm=Math.floor,mm=Math.random;function baseRandom(e,r){return e+bm(mm()*(r-e+1))}var _m=baseRandom;var wm=parseFloat;var xm=Math.min,Sm=Math.random;function random(e,r,t){if(t&&typeof t!="boolean"&&tn(e,r,t)){r=t=undefined}if(t===undefined){if(typeof r=="boolean"){t=r;r=undefined}else if(typeof e=="boolean"){t=e;e=undefined}}if(e===undefined&&r===undefined){e=0;r=1}else{e=se(e);if(r===undefined){r=e;e=0}else{r=se(r)}}if(e>r){var n=e;e=r;r=n}if(t||e%1||r%1){var a=Sm();return xm(e+a*(r-e+wm("1e-"+((a+"").length-1))),r)}return _m(e,r)}var jm=random;var Om=Math.ceil,Im=Math.max;function baseRange(e,r,t,n){var a=-1,i=Im(Om((r-e)/(t||1)),0),o=Array(i);while(i--){o[n?i:++a]=e;e+=t}return o}var Am=baseRange;function createRange(e){return function(r,t,n){if(n&&typeof n!="number"&&tn(r,t,n)){t=n=undefined}r=se(r);if(t===undefined){t=r;r=0}else{t=se(t)}n=n===undefined?r1&&tn(e,r[0],r[1])){r=[]}else if(t>2&&tn(r[0],r[1],r[2])){r=[r[0]]}return Kg(e,ki(r,1),[])});var m_=b_;var __=4294967295,w_=__-1;var x_=Math.floor,S_=Math.min;function baseSortedIndexBy(e,r,t,n){r=t(r);var a=0,i=e==null?0:e.length,o=r!==r,u=r===null,s=F(r),c=r===undefined;while(a>>1;function baseSortedIndex(e,r,t){var n=0,a=e==null?n:e.length;if(typeof r=="number"&&r===r&&a<=I_){while(n>>1,o=e[i];if(o!==null&&!F(o)&&(t?o<=r:o>>0;if(!t){return[]}e=_i(e);if(e&&(typeof r=="string"||r!=null&&!wy(r))){r=K(r);if(!r&&mo(e)){return co(Uo(e),0,t)}}return e.split(r,t)}var D_=split;var F_="Expected a function";var N_=Math.max;function spread(e,r){if(typeof e!="function"){throw new TypeError(F_)}r=r==null?0:N_(ce(r),0);return Jt(function(t){var n=t[r],a=co(t,0,r);if(n){Ai(a,n)}return Ge(e,this,a)})}var $_=spread;var U_=es(function(e,r,t){return e+(t?" ":"")+Ho(r)});var z_=U_;function startsWith(e,r,t){e=_i(e);t=t==null?0:ds(ce(t),0,e.length);r=K(r);return e.slice(t,t+r.length)==r}var q_=startsWith;function stubObject(){return{}}var H_=stubObject;function stubString(){return""}var V_=stubString;function stubTrue(){return true}var G_=stubTrue;var K_=Z(function(e,r){return e-r},0);var Z_=K_;function sum(e){return e&&e.length?og(e,ve):0}var X_=sum;function sumBy(e,r){return e&&e.length?og(e,Vl(r,2)):0}var Y_=sumBy;function tail(e){var r=e==null?0:e.length;return r?so(e,1,r):[]}var J_=tail;function take(e,r,t){if(!(e&&e.length)){return[]}r=t||r===undefined?1:ce(r);return so(e,0,r<0?0:r)}var Q_=take;function takeRight(e,r,t){var n=e==null?0:e.length;if(!n){return[]}r=t||r===undefined?1:ce(r);r=n-r;return so(e,r<0?0:r,n)}var ew=takeRight;function takeRightWhile(e,r){return e&&e.length?ud(e,Vl(r,3),false,true):[]}var rw=takeRightWhile;function takeWhile(e,r){return e&&e.length?ud(e,Vl(r,3)):[]}var tw=takeWhile;function tap(e,r){r(e);return e}var nw=tap;var aw=Object.prototype;var iw=aw.hasOwnProperty;function customDefaultsAssignIn(e,r,t,n){if(e===undefined||Ht(e,aw[t])&&!iw.call(n,t)){return r}return e}var ow=customDefaultsAssignIn;var uw={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function escapeStringChar(e){return"\\"+uw[e]}var sw=escapeStringChar;var cw=/<%=([\s\S]+?)%>/g;var fw=cw;var lw=/<%-([\s\S]+?)%>/g;var vw=lw;var dw=/<%([\s\S]+?)%>/g;var pw=dw;var hw={escape:vw,evaluate:pw,interpolate:fw,variable:"",imports:{_:{escape:Td}}};var yw=hw;var gw=/\b__p \+= '';/g,bw=/\b(__p \+=) '' \+/g,mw=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var _w=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var ww=/($^)/;var xw=/['\n\r\u2028\u2029\\]/g;var Sw=Object.prototype;var jw=Sw.hasOwnProperty;function template(e,r,t){var n=yw.imports._.templateSettings||yw;if(t&&tn(e,r,t)){r=undefined}e=_i(e);r=Aa({},r,n,ow);var a=Aa({},r.imports,n.imports,ow),i=pa(a),o=ah(a,i);var u,s,c=0,f=r.interpolate||ww,l="__p += '";var v=RegExp((r.escape||ww).source+"|"+f.source+"|"+(f===fw?_w:ww).source+"|"+(r.evaluate||ww).source+"|$","g");var d=jw.call(r,"sourceURL")?"//# sourceURL="+(r.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";e.replace(v,function(r,t,n,a,i,o){n||(n=a);l+=e.slice(c,o).replace(xw,sw);if(t){u=true;l+="' +\n__e("+t+") +\n'"}if(i){s=true;l+="';\n"+i+";\n__p += '"}if(n){l+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"}c=o+r.length;return r});l+="';\n";var p=jw.call(r,"variable")&&r.variable;if(!p){l="with (obj) {\n"+l+"\n}\n"}l=(s?l.replace(gw,""):l).replace(bw,"$1").replace(mw,"$1;");l="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var h=Ki(function(){return Function(i,d+"return "+l).apply(undefined,o)});h.source=l;if(Vi(h)){throw h}return h}var Ow=template;var Iw="Expected a function";function throttle(e,r,t){var n=true,a=true;if(typeof e!="function"){throw new TypeError(Iw)}if(J(t)){n="leading"in t?!!t.leading:n;a="trailing"in t?!!t.trailing:a}return jv(e,r,{leading:n,maxWait:r,trailing:a})}var Aw=throttle;function thru(e,r){return r(e)}var Ew=thru;var Pw=9007199254740991;var kw=4294967295;var Cw=Math.min;function times(e,r){e=ce(e);if(e<1||e>Pw){return[]}var t=kw,n=Cw(e,kw);r=fd(r);e-=kw;var a=un(n,r);while(++t-1){}return t}var Uw=charsEndIndex;function charsStartIndex(e,r){var t=-1,n=e.length;while(++t-1){}return t}var zw=charsStartIndex;var qw=/^\s+|\s+$/g;function trim(e,r,t){e=_i(e);if(e&&(t||r===undefined)){return e.replace(qw,"")}if(!e||!(r=K(r))){return e}var n=Uo(e),a=Uo(r),i=zw(n,a),o=Uw(n,a)+1;return co(n,i,o).join("")}var Hw=trim;var Vw=/\s+$/;function trimEnd(e,r,t){e=_i(e);if(e&&(t||r===undefined)){return e.replace(Vw,"")}if(!e||!(r=K(r))){return e}var n=Uo(e),a=Uw(n,Uo(r))+1;return co(n,0,a).join("")}var Gw=trimEnd;var Kw=/^\s+/;function trimStart(e,r,t){e=_i(e);if(e&&(t||r===undefined)){return e.replace(Kw,"")}if(!e||!(r=K(r))){return e}var n=Uo(e),a=zw(n,Uo(r));return co(n,a).join("")}var Zw=trimStart;var Xw=30,Yw="...";var Jw=/\w*$/;function truncate(e,r){var t=Xw,n=Yw;if(J(r)){var a="separator"in r?r.separator:a;t="length"in r?ce(r.length):t;n="omission"in r?K(r.omission):n}e=_i(e);var i=e.length;if(mo(e)){var o=Uo(e);i=o.length}if(t>=i){return e}var u=t-Tb(n);if(u<1){return n}var s=o?co(o,0,u).join(""):e.slice(0,u);if(a===undefined){return s+n}if(o){u+=s.length-u}if(wy(a)){if(e.slice(u).search(a)){var c,f=s;if(!a.global){a=RegExp(a.source,_i(Jw.exec(a))+"g")}a.lastIndex=0;while(c=a.exec(f)){var l=c.index}s=s.slice(0,l===undefined?u:l)}}else if(e.indexOf(K(a),u)!=u){var v=s.lastIndexOf(a);if(v>-1){s=s.slice(0,v)}}return s+n}var Qw=truncate;function unary(e){return zt(e,1)}var ex=unary;var rx={"&":"&","<":"<",">":">",""":'"',"'":"'"};var tx=Ko(rx);var nx=tx;var ax=/&(?:amp|lt|gt|quot|#39);/g,ix=RegExp(ax.source);function unescape_unescape(e){e=_i(e);return e&&ix.test(e)?e.replace(ax,nx):e}var ox=unescape_unescape;var ux=1/0;var sx=!(Xs&&1/rl(new Xs([,-0]))[1]==ux)?tr:function(e){return new Xs(e)};var cx=sx;var fx=200;function baseUniq(e,r,t){var n=-1,a=Nr,i=e.length,o=true,u=[],s=u;if(t){o=false;a=Gv}else if(i>=fx){var c=r?null:cx(e);if(c){return rl(c)}o=false;a=Xf;s=new Kf}else{s=r?[]:u}e:while(++n1||this.__actions__.length||!(n instanceof rr)||!ct(t)){return this.thru(a)}n=n.slice(t,+t+(r?1:0));n.__actions__.push({func:Ew,args:[a],thisArg:undefined});return new fr(n,this.__chain__).thru(function(e){if(r&&!e.length){e.push(undefined)}return e})});var Lx=Bx;function wrapperChain(){return cs(this)}var Dx=wrapperChain;function wrapperReverse(){var e=this.__wrapped__;if(e instanceof rr){var r=e;if(this.__actions__.length){r=new rr(this)}r=r.reverse();r.__actions__.push({func:Ew,args:[Zm],thisArg:undefined});return new fr(r,this.__chain__)}return this.thru(Zm)}var Fx=wrapperReverse;function baseXor(e,r,t){var n=e.length;if(n<2){return n?lx(e[0]):[]}var a=-1,i=Array(n);while(++a1?e[r-1]:undefined;t=typeof t=="function"?(e.pop(),t):undefined;return Ix(e,t)});var Qx=Jx;var eS={chunk:vs,compact:zf,concat:qf,difference:Yv,differenceBy:ed,differenceWith:td,drop:id,dropRight:od,dropRightWhile:sd,dropWhile:cd,fill:qd,findIndex:Zd,findLastIndex:tp,first:op,flatten:Ci,flattenDeep:pp,flattenDepth:hp,fromPairs:Tp,head:op,indexOf:ch,initial:fh,intersection:hh,intersectionBy:gh,intersectionWith:mh,join:Wy,last:Jv,lastIndexOf:$y,nth:Cg,pull:fm,pullAll:sm,pullAllBy:lm,pullAllWith:vm,pullAt:gm,remove:$m,reverse:Zm,slice:d_,sortedIndex:E_,sortedIndexBy:P_,sortedIndexOf:k_,sortedLastIndex:C_,sortedLastIndexBy:R_,sortedLastIndexOf:W_,sortedUniq:M_,sortedUniqBy:B_,tail:J_,take:Q_,takeRight:ew,takeRightWhile:rw,takeWhile:tw,union:dx,unionBy:hx,unionWith:gx,uniq:bx,uniqBy:mx,uniqWith:_x,unzip:Ox,unzipWith:Ix,without:Tx,xor:Ux,xorBy:qx,xorWith:Vx,zip:Kx,zipObject:Xx,zipObjectDeep:Yx,zipWith:Qx};var rS={countBy:dv,each:ld,eachRight:bd,every:Nd,filter:Vd,find:Yd,findLast:ap,flatMap:cp,flatMapDeep:lp,flatMapDepth:vp,forEach:ld,forEachRight:bd,groupBy:$p,includes:uh,invokeMap:Bh,keyBy:Ly,map:sp,orderBy:Zg,partition:Jb,reduce:Lm,reduceRight:Fm,reject:Nm,sample:e_,sampleSize:a_,shuffle:c_,size:v_,some:g_,sortBy:m_};var tS={now:_v};var nS={after:le,ary:zt,before:Xi,bind:eo,bindKey:uo,curry:yv,curryRight:bv,debounce:jv,defer:qv,delay:Vv,flip:gp,memoize:di,negate:Sg,once:qg,overArgs:nb,partial:Gb,partialRight:Xb,rearg:Mm,rest:Hm,spread:$_,throttle:Aw,unary:ex,wrap:Mx};var aS={castArray:ns,clone:Wf,cloneDeep:Bf,cloneDeepWith:Ff,cloneWith:$f,conformsTo:Ql,eq:Ht,gt:Hp,gte:Gp,isArguments:pn,isArray:q,isArrayBuffer:$h,isArrayLike:rn,isArrayLikeObject:Cv,isBoolean:zh,isBuffer:xn,isDate:Kh,isElement:Zh,isEmpty:ey,isEqual:ry,isEqualWith:ty,isError:Vi,isFinite:ay,isFunction:ge,isInteger:iy,isLength:en,isMap:Kc,isMatch:oy,isMatchWith:uy,isNaN:fy,isNative:py,isNil:hy,isNull:yy,isNumber:cy,isObject:J,isObjectLike:L,isPlainObject:zi,isRegExp:wy,isSafeInteger:Sy,isSet:Qc,isString:nh,isSymbol:F,isTypedArray:aa,isUndefined:jy,isWeakMap:Iy,isWeakSet:Ey,lt:Ky,lte:Xy,toArray:Eg,toFinite:se,toInteger:ce,toLength:Ud,toNumber:ie,toPlainObject:Wv,toSafeInteger:Fw,toString:_i};var iS={add:Y,ceil:ss,divide:ad,floor:mp,max:ag,maxBy:ig,mean:cg,meanBy:fg,min:gg,minBy:bg,multiply:wg,round:Ym,subtract:Z_,sum:X_,sumBy:Y_};var oS={clamp:ps,inRange:rh,random:jm};var uS={assign:ba,assignIn:Oa,assignInWith:Aa,assignWith:Pa,at:Ti,create:pv,defaults:Pv,defaultsDeep:Nv,entries:Id,entriesIn:Ed,extend:Oa,extendWith:Aa,findKey:Qd,findLastKey:ip,forIn:kp,forInRight:Cp,forOwn:Rp,forOwnRight:Wp,functions:Bp,functionsIn:Lp,get:Oi,has:Yp,hasIn:Fl,invert:Oh,invertBy:kh,invoke:Th,keys:pa,keysIn:Sa,mapKeys:Yy,mapValues:Jy,merge:vg,mergeWith:Dv,omit:Fg,omitBy:zg,pick:rm,pickBy:Ug,result:Vm,set:i_,setWith:o_,toPairs:Id,toPairsIn:Ed,transform:$w,unset:Sx,update:Ex,updateWith:Px,values:ih,valuesIn:Rx};var sS={at:Lx,chain:cs,commit:Uf,lodash:hr,next:Pg,plant:tm,reverse:Fx,tap:nw,thru:Ew,toIterator:Ww,toJSON:Mw,value:Mw,valueOf:Mw,wrapperChain:Dx};var cS={camelCase:ts,capitalize:Vo,deburr:iu,endsWith:md,escape:Td,escapeRegExp:Ld,kebabCase:My,lowerCase:zy,lowerFirst:Hy,pad:Fb,padEnd:Nb,padStart:$b,parseInt:qb,repeat:Um,replace:zm,snakeCase:h_,split:D_,startCase:z_,startsWith:q_,template:Ow,templateSettings:yw,toLower:Bw,toUpper:Nw,trim:Hw,trimEnd:Gw,trimStart:Zw,truncate:Qw,unescape:ox,upperCase:Cx,upperFirst:Ho,words:Yu};var fS={attempt:Ki,bindAll:to,cond:Kl,conforms:Jl,constant:Er,defaultTo:Ov,flow:Ap,flowRight:Pp,identity:ve,iteratee:ky,matches:eg,matchesProperty:tg,method:pg,methodOf:yg,mixin:mg,noop:tr,nthArg:Rg,over:Jg,overEvery:ib,overSome:ub,property:Hl,propertyOf:nm,range:km,rangeRight:Rm,stubArray:Cs,stubFalse:hn,stubObject:H_,stubString:V_,stubTrue:G_,times:Rw,toPath:Lw,uniqueId:xx};function lazyClone(){var e=new rr(this.__wrapped__);e.__actions__=lr(this.__actions__);e.__dir__=this.__dir__;e.__filtered__=this.__filtered__;e.__iteratees__=lr(this.__iteratees__);e.__takeCount__=this.__takeCount__;e.__views__=lr(this.__views__);return e}var lS=lazyClone;function lazyReverse(){if(this.__filtered__){var e=new rr(this);e.__dir__=-1;e.__filtered__=true}else{e=this.clone();e.__dir__*=-1}return e}var vS=lazyReverse;var dS=Math.max,pS=Math.min;function getView(e,r,t){var n=-1,a=t.length;while(++n0||r<0)){return new rr(t)}if(e<0){t=t.takeRight(-e)}else if(e){t=t.drop(e)}if(r!==undefined){r=ce(r);t=r<0?t.dropRight(-r):t.take(r-e)}return t};rr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()};rr.prototype.toArray=function(){return this.take(jS)};av(rr.prototype,function(e,r){var t=/^(?:filter|find|map|reject)|While$/.test(r),n=/^(?:head|last)$/.test(r),a=hr[n?"take"+(r=="last"?"Right":""):r],i=n||/^find/.test(r);if(!a){return}hr.prototype[r]=function(){var r=this.__wrapped__,o=n?[1]:arguments,u=r instanceof rr,s=o[0],c=u||q(r);var f=function(e){var r=a.apply(hr,Ai([e],o));return n&&l?r[0]:r};if(c&&t&&typeof s=="function"&&s.length!=1){u=c=false}var l=this.__chain__,v=!!this.__actions__.length,d=i&&!l,p=u&&!v;if(!i&&c){r=p?r:new rr(this);var h=e.apply(r,o);h.__actions__.push({func:Ew,args:[f],thisArg:undefined});return new fr(h,l)}if(d&&p){return e.apply(this,o)}h=this.thru(f);return d?n?h.value()[0]:h.value():h}});Mr(["pop","push","shift","sort","splice","unshift"],function(e){var r=OS[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);hr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var a=this.value();return r.apply(q(a)?a:[],e)}return this[t](function(t){return r.apply(q(t)?t:[],e)})}});av(rr.prototype,function(e,r){var t=hr[r];if(t){var n=t.name+"";if(!AS.call(or,n)){or[n]=[]}or[n].push({name:r,func:t})}});or[_t(undefined,wS).name]=[{name:"wrapper",func:undefined}];rr.prototype.clone=lS;rr.prototype.reverse=vS;rr.prototype.value=mS;hr.prototype.at=sS.at;hr.prototype.chain=sS.wrapperChain;hr.prototype.commit=sS.commit;hr.prototype.next=sS.next;hr.prototype.plant=sS.plant;hr.prototype.reverse=sS.reverse;hr.prototype.toJSON=hr.prototype.valueOf=hr.prototype.value=sS.value;hr.prototype.first=hr.prototype.head;if(ES){hr.prototype[ES]=sS.toIterator}var RS=hr;class image_tag_ImageTag{constructor(e){const{repository:r="gableroux",name:t="unity3d",version:n="2019.2.11f1",platform:a}=e;if(!image_tag_ImageTag.versionPattern.test(n)){throw new Error(`Invalid version "${n}".`)}if(!Yp(image_tag_ImageTag.targetPlatformToImageSuffixMap,a)){throw new Error(`Platform "${a}" is currently not supported.`)}const i=Oi(image_tag_ImageTag.targetPlatformToImageSuffixMap,a,image_tag_ImageTag.imageSuffixes.generic);Object.assign(this,{repository:r,name:t,version:n,platform:a,builderPlatform:i})}static get versionPattern(){return/^20\d{2}\.\d\.\w{3,4}|3$/}static get imageSuffixes(){return{generic:"",webgl:"webgl",mac:"mac",windows:"windows",android:"android",ios:"ios",facebook:"facebook"}}static get targetPlatformToImageSuffixMap(){const{generic:e,webgl:r,mac:t,windows:n,android:a,ios:i,facebook:u}=image_tag_ImageTag.imageSuffixes;return{[o.types.StandaloneOSX]:t,[o.types.StandaloneWindows]:n,[o.types.StandaloneWindows64]:n,[o.types.StandaloneLinux64]:n,[o.types.iOS]:i,[o.types.Android]:a,[o.types.WebGL]:r,[o.types.WSAPlayer]:n,[o.types.PS4]:n,[o.types.XboxOne]:n,[o.types.tvOS]:n,[o.types.Switch]:n,[o.types.Lumin]:n,[o.types.BJM]:n,[o.types.Stadia]:n,[o.types.Facebook]:u,[o.types.NoTarget]:e,[o.types.Test]:e}}get tag(){return Gw(`${this.version}-${this.builderPlatform}`,"-")}get image(){return Zw(`${this.repository}/${this.name}`,"/")}toString(){const{image:e,tag:r}=this;return`${e}:${r}`}}var WS=image_tag_ImageTag;class docker_Docker{static async build(e,r=false){const{path:t,dockerfile:n,baseImage:a}=e;const{version:i,platform:o}=a;const u=new WS({repository:"",name:"unity-builder",version:i,platform:o});const s=`docker build ${t} --file ${n} --build-arg IMAGE=${a} --tag ${u}`;await Object(g.exec)(s,null,{silent:r});return u}static async run(e,r,t=false){const{unityVersion:n,workspace:a,platform:i,projectPath:o,buildName:u,buildPath:s,buildFile:c,buildMethod:f,versioning:l,version:v,customParameters:d}=r;const p=`docker run --workdir /github/workspace --rm --env UNITY_LICENSE --env UNITY_LICENSE_FILE --env UNITY_EMAIL --env UNITY_PASSWORD --env UNITY_SERIAL --env UNITY_VERSION="${n}" --env PROJECT_PATH="${o}" --env BUILD_TARGET="${i}" --env BUILD_NAME="${u}" --env BUILD_PATH="${s}" --env BUILD_FILE="${c}" --env BUILD_METHOD="${f}" --env VERSIONING="${l}" --env VERSION="${v}" --env CUSTOM_PARAMETERS="${d}" --env HOME=/github/home --env GITHUB_REF --env GITHUB_SHA --env GITHUB_REPOSITORY --env GITHUB_ACTOR --env GITHUB_WORKFLOW --env GITHUB_HEAD_REF --env GITHUB_BASE_REF --env GITHUB_EVENT_NAME --env GITHUB_WORKSPACE=/github/workspace --env GITHUB_ACTION --env GITHUB_EVENT_PATH --env RUNNER_OS --env RUNNER_TOOL_CACHE --env RUNNER_TEMP --env RUNNER_WORKSPACE --volume "/var/run/docker.sock":"/var/run/docker.sock" --volume "/home/runner/work/_temp/_github_home":"/github/home" --volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" --volume "${a}":"/github/workspace" ${e}`;await Object(g.exec)(p,null,{silent:t})}}var TS=docker_Docker;const MS=t(470);async function src_action(){i.checkCompatibility();y.verify();const{dockerfile:e,workspace:r,actionFolder:t}=i;const n=u.create(p.getFromUser());const a=new WS({...n,version:n.unityVersion});const o=await TS.build({path:t,dockerfile:e,baseImage:a});await TS.run(o,{workspace:r,...n})}src_action().catch(e=>{MS.setFailed(e.message)})},986:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:true});const a=t(9);function exec(e,r,t){return n(this,void 0,void 0,function*(){const n=a.argStringToArray(e);if(n.length===0){throw new Error(`Parameter 'commandLine' cannot be null or empty.`)}const i=n[0];r=n.slice(1).concat(r||[]);const o=new a.ToolRunner(i,r,t);return o.exec()})}r.exec=exec}},function(e){"use strict";!function(){e.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}}();!function(){var r=Object.prototype.hasOwnProperty;e.d=function(e,t,n){if(!r.call(e,t)){Object.defineProperty(e,t,{enumerable:true,get:n})}}}();!function(){e.t=function(r,t){if(t&1)r=this(r);if(t&8)return r;if(t&4&&typeof r==="object"&&r&&r.__esModule)return r;var n=Object.create(null);e.r(n);Object.defineProperty(n,"default",{enumerable:true,value:r});if(t&2&&typeof r!="string")for(var a in r)e.d(n,a,function(e){return r[e]}.bind(null,a));return n}}();!function(){e.n=function(r){var t=r&&r.__esModule?function getDefault(){return r["default"]}:function getModuleExports(){return r};e.d(t,"a",t);return t}}();!function(){e.hmd=function(e){e=Object.create(e);if(!e.children)e.children=[];Object.defineProperty(e,"loaded",{enumerable:true,get:function(){return e.l}});Object.defineProperty(e,"id",{enumerable:true,get:function(){return e.i}});Object.defineProperty(e,"exports",{enumerable:true,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}});return e}}()}); \ No newline at end of file +module.exports=function(e,r){"use strict";var t={};function __webpack_require__(r){if(t[r]){return t[r].exports}var n=t[r]={i:r,l:false,exports:{}};e[r].call(n.exports,n,n.exports,__webpack_require__);n.l=true;return n.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(11)}r(__webpack_require__);return startup()}({1:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:true});const a=t(129);const i=t(622);const o=t(669);const u=t(672);const s=o.promisify(a.exec);function cp(e,r,t={}){return n(this,void 0,void 0,function*(){const{force:n,recursive:a}=readCopyOptions(t);const o=(yield u.exists(r))?yield u.stat(r):null;if(o&&o.isFile()&&!n){return}const s=o&&o.isDirectory()?i.join(r,i.basename(e)):r;if(!(yield u.exists(e))){throw new Error(`no such file or directory: ${e}`)}const c=yield u.stat(e);if(c.isDirectory()){if(!a){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,n)}}else{if(i.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,n)}})}r.cp=cp;function mv(e,r,t={}){return n(this,void 0,void 0,function*(){if(yield u.exists(r)){let n=true;if(yield u.isDirectory(r)){r=i.join(r,i.basename(e));n=yield u.exists(r)}if(n){if(t.force==null||t.force){yield rmRF(r)}else{throw new Error("Destination already exists")}}}yield mkdirP(i.dirname(r));yield u.rename(e,r)})}r.mv=mv;function rmRF(e){return n(this,void 0,void 0,function*(){if(u.IS_WINDOWS){try{if(yield u.isDirectory(e,true)){yield s(`rd /s /q "${e}"`)}else{yield s(`del /f /a "${e}"`)}}catch(e){if(e.code!=="ENOENT")throw e}try{yield u.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let r=false;try{r=yield u.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(r){yield s(`rm -rf "${e}"`)}else{yield u.unlink(e)}}})}r.rmRF=rmRF;function mkdirP(e){return n(this,void 0,void 0,function*(){yield u.mkdirP(e)})}r.mkdirP=mkdirP;function which(e,r){return n(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(r){const r=yield which(e,false);if(!r){if(u.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}}try{const r=[];if(u.IS_WINDOWS&&process.env.PATHEXT){for(const e of process.env.PATHEXT.split(i.delimiter)){if(e){r.push(e)}}}if(u.isRooted(e)){const t=yield u.tryGetExecutablePath(e,r);if(t){return t}return""}if(e.includes("/")||u.IS_WINDOWS&&e.includes("\\")){return""}const t=[];if(process.env.PATH){for(const e of process.env.PATH.split(i.delimiter)){if(e){t.push(e)}}}for(const n of t){const t=yield u.tryGetExecutablePath(n+i.sep+e,r);if(t){return t}}return""}catch(e){throw new Error(`which failed with message ${e.message}`)}})}r.which=which;function readCopyOptions(e){const r=e.force==null?true:e.force;const t=Boolean(e.recursive);return{force:r,recursive:t}}function cpDirRecursive(e,r,t,a){return n(this,void 0,void 0,function*(){if(t>=255)return;t++;yield mkdirP(r);const n=yield u.readdir(e);for(const i of n){const n=`${e}/${i}`;const o=`${r}/${i}`;const s=yield u.lstat(n);if(s.isDirectory()){yield cpDirRecursive(n,o,t,a)}else{yield copyFile(n,o,a)}}yield u.chmod(r,(yield u.stat(e)).mode)})}function copyFile(e,r,t){return n(this,void 0,void 0,function*(){if((yield u.lstat(e)).isSymbolicLink()){try{yield u.lstat(r);yield u.unlink(r)}catch(e){if(e.code==="EPERM"){yield u.chmod(r,"0666");yield u.unlink(r)}}const t=yield u.readlink(e);yield u.symlink(t,r,u.IS_WINDOWS?"junction":null)}else if(!(yield u.exists(r))||t){yield u.copyFile(e,r)}})}},9:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:true});const a=t(87);const i=t(614);const o=t(129);const u=t(622);const s=t(1);const c=t(672);const f=process.platform==="win32";class ToolRunner extends i.EventEmitter{constructor(e,r,t){super();if(!e){throw new Error("Parameter 'toolPath' cannot be null or empty.")}this.toolPath=e;this.args=r||[];this.options=t||{}}_debug(e){if(this.options.listeners&&this.options.listeners.debug){this.options.listeners.debug(e)}}_getCommandString(e,r){const t=this._getSpawnFileName();const n=this._getSpawnArgs(e);let a=r?"":"[command]";if(f){if(this._isCmdFile()){a+=t;for(const e of n){a+=` ${e}`}}else if(e.windowsVerbatimArguments){a+=`"${t}"`;for(const e of n){a+=` ${e}`}}else{a+=this._windowsQuoteCmdArg(t);for(const e of n){a+=` ${this._windowsQuoteCmdArg(e)}`}}}else{a+=t;for(const e of n){a+=` ${e}`}}return a}_processLineBuffer(e,r,t){try{let n=r+e.toString();let i=n.indexOf(a.EOL);while(i>-1){const e=n.substring(0,i);t(e);n=n.substring(i+a.EOL.length);i=n.indexOf(a.EOL)}r=n}catch(e){this._debug(`error processing line. Failed with error ${e}`)}}_getSpawnFileName(){if(f){if(this._isCmdFile()){return process.env["COMSPEC"]||"cmd.exe"}}return this.toolPath}_getSpawnArgs(e){if(f){if(this._isCmdFile()){let r=`/D /S /C "${this._windowsQuoteCmdArg(this.toolPath)}`;for(const t of this.args){r+=" ";r+=e.windowsVerbatimArguments?t:this._windowsQuoteCmdArg(t)}r+='"';return[r]}}return this.args}_endsWith(e,r){return e.endsWith(r)}_isCmdFile(){const e=this.toolPath.toUpperCase();return this._endsWith(e,".CMD")||this._endsWith(e,".BAT")}_windowsQuoteCmdArg(e){if(!this._isCmdFile()){return this._uvQuoteCmdArg(e)}if(!e){return'""'}const r=[" ","\t","&","(",")","[","]","{","}","^","=",";","!","'","+",",","`","~","|","<",">",'"'];let t=false;for(const n of e){if(r.some(e=>e===n)){t=true;break}}if(!t){return e}let n='"';let a=true;for(let r=e.length;r>0;r--){n+=e[r-1];if(a&&e[r-1]==="\\"){n+="\\"}else if(e[r-1]==='"'){a=true;n+='"'}else{a=false}}n+='"';return n.split("").reverse().join("")}_uvQuoteCmdArg(e){if(!e){return'""'}if(!e.includes(" ")&&!e.includes("\t")&&!e.includes('"')){return e}if(!e.includes('"')&&!e.includes("\\")){return`"${e}"`}let r='"';let t=true;for(let n=e.length;n>0;n--){r+=e[n-1];if(t&&e[n-1]==="\\"){r+="\\"}else if(e[n-1]==='"'){t=true;r+="\\"}else{t=false}}r+='"';return r.split("").reverse().join("")}_cloneExecOptions(e){e=e||{};const r={cwd:e.cwd||process.cwd(),env:e.env||process.env,silent:e.silent||false,windowsVerbatimArguments:e.windowsVerbatimArguments||false,failOnStdErr:e.failOnStdErr||false,ignoreReturnCode:e.ignoreReturnCode||false,delay:e.delay||1e4};r.outStream=e.outStream||process.stdout;r.errStream=e.errStream||process.stderr;return r}_getSpawnOptions(e,r){e=e||{};const t={};t.cwd=e.cwd;t.env=e.env;t["windowsVerbatimArguments"]=e.windowsVerbatimArguments||this._isCmdFile();if(e.windowsVerbatimArguments){t.argv0=`"${r}"`}return t}exec(){return n(this,void 0,void 0,function*(){if(!c.isRooted(this.toolPath)&&(this.toolPath.includes("/")||f&&this.toolPath.includes("\\"))){this.toolPath=u.resolve(process.cwd(),this.options.cwd||process.cwd(),this.toolPath)}this.toolPath=yield s.which(this.toolPath,true);return new Promise((e,r)=>{this._debug(`exec tool: ${this.toolPath}`);this._debug("arguments:");for(const e of this.args){this._debug(` ${e}`)}const t=this._cloneExecOptions(this.options);if(!t.silent&&t.outStream){t.outStream.write(this._getCommandString(t)+a.EOL)}const n=new ExecState(t,this.toolPath);n.on("debug",e=>{this._debug(e)});const i=this._getSpawnFileName();const u=o.spawn(i,this._getSpawnArgs(t),this._getSpawnOptions(this.options,i));const s="";if(u.stdout){u.stdout.on("data",e=>{if(this.options.listeners&&this.options.listeners.stdout){this.options.listeners.stdout(e)}if(!t.silent&&t.outStream){t.outStream.write(e)}this._processLineBuffer(e,s,e=>{if(this.options.listeners&&this.options.listeners.stdline){this.options.listeners.stdline(e)}})})}const c="";if(u.stderr){u.stderr.on("data",e=>{n.processStderr=true;if(this.options.listeners&&this.options.listeners.stderr){this.options.listeners.stderr(e)}if(!t.silent&&t.errStream&&t.outStream){const r=t.failOnStdErr?t.errStream:t.outStream;r.write(e)}this._processLineBuffer(e,c,e=>{if(this.options.listeners&&this.options.listeners.errline){this.options.listeners.errline(e)}})})}u.on("error",e=>{n.processError=e.message;n.processExited=true;n.processClosed=true;n.CheckComplete()});u.on("exit",e=>{n.processExitCode=e;n.processExited=true;this._debug(`Exit code ${e} received from tool '${this.toolPath}'`);n.CheckComplete()});u.on("close",e=>{n.processExitCode=e;n.processExited=true;n.processClosed=true;this._debug(`STDIO streams have closed for tool '${this.toolPath}'`);n.CheckComplete()});n.on("done",(t,n)=>{if(s.length>0){this.emit("stdline",s)}if(c.length>0){this.emit("errline",c)}u.removeAllListeners();if(t){r(t)}else{e(n)}})})})}}r.ToolRunner=ToolRunner;function argStringToArray(e){const r=[];let t=false;let n=false;let a="";function append(e){if(n&&e!=='"'){a+="\\"}a+=e;n=false}for(let i=0;i0){r.push(a);a=""}continue}append(o)}if(a.length>0){r.push(a.trim())}return r}r.argStringToArray=argStringToArray;class ExecState extends i.EventEmitter{constructor(e,r){super();this.processClosed=false;this.processError="";this.processExitCode=0;this.processExited=false;this.processStderr=false;this.delay=1e4;this.done=false;this.timeout=null;if(!r){throw new Error("toolPath must not be empty")}this.options=e;this.toolPath=r;if(e.delay){this.delay=e.delay}}CheckComplete(){if(this.done){return}if(this.processClosed){this._setResult()}else if(this.processExited){this.timeout=setTimeout(ExecState.HandleTimeout,this.delay,this)}}_debug(e){this.emit("debug",e)}_setResult(){let e;if(this.processExited){if(this.processError){e=new Error(`There was an error when attempting to execute the process '${this.toolPath}'. This may indicate the process failed to start. Error: ${this.processError}`)}else if(this.processExitCode!==0&&!this.options.ignoreReturnCode){e=new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`)}else if(this.processStderr&&this.options.failOnStdErr){e=new Error(`The process '${this.toolPath}' failed because one or more lines were written to the STDERR stream`)}}if(this.timeout){clearTimeout(this.timeout);this.timeout=null}this.done=true;this.emit("done",e,this.processExitCode)}static HandleTimeout(e){if(e.done){return}if(!e.processClosed&&e.processExited){const r=`The STDIO streams did not close within ${e.delay/1e3} seconds of the exit event from process '${e.toolPath}'. This may indicate a child process inherited the STDIO streams and has not yet exited.`;e._debug(r)}e._setResult()}}},11:function(e,r,t){"use strict";t.r(r);var n=t(622);var a=t.n(n);class action_Action{static get supportedPlatforms(){return["linux"]}static get isRunningLocally(){return process.env.RUNNER_WORKSPACE===undefined}static get isRunningFromSource(){return a().basename(__dirname)==="model"}static get name(){return"unity-builder"}static get rootFolder(){if(action_Action.isRunningFromSource){return a().dirname(a().dirname(a().dirname(__filename)))}return a().dirname(a().dirname(__filename))}static get actionFolder(){return`${action_Action.rootFolder}/action`}static get dockerfile(){return`${action_Action.actionFolder}/Dockerfile`}static get workspace(){return process.env.GITHUB_WORKSPACE}static checkCompatibility(){const e=process.platform;if(!action_Action.supportedPlatforms.includes(e)){throw new Error(`Currently ${e}-platform is not supported`)}}}var i=action_Action;class Platform{static get default(){return Platform.types.StandaloneWindows64}static get types(){return{StandaloneOSX:"StandaloneOSX",StandaloneWindows:"StandaloneWindows",StandaloneWindows64:"StandaloneWindows64",StandaloneLinux64:"StandaloneLinux64",iOS:"iOS",Android:"Android",WebGL:"WebGL",WSAPlayer:"WSAPlayer",PS4:"PS4",XboxOne:"XboxOne",tvOS:"tvOS",Switch:"Switch",Lumin:"Lumin",BJM:"BJM",Stadia:"Stadia",Facebook:"Facebook",NoTarget:"NoTarget",Test:"Test"}}static isWindows(e){switch(e){case Platform.types.StandaloneWindows:case Platform.types.StandaloneWindows64:return true;default:return false}}static isAndroid(e){switch(e){case Platform.types.Android:return true;default:return false}}}var o=Platform;class build_parameters_BuildParameters{static create(e){const{version:r,targetPlatform:t,projectPath:n,buildName:a,buildsPath:i,buildMethod:o,buildVersion:u,customParameters:s}=e;return{version:r,platform:t,projectPath:n,buildName:a,buildPath:`${i}/${t}`,buildFile:this.parseBuildFile(a,t),buildMethod:o,buildVersion:u,customParameters:s}}static parseBuildFile(e,r){if(o.isWindows(r)){return`${e}.exe`}if(o.isAndroid(r)){return`${e}.apk`}return e}}var u=build_parameters_BuildParameters;var s=t(747);var c=t.n(s);class Unity{static get libraryFolder(){return"Library"}}var f=Unity;var l=t(470);var v=t(986);class NotImplementedException extends Error{constructor(e){super(e);this.name="NotImplementedException"}}var d=NotImplementedException;class ValidationError extends Error{constructor(e){super(e);this.name="ValidationError"}}var p=ValidationError;class system_System{static async run(e,r,t){let n="";let a="";const i={stdout:e=>{n+=e.toString()},stderr:e=>{a+=e.toString()}};const o=await Object(v.exec)(e,r,{...t,listeners:i});if(o!==0){throw new Error(a)}return n}}var h=system_System;class versioning_Versioning{static get strategies(){return{None:"None",Semantic:"Semantic",Tag:"Tag",Custom:"Custom"}}static get branch(){return this.headRef||this.ref.slice(11)}static get headRef(){return process.env.GITHUB_HEAD_REF}static get ref(){return process.env.GITHUB_REF}static get descriptionRegex(){return/^v([\d.]+)-(\d+)-g(\w+)-?(\w+)*/g}static async determineVersion(e,r){if(!Object.hasOwnProperty.call(this.strategies,e)){throw new p(`Versioning strategy should be one of ${Object.values(this.strategies).join(", ")}.`)}let t;switch(e){case this.strategies.None:t="none";break;case this.strategies.Custom:t=r;break;case this.strategies.Semantic:t=await this.generateSemanticVersion();break;case this.strategies.Tag:t=await this.generateTagVersion();break;default:throw new d(`Strategy ${e} is not implemented.`)}return t}static async generateSemanticVersion(){await this.fetchAll();if(await this.isDirty()){throw new Error("Branch is dirty. Refusing to base semantic version on uncommitted changes")}if(!await this.hasAnyVersionTags()){const e=`0.0.${await this.getTotalNumberOfCommits()}`;Object(l.info)(`Generated version ${e} (no version tags found).`);return e}const{tag:e,commits:r,hash:t}=await this.parseSemanticVersion();Object(l.info)(`Found semantic version ${e}.${r} for ${this.branch}@${t}`);return`${e}.${r}`}static async generateTagVersion(){let e=await this.getTag();if(e.charAt(0)==="v"){e=e.slice(1)}return e}static async parseSemanticVersion(){const e=await this.getVersionDescription();const[r,t,n,a]=this.descriptionRegex.exec(e);if(!r){throw new Error(`Failed to parse git describe output: "${e}"`)}return{match:r,tag:t,commits:n,hash:a}}static async fetchAll(){await Object(v.exec)("git",["fetch","--all"])}static async getVersionDescription(){return h.run("git",["describe","--long","--tags","--always",`origin/${this.branch}`])}static async isDirty(){const e=await h.run("git",["status","--porcelain"]);return e!==""}static async getTag(){return h.run("git",["tag","--points-at","HEAD"])}static async hasAnyVersionTags(){const e=await h.run("git",["--list","--merged","HEAD","|","grep v[0-9]*","|","wc -l"]);return e!=="0"}static async getTotalNumberOfCommits(){const e=await h.run("git",["rev-list","--count","HEAD"]);return parseInt(e,10)}}const y=t(470);class input_Input{static async getFromUser(){const e=y.getInput("unityVersion");const r=y.getInput("targetPlatform")||o.default;const t=y.getInput("projectPath")||".";const n=y.getInput("buildName")||r;const a=y.getInput("buildsPath")||"build";const i=y.getInput("buildMethod");const u=y.getInput("versioning")||"Semantic";const s=y.getInput("version")||"";const c=y.getInput("customParameters")||"";const f=t.replace(/\/$/,"");const l=await versioning_Versioning.determineVersion(u,s);return{version:e,targetPlatform:r,projectPath:f,buildName:n,buildsPath:a,buildMethod:i,buildVersion:l,customParameters:c}}}var g=input_Input;class project_Project{static get relativePath(){const e=g.getFromUser().then(e=>e.projectPath);return`${e}`}static get absolutePath(){const{workspace:e}=i;return`${e}/${this.relativePath}`}static get libraryFolder(){return`${this.relativePath}/${f.libraryFolder}`}}var b=project_Project;class cache_Cache{static verify(){if(!c().existsSync(b.libraryFolder)){this.notifyAboutCachingPossibility()}}static notifyAboutCachingPossibility(){if(i.isRunningLocally){return}console.log(`\n Library folder does not exist.\n Consider setting up caching to speed up your workflow\n If this is not your first build.`)}}var m=cache_Cache;var _=typeof global=="object"&&global&&global.Object===Object&&global;var w=_;var x=typeof self=="object"&&self&&self.Object===Object&&self;var S=w||x||Function("return this")();var O=S;var j=O.Symbol;var I=j;var A=Object.prototype;var E=A.hasOwnProperty;var k=A.toString;var P=I?I.toStringTag:undefined;function getRawTag(e){var r=E.call(e,P),t=e[P];try{e[P]=undefined;var n=true}catch(e){}var a=k.call(e);if(n){if(r){e[P]=t}else{delete e[P]}}return a}var C=getRawTag;var R=Object.prototype;var W=R.toString;function objectToString(e){return W.call(e)}var T=objectToString;var M="[object Null]",B="[object Undefined]";var D=I?I.toStringTag:undefined;function baseGetTag(e){if(e==null){return e===undefined?B:M}return D&&D in Object(e)?C(e):T(e)}var L=baseGetTag;function isObjectLike(e){return e!=null&&typeof e=="object"}var F=isObjectLike;var N="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||F(e)&&L(e)==N}var $=isSymbol;var U=0/0;function baseToNumber(e){if(typeof e=="number"){return e}if($(e)){return U}return+e}var z=baseToNumber;function arrayMap(e,r){var t=-1,n=e==null?0:e.length,a=Array(n);while(++t0){if(++r>=mr){return arguments[0]}}else{r=0}return e.apply(undefined,arguments)}}var xr=shortOut;var Sr=xr(Ue);var Or=Sr;var jr=/\{\n\/\* \[wrapped with (.+)\] \*/,Ir=/,? & /;function getWrapDetails(e){var r=e.match(jr);return r?r[1].split(Ir):[]}var Ar=getWrapDetails;var Er=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function insertWrapDetails(e,r){var t=r.length;if(!t){return e}var n=t-1;r[n]=(t>1?"& ":"")+r[n];r=r.join(t>2?", ":" ");return e.replace(Er,"{\n/* [wrapped with "+r+"] */\n")}var kr=insertWrapDetails;function constant(e){return function(){return e}}var Pr=constant;var Cr=function(){try{var e=Be(Object,"defineProperty");e({},"",{});return e}catch(e){}}();var Rr=Cr;var Wr=!Rr?pe:function(e,r){return Rr(e,"toString",{configurable:true,enumerable:false,value:Pr(r),writable:true})};var Tr=Wr;var Mr=xr(Tr);var Br=Mr;function arrayEach(e,r){var t=-1,n=e==null?0:e.length;while(++t-1}var Ur=arrayIncludes;var zr=1,qr=2,Hr=8,Vr=16,Gr=32,Kr=64,Zr=128,Xr=256,Yr=512;var Jr=[["ary",Zr],["bind",zr],["bindKey",qr],["curry",Hr],["curryRight",Vr],["flip",Yr],["partial",Gr],["partialRight",Kr],["rearg",Xr]];function updateWrapDetails(e,r){Dr(Jr,function(t){var n="_."+t[0];if(r&t[1]&&!Ur(e,n)){e.push(n)}});return e.sort()}var Qr=updateWrapDetails;function setWrapToString(e,r,t){var n=r+"";return Br(e,kr(n,Qr(Ar(n),t)))}var et=setWrapToString;var rt=1,tt=2,nt=4,at=8,it=32,ot=64;function createRecurry(e,r,t,n,a,i,o,u,s,c){var f=r&at,l=f?o:undefined,v=f?undefined:o,d=f?i:undefined,p=f?undefined:i;r|=f?it:ot;r&=~(f?ot:it);if(!(r&nt)){r&=~(rt|tt)}var h=[e,r,a,d,l,p,v,u,s,c];var y=t.apply(undefined,h);if(br(e)){Or(y,h)}y.placeholder=n;return et(y,e,r)}var ut=createRecurry;function getHolder(e){var r=e;return r.placeholder}var st=getHolder;var ct=9007199254740991;var ft=/^(?:0|[1-9]\d*)$/;function isIndex(e,r){var t=typeof e;r=r==null?ct:r;return!!r&&(t=="number"||t!="symbol"&&ft.test(e))&&(e>-1&&e%1==0&&e1){g.reverse()}if(f&&s-1&&e%1==0&&e<=rn}var tn=isLength;function isArrayLike(e){return e!=null&&tn(e.length)&&!me(e)}var nn=isArrayLike;function isIterateeCall(e,r,t){if(!ee(t)){return false}var n=typeof r;if(n=="number"?nn(t)&<(r,t.length):n=="string"&&r in t){return Gt(t[r],e)}return false}var an=isIterateeCall;function createAssigner(e){return en(function(r,t){var n=-1,a=t.length,i=a>1?t[a-1]:undefined,o=a>2?t[2]:undefined;i=e.length>3&&typeof i=="function"?(a--,i):undefined;if(o&&an(t[0],t[1],o)){i=a<3?undefined:i;a=1}r=Object(r);while(++n-1}var ri=listCacheHas;function listCacheSet(e,r){var t=this.__data__,n=Xa(t,e);if(n<0){++this.size;t.push([e,r])}else{t[n][1]=r}return this}var ti=listCacheSet;function ListCache(e){var r=-1,t=e==null?0:e.length;this.clear();while(++r0&&t(u)){if(r>1){baseFlatten(u,r-1,t,n,a)}else{ki(a,u)}}else if(!n){a[a.length]=u}}return a}var Ri=baseFlatten;function flatten(e){var r=e==null?0:e.length;return r?Ri(e,1):[]}var Wi=flatten;function flatRest(e){return Br(Qt(e,undefined,Wi),e+"")}var Ti=flatRest;var Mi=Ti(Ei);var Bi=Mi;var Di=fa(Object.getPrototypeOf,Object);var Li=Di;var Fi="[object Object]";var Ni=Function.prototype,$i=Object.prototype;var Ui=Ni.toString;var zi=$i.hasOwnProperty;var qi=Ui.call(Object);function isPlainObject(e){if(!F(e)||L(e)!=Fi){return false}var r=Li(e);if(r===null){return true}var t=zi.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&Ui.call(t)==qi}var Hi=isPlainObject;var Vi="[object DOMException]",Gi="[object Error]";function isError(e){if(!F(e)){return false}var r=L(e);return r==Gi||r==Vi||typeof e.message=="string"&&typeof e.name=="string"&&!Hi(e)}var Ki=isError;var Zi=en(function(e,r){try{return Ze(e,undefined,r)}catch(e){return Ki(e)?e:new Error(e)}});var Xi=Zi;var Yi="Expected a function";function before(e,r){var t;if(typeof r!="function"){throw new TypeError(Yi)}e=le(e);return function(){if(--e>0){t=r.apply(this,arguments)}if(e<=1){r=undefined}return t}}var Ji=before;var Qi=1,eo=32;var ro=en(function(e,r,t){var n=Qi;if(t.length){var a=ht(t,st(ro));n|=eo}return zt(e,n,r,t,a)});ro.placeholder={};var to=ro;var no=Ti(function(e,r){Dr(r,function(r){r=ji(r);Vt(e,r,to(e[r],e))});return e});var ao=no;var io=1,oo=2,uo=32;var so=en(function(e,r,t){var n=io|oo;if(t.length){var a=ht(t,st(so));n|=uo}return zt(r,n,e,t,a)});so.placeholder={};var co=so;function baseSlice(e,r,t){var n=-1,a=e.length;if(r<0){r=-r>a?0:a+r}t=t>a?a:t;if(t<0){t+=a}a=r>t?0:t-r>>>0;r>>>=0;var i=Array(a);while(++n=n?e:fo(e,r,t)}var lo=castSlice;var vo="\\ud800-\\udfff",po="\\u0300-\\u036f",ho="\\ufe20-\\ufe2f",yo="\\u20d0-\\u20ff",go=po+ho+yo,bo="\\ufe0e\\ufe0f";var mo="\\u200d";var _o=RegExp("["+mo+vo+go+bo+"]");function hasUnicode(e){return _o.test(e)}var wo=hasUnicode;function asciiToArray(e){return e.split("")}var xo=asciiToArray;var So="\\ud800-\\udfff",Oo="\\u0300-\\u036f",jo="\\ufe20-\\ufe2f",Io="\\u20d0-\\u20ff",Ao=Oo+jo+Io,Eo="\\ufe0e\\ufe0f";var ko="["+So+"]",Po="["+Ao+"]",Co="\\ud83c[\\udffb-\\udfff]",Ro="(?:"+Po+"|"+Co+")",Wo="[^"+So+"]",To="(?:\\ud83c[\\udde6-\\uddff]){2}",Mo="[\\ud800-\\udbff][\\udc00-\\udfff]",Bo="\\u200d";var Do=Ro+"?",Lo="["+Eo+"]?",Fo="(?:"+Bo+"(?:"+[Wo,To,Mo].join("|")+")"+Lo+Do+")*",No=Lo+Do+Fo,$o="(?:"+[Wo+Po+"?",Po,To,Mo,ko].join("|")+")";var Uo=RegExp(Co+"(?="+Co+")|"+$o+No,"g");function unicodeToArray(e){return e.match(Uo)||[]}var zo=unicodeToArray;function stringToArray(e){return wo(e)?zo(e):xo(e)}var qo=stringToArray;function createCaseFirst(e){return function(r){r=xi(r);var t=wo(r)?qo(r):undefined;var n=t?t[0]:r.charAt(0);var a=t?lo(t,1).join(""):r.slice(1);return n[e]()+a}}var Ho=createCaseFirst;var Vo=Ho("toUpperCase");var Go=Vo;function capitalize(e){return Go(xi(e).toLowerCase())}var Ko=capitalize;function arrayReduce(e,r,t,n){var a=-1,i=e==null?0:e.length;if(n&&i){t=e[++a]}while(++a=r?e:r}}return e}var hs=baseClamp;function clamp(e,r,t){if(t===undefined){t=r;r=undefined}if(t!==undefined){t=ue(t);t=t===t?t:0}if(r!==undefined){r=ue(r);r=r===r?r:0}return hs(ue(e),r,t)}var ys=clamp;function stackClear(){this.__data__=new ni;this.size=0}var gs=stackClear;function stackDelete(e){var r=this.__data__,t=r["delete"](e);this.size=r.size;return t}var bs=stackDelete;function stackGet(e){return this.__data__.get(e)}var ms=stackGet;function stackHas(e){return this.__data__.has(e)}var _s=stackHas;var ws=200;function stackSet(e,r){var t=this.__data__;if(t instanceof ni){var n=t.__data__;if(!ii||n.lengthu)){return false}var c=i.get(e);if(c&&i.get(r)){return c==r}var f=-1,l=true,v=t&el?new Xf:undefined;i.set(e,r);i.set(r,e);while(++f=r||t<0||l&&n>=i}function timerExpired(){var e=xv();if(shouldInvoke(e)){return trailingEdge(e)}u=setTimeout(timerExpired,remainingWait(e))}function trailingEdge(e){u=undefined;if(v&&n){return invokeFunc(e)}n=a=undefined;return o}function cancel(){if(u!==undefined){clearTimeout(u)}c=0;n=s=a=u=undefined}function flush(){return u===undefined?o:trailingEdge(xv())}function debounced(){var e=xv(),t=shouldInvoke(e);n=arguments;a=this;s=e;if(t){if(u===undefined){return leadingEdge(s)}if(l){clearTimeout(u);u=setTimeout(timerExpired,r);return invokeFunc(s)}}if(u===undefined){u=setTimeout(timerExpired,r)}return o}debounced.cancel=cancel;debounced.flush=flush;return debounced}var Iv=debounce;function defaultTo(e,r){return e==null||e!==e?r:e}var Av=defaultTo;var Ev=Object.prototype;var kv=Ev.hasOwnProperty;var Pv=en(function(e,r){e=Object(e);var t=-1;var n=r.length;var a=n>2?r[2]:undefined;if(a&&an(r[0],r[1],a)){n=1}while(++t=Xv){i=Jf;o=false;r=new Xf(r)}e:while(++a=0&&e.slice(t,a)==r}var wd=endsWith;function baseToPairs(e,r){return q(r,function(r){return[r,e[r]]})}var xd=baseToPairs;function setToPairs(e){var r=-1,t=Array(e.size);e.forEach(function(e){t[++r]=[e,e]});return t}var Sd=setToPairs;var Od="[object Map]",jd="[object Set]";function createToPairs(e){return function(r){var t=lc(r);if(t==Od){return tl(r)}if(t==jd){return Sd(r)}return xd(r,e(r))}}var Id=createToPairs;var Ad=Id(ya);var Ed=Ad;var kd=Id(ja);var Pd=kd;var Cd={"&":"&","<":"<",">":">",'"':""","'":"'"};var Rd=Xo(Cd);var Wd=Rd;var Td=/[&<>"']/g,Md=RegExp(Td.source);function escape_escape(e){e=xi(e);return e&&Md.test(e)?e.replace(Td,Wd):e}var Bd=escape_escape;var Dd=/[\\^$.*+?()[\]{}|]/g,Ld=RegExp(Dd.source);function escapeRegExp(e){e=xi(e);return e&&Ld.test(e)?e.replace(Dd,"\\$&"):e}var Fd=escapeRegExp;function arrayEvery(e,r){var t=-1,n=e==null?0:e.length;while(++ta?0:a+t}n=n===undefined||n>a?a:le(n);if(n<0){n+=a}n=t>n?0:qd(n);while(t-1?a[i?r[o]:o]:undefined}}var Zd=createFind;var Xd=Math.max;function findIndex(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=t==null?0:le(t);if(a<0){a=Xd(n+a,0)}return Lr(e,Kl(r,3),a)}var Yd=findIndex;var Jd=Zd(Yd);var Qd=Jd;function baseFindKey(e,r,t){var n;t(e,function(e,t,a){if(r(e,t,a)){n=t;return false}});return n}var ep=baseFindKey;function findKey(e,r){return ep(e,Kl(r,3),ov)}var rp=findKey;var tp=Math.max,np=Math.min;function findLastIndex(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=n-1;if(t!==undefined){a=le(t);a=t<0?tp(n+a,0):np(a,n-1)}return Lr(e,Kl(r,3),a,true)}var ap=findLastIndex;var ip=Zd(ap);var op=ip;function findLastKey(e,r){return ep(e,Kl(r,3),gd)}var up=findLastKey;function head(e){return e&&e.length?e[0]:undefined}var sp=head;function baseMap(e,r){var t=-1,n=nn(e)?Array(e.length):[];cv(e,function(e,a,i){n[++t]=r(e,a,i)});return n}var cp=baseMap;function map_map(e,r){var t=V(e)?q:cp;return t(e,Kl(r,3))}var fp=map_map;function flatMap(e,r){return Ri(fp(e,r),1)}var lp=flatMap;var vp=1/0;function flatMapDeep(e,r){return Ri(fp(e,r),vp)}var dp=flatMapDeep;function flatMapDepth(e,r,t){t=t===undefined?1:le(t);return Ri(fp(e,r),t)}var pp=flatMapDepth;var hp=1/0;function flattenDeep(e){var r=e==null?0:e.length;return r?Ri(e,hp):[]}var yp=flattenDeep;function flattenDepth(e,r){var t=e==null?0:e.length;if(!t){return[]}r=r===undefined?1:le(r);return Ri(e,r)}var gp=flattenDepth;var bp=512;function flip(e){return zt(e,bp)}var mp=flip;var _p=ss("floor");var wp=_p;var xp="Expected a function";var Sp=8,Op=32,jp=128,Ip=256;function createFlow(e){return Ti(function(r){var t=r.length,n=t,a=vr.prototype.thru;if(e){r.reverse()}while(n--){var i=r[n];if(typeof i!="function"){throw new TypeError(xp)}if(a&&!o&&lr(i)=="wrapper"){var o=new vr([],true)}}n=o?n:t;while(++nr}var qp=baseGt;function createRelationalOperation(e){return function(r,t){if(!(typeof r=="string"&&typeof t=="string")){r=ue(r);t=ue(t)}return e(r,t)}}var Hp=createRelationalOperation;var Vp=Hp(qp);var Gp=Vp;var Kp=Hp(function(e,r){return e>=r});var Zp=Kp;var Xp=Object.prototype;var Yp=Xp.hasOwnProperty;function baseHas(e,r){return e!=null&&Yp.call(e,r)}var Jp=baseHas;function has(e,r){return e!=null&&Nl(e,r,Jp)}var Qp=has;var eh=Math.max,rh=Math.min;function baseInRange(e,r,t){return e>=rh(r,t)&&e-1:!!a&&$r(e,r,t)>-1}var ch=includes_includes;var fh=Math.max;function indexOf_indexOf(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=t==null?0:le(t);if(a<0){a=fh(n+a,0)}return $r(e,r,a)}var lh=indexOf_indexOf;function initial(e){var r=e==null?0:e.length;return r?fo(e,0,-1):[]}var vh=initial;var dh=Math.min;function baseIntersection(e,r,t){var n=t?Zv:Ur,a=e[0].length,i=e.length,o=i,u=Array(i),s=Infinity,c=[];while(o--){var f=e[o];if(o&&r){f=q(f,Yn(r))}s=dh(f.length,s);u[o]=!t&&(r||a>=120&&f.length>=120)?new Xf(o&&f):undefined}f=e[0];var l=-1,v=u[0];e:while(++l=-Oy&&e<=Oy}var jy=isSafeInteger;function isUndefined(e){return e===undefined}var Iy=isUndefined;var Ay="[object WeakMap]";function isWeakMap(e){return F(e)&&lc(e)==Ay}var Ey=isWeakMap;var ky="[object WeakSet]";function isWeakSet(e){return F(e)&&L(e)==ky}var Py=isWeakSet;var Cy=1;function iteratee_iteratee(e){return Kl(typeof e=="function"?e:Wf(e,Cy))}var Ry=iteratee_iteratee;var Wy=Array.prototype;var Ty=Wy.join;function join(e,r){return e==null?"":Ty.call(e,r)}var My=join;var By=ts(function(e,r,t){return e+(t?"-":"")+r.toLowerCase()});var Dy=By;var Ly=lv(function(e,r,t){Vt(e,t,r)});var Fy=Ly;function strictLastIndexOf(e,r,t){var n=t+1;while(n--){if(e[n]===r){return n}}return n}var Ny=strictLastIndexOf;var $y=Math.max,Uy=Math.min;function lastIndexOf(e,r,t){var n=e==null?0:e.length;if(!n){return-1}var a=n;if(t!==undefined){a=le(t);a=a<0?$y(n+a,0):Uy(a,n-1)}return r===r?Ny(e,r,a):Lr(e,Fr,a,true)}var zy=lastIndexOf;var qy=ts(function(e,r,t){return e+(t?" ":"")+r.toLowerCase()});var Hy=qy;var Vy=Ho("toLowerCase");var Gy=Vy;function baseLt(e,r){return e=this.__values__.length,r=e?undefined:this.__values__[this.__index__++];return{done:e,value:r}}var Cg=wrapperNext;function baseNth(e,r){var t=e.length;if(!t){return}r+=r<0?t:0;return lt(r,t)?e[r]:undefined}var Rg=baseNth;function nth(e,r){return e&&e.length?Rg(e,le(r)):undefined}var Wg=nth;function nthArg(e){e=le(e);return en(function(r){return Rg(r,e)})}var Tg=nthArg;function baseUnset(e,r){r=Si(r,e);e=Wh(e,r);return e==null||delete e[ji(ed(r))]}var Mg=baseUnset;function customOmitClone(e){return Hi(e)?undefined:e}var Bg=customOmitClone;var Dg=1,Lg=2,Fg=4;var Ng=Ti(function(e,r){var t={};if(e==null){return t}var n=false;r=q(r,function(r){r=Si(r,e);n||(n=r.length>1);return r});Yt(e,Vs(e),t);if(n){t=Wf(t,Dg|Lg|Fg,Bg)}var a=r.length;while(a--){Mg(t,r[a])}return t});var $g=Ng;function baseSet(e,r,t,n){if(!ee(e)){return e}r=Si(r,e);var a=-1,i=r.length,o=i-1,u=e;while(u!=null&&++ar||i&&o&&s&&!u&&!c||n&&o&&s||!t&&s||!a){return 1}if(!n&&!i&&!c&&e=u){return s}var c=t[n];return s*(c=="desc"?-1:1)}}return e.index-r.index}var Zg=compareMultiple;function baseOrderBy(e,r,t){var n=-1;r=q(r.length?r:[pe],Yn(Kl));var a=cp(e,function(e,t,a){var i=q(r,function(r){return r(e)});return{criteria:i,index:++n,value:e}});return Gg(a,function(e,r){return Zg(e,r,t)})}var Xg=baseOrderBy;function orderBy(e,r,t,n){if(e==null){return[]}if(!V(r)){r=r==null?[]:[r]}t=n?undefined:t;if(!V(t)){t=t==null?[]:[t]}return Xg(e,r,t)}var Yg=orderBy;function createOver(e){return Ti(function(r){r=q(r,Yn(Kl));return en(function(t){var n=this;return e(r,function(e){return Ze(e,n,t)})})})}var Jg=createOver;var Qg=Jg(q);var eb=Qg;var rb=en;var tb=rb;var nb=Math.min;var ab=tb(function(e,r){r=r.length==1&&V(r[0])?q(r[0],Yn(Kl)):q(Ri(r,1),Yn(Kl));var t=r.length;return en(function(n){var a=-1,i=nb(n.length,t);while(++afb){return t}do{if(r%2){t+=e}r=lb(r/2);if(r){e+=e}}while(r);return t}var vb=baseRepeat;var db=Hl("length");var pb=db;var hb="\\ud800-\\udfff",yb="\\u0300-\\u036f",gb="\\ufe20-\\ufe2f",bb="\\u20d0-\\u20ff",mb=yb+gb+bb,_b="\\ufe0e\\ufe0f";var wb="["+hb+"]",xb="["+mb+"]",Sb="\\ud83c[\\udffb-\\udfff]",Ob="(?:"+xb+"|"+Sb+")",jb="[^"+hb+"]",Ib="(?:\\ud83c[\\udde6-\\uddff]){2}",Ab="[\\ud800-\\udbff][\\udc00-\\udfff]",Eb="\\u200d";var kb=Ob+"?",Pb="["+_b+"]?",Cb="(?:"+Eb+"(?:"+[jb,Ib,Ab].join("|")+")"+Pb+kb+")*",Rb=Pb+kb+Cb,Wb="(?:"+[jb+xb+"?",xb,Ib,Ab,wb].join("|")+")";var Tb=RegExp(Sb+"(?="+Sb+")|"+Wb+Rb,"g");function unicodeSize(e){var r=Tb.lastIndex=0;while(Tb.test(e)){++r}return r}var Mb=unicodeSize;function stringSize(e){return wo(e)?Mb(e):pb(e)}var Bb=stringSize;var Db=Math.ceil;function createPadding(e,r){r=r===undefined?" ":X(r);var t=r.length;if(t<2){return t?vb(r,e):r}var n=vb(r,Db(e/Bb(r)));return wo(r)?lo(qo(n),0,e).join(""):n.slice(0,e)}var Lb=createPadding;var Fb=Math.ceil,Nb=Math.floor;function pad(e,r,t){e=xi(e);r=le(r);var n=r?Bb(e):0;if(!r||n>=r){return e}var a=(r-n)/2;return Lb(Nb(a),t)+e+Lb(Fb(a),t)}var $b=pad;function padEnd(e,r,t){e=xi(e);r=le(r);var n=r?Bb(e):0;return r&&n-1){if(u!==e){sm.call(u,s,1)}sm.call(e,s,1)}}return e}var cm=basePullAll;function pullAll(e,r){return e&&e.length&&r&&r.length?cm(e,r):e}var fm=pullAll;var lm=en(fm);var vm=lm;function pullAllBy(e,r,t){return e&&e.length&&r&&r.length?cm(e,r,Kl(t,2)):e}var dm=pullAllBy;function pullAllWith(e,r,t){return e&&e.length&&r&&r.length?cm(e,r,undefined,t):e}var pm=pullAllWith;var hm=Array.prototype;var ym=hm.splice;function basePullAt(e,r){var t=e?r.length:0,n=t-1;while(t--){var a=r[t];if(t==n||a!==i){var i=a;if(lt(a)){ym.call(e,a,1)}else{Mg(e,a)}}}return e}var gm=basePullAt;var bm=Ti(function(e,r){var t=e==null?0:e.length,n=Ei(e,r);gm(e,q(r,function(e){return lt(e,t)?+e:e}).sort(Kg));return n});var mm=bm;var _m=Math.floor,wm=Math.random;function baseRandom(e,r){return e+_m(wm()*(r-e+1))}var xm=baseRandom;var Sm=parseFloat;var Om=Math.min,jm=Math.random;function random(e,r,t){if(t&&typeof t!="boolean"&&an(e,r,t)){r=t=undefined}if(t===undefined){if(typeof r=="boolean"){t=r;r=undefined}else if(typeof e=="boolean"){t=e;e=undefined}}if(e===undefined&&r===undefined){e=0;r=1}else{e=fe(e);if(r===undefined){r=e;e=0}else{r=fe(r)}}if(e>r){var n=e;e=r;r=n}if(t||e%1||r%1){var a=jm();return Om(e+a*(r-e+Sm("1e-"+((a+"").length-1))),r)}return xm(e,r)}var Im=random;var Am=Math.ceil,Em=Math.max;function baseRange(e,r,t,n){var a=-1,i=Em(Am((r-e)/(t||1)),0),o=Array(i);while(i--){o[n?i:++a]=e;e+=t}return o}var km=baseRange;function createRange(e){return function(r,t,n){if(n&&typeof n!="number"&&an(r,t,n)){t=n=undefined}r=fe(r);if(t===undefined){t=r;r=0}else{t=fe(t)}n=n===undefined?r1&&an(e,r[0],r[1])){r=[]}else if(t>2&&an(r[0],r[1],r[2])){r=[r[0]]}return Xg(e,Ri(r,1),[])});var w_=__;var x_=4294967295,S_=x_-1;var O_=Math.floor,j_=Math.min;function baseSortedIndexBy(e,r,t,n){r=t(r);var a=0,i=e==null?0:e.length,o=r!==r,u=r===null,s=$(r),c=r===undefined;while(a>>1;function baseSortedIndex(e,r,t){var n=0,a=e==null?n:e.length;if(typeof r=="number"&&r===r&&a<=E_){while(n>>1,o=e[i];if(o!==null&&!$(o)&&(t?o<=r:o>>0;if(!t){return[]}e=xi(e);if(e&&(typeof r=="string"||r!=null&&!Sy(r))){r=X(r);if(!r&&wo(e)){return lo(qo(e),0,t)}}return e.split(r,t)}var N_=split;var $_="Expected a function";var U_=Math.max;function spread(e,r){if(typeof e!="function"){throw new TypeError($_)}r=r==null?0:U_(le(r),0);return en(function(t){var n=t[r],a=lo(t,0,r);if(n){ki(a,n)}return Ze(e,this,a)})}var z_=spread;var q_=ts(function(e,r,t){return e+(t?" ":"")+Go(r)});var H_=q_;function startsWith(e,r,t){e=xi(e);t=t==null?0:hs(le(t),0,e.length);r=X(r);return e.slice(t,t+r.length)==r}var V_=startsWith;function stubObject(){return{}}var G_=stubObject;function stubString(){return""}var K_=stubString;function stubTrue(){return true}var Z_=stubTrue;var X_=Y(function(e,r){return e-r},0);var Y_=X_;function sum(e){return e&&e.length?sg(e,pe):0}var J_=sum;function sumBy(e,r){return e&&e.length?sg(e,Kl(r,2)):0}var Q_=sumBy;function tail(e){var r=e==null?0:e.length;return r?fo(e,1,r):[]}var ew=tail;function take(e,r,t){if(!(e&&e.length)){return[]}r=t||r===undefined?1:le(r);return fo(e,0,r<0?0:r)}var rw=take;function takeRight(e,r,t){var n=e==null?0:e.length;if(!n){return[]}r=t||r===undefined?1:le(r);r=n-r;return fo(e,r<0?0:r,n)}var tw=takeRight;function takeRightWhile(e,r){return e&&e.length?cd(e,Kl(r,3),false,true):[]}var nw=takeRightWhile;function takeWhile(e,r){return e&&e.length?cd(e,Kl(r,3)):[]}var aw=takeWhile;function tap(e,r){r(e);return e}var iw=tap;var ow=Object.prototype;var uw=ow.hasOwnProperty;function customDefaultsAssignIn(e,r,t,n){if(e===undefined||Gt(e,ow[t])&&!uw.call(n,t)){return r}return e}var sw=customDefaultsAssignIn;var cw={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};function escapeStringChar(e){return"\\"+cw[e]}var fw=escapeStringChar;var lw=/<%=([\s\S]+?)%>/g;var vw=lw;var dw=/<%-([\s\S]+?)%>/g;var pw=dw;var hw=/<%([\s\S]+?)%>/g;var yw=hw;var gw={escape:pw,evaluate:yw,interpolate:vw,variable:"",imports:{_:{escape:Bd}}};var bw=gw;var mw=/\b__p \+= '';/g,_w=/\b(__p \+=) '' \+/g,ww=/(__e\(.*?\)|\b__t\)) \+\n'';/g;var xw=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;var Sw=/($^)/;var Ow=/['\n\r\u2028\u2029\\]/g;var jw=Object.prototype;var Iw=jw.hasOwnProperty;function template(e,r,t){var n=bw.imports._.templateSettings||bw;if(t&&an(e,r,t)){r=undefined}e=xi(e);r=ka({},r,n,sw);var a=ka({},r.imports,n.imports,sw),i=ya(a),o=oh(a,i);var u,s,c=0,f=r.interpolate||Sw,l="__p += '";var v=RegExp((r.escape||Sw).source+"|"+f.source+"|"+(f===vw?xw:Sw).source+"|"+(r.evaluate||Sw).source+"|$","g");var d=Iw.call(r,"sourceURL")?"//# sourceURL="+(r.sourceURL+"").replace(/[\r\n]/g," ")+"\n":"";e.replace(v,function(r,t,n,a,i,o){n||(n=a);l+=e.slice(c,o).replace(Ow,fw);if(t){u=true;l+="' +\n__e("+t+") +\n'"}if(i){s=true;l+="';\n"+i+";\n__p += '"}if(n){l+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"}c=o+r.length;return r});l+="';\n";var p=Iw.call(r,"variable")&&r.variable;if(!p){l="with (obj) {\n"+l+"\n}\n"}l=(s?l.replace(mw,""):l).replace(_w,"$1").replace(ww,"$1;");l="function("+(p||"obj")+") {\n"+(p?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(s?", __j = Array.prototype.join;\n"+"function print() { __p += __j.call(arguments, '') }\n":";\n")+l+"return __p\n}";var h=Xi(function(){return Function(i,d+"return "+l).apply(undefined,o)});h.source=l;if(Ki(h)){throw h}return h}var Aw=template;var Ew="Expected a function";function throttle(e,r,t){var n=true,a=true;if(typeof e!="function"){throw new TypeError(Ew)}if(ee(t)){n="leading"in t?!!t.leading:n;a="trailing"in t?!!t.trailing:a}return Iv(e,r,{leading:n,maxWait:r,trailing:a})}var kw=throttle;function thru(e,r){return r(e)}var Pw=thru;var Cw=9007199254740991;var Rw=4294967295;var Ww=Math.min;function times(e,r){e=le(e);if(e<1||e>Cw){return[]}var t=Rw,n=Ww(e,Rw);r=vd(r);e-=Rw;var a=cn(n,r);while(++t-1){}return t}var qw=charsEndIndex;function charsStartIndex(e,r){var t=-1,n=e.length;while(++t-1){}return t}var Hw=charsStartIndex;var Vw=/^\s+|\s+$/g;function trim(e,r,t){e=xi(e);if(e&&(t||r===undefined)){return e.replace(Vw,"")}if(!e||!(r=X(r))){return e}var n=qo(e),a=qo(r),i=Hw(n,a),o=qw(n,a)+1;return lo(n,i,o).join("")}var Gw=trim;var Kw=/\s+$/;function trimEnd(e,r,t){e=xi(e);if(e&&(t||r===undefined)){return e.replace(Kw,"")}if(!e||!(r=X(r))){return e}var n=qo(e),a=qw(n,qo(r))+1;return lo(n,0,a).join("")}var Zw=trimEnd;var Xw=/^\s+/;function trimStart(e,r,t){e=xi(e);if(e&&(t||r===undefined)){return e.replace(Xw,"")}if(!e||!(r=X(r))){return e}var n=qo(e),a=Hw(n,qo(r));return lo(n,a).join("")}var Yw=trimStart;var Jw=30,Qw="...";var ex=/\w*$/;function truncate(e,r){var t=Jw,n=Qw;if(ee(r)){var a="separator"in r?r.separator:a;t="length"in r?le(r.length):t;n="omission"in r?X(r.omission):n}e=xi(e);var i=e.length;if(wo(e)){var o=qo(e);i=o.length}if(t>=i){return e}var u=t-Bb(n);if(u<1){return n}var s=o?lo(o,0,u).join(""):e.slice(0,u);if(a===undefined){return s+n}if(o){u+=s.length-u}if(Sy(a)){if(e.slice(u).search(a)){var c,f=s;if(!a.global){a=RegExp(a.source,xi(ex.exec(a))+"g")}a.lastIndex=0;while(c=a.exec(f)){var l=c.index}s=s.slice(0,l===undefined?u:l)}}else if(e.indexOf(X(a),u)!=u){var v=s.lastIndexOf(a);if(v>-1){s=s.slice(0,v)}}return s+n}var rx=truncate;function unary(e){return Ht(e,1)}var tx=unary;var nx={"&":"&","<":"<",">":">",""":'"',"'":"'"};var ax=Xo(nx);var ix=ax;var ox=/&(?:amp|lt|gt|quot|#39);/g,ux=RegExp(ox.source);function unescape_unescape(e){e=xi(e);return e&&ux.test(e)?e.replace(ox,ix):e}var sx=unescape_unescape;var cx=1/0;var fx=!(Js&&1/nl(new Js([,-0]))[1]==cx)?ar:function(e){return new Js(e)};var lx=fx;var vx=200;function baseUniq(e,r,t){var n=-1,a=Ur,i=e.length,o=true,u=[],s=u;if(t){o=false;a=Zv}else if(i>=vx){var c=r?null:lx(e);if(c){return nl(c)}o=false;a=Jf;s=new Xf}else{s=r?[]:u}e:while(++n1||this.__actions__.length||!(n instanceof nr)||!lt(t)){return this.thru(a)}n=n.slice(t,+t+(r?1:0));n.__actions__.push({func:Pw,args:[a],thisArg:undefined});return new vr(n,this.__chain__).thru(function(e){if(r&&!e.length){e.push(undefined)}return e})});var Fx=Lx;function wrapperChain(){return ls(this)}var Nx=wrapperChain;function wrapperReverse(){var e=this.__wrapped__;if(e instanceof nr){var r=e;if(this.__actions__.length){r=new nr(this)}r=r.reverse();r.__actions__.push({func:Pw,args:[Ym],thisArg:undefined});return new vr(r,this.__chain__)}return this.thru(Ym)}var $x=wrapperReverse;function baseXor(e,r,t){var n=e.length;if(n<2){return n?dx(e[0]):[]}var a=-1,i=Array(n);while(++a1?e[r-1]:undefined;t=typeof t=="function"?(e.pop(),t):undefined;return Ex(e,t)});var rS=eS;var tS={chunk:ps,compact:Hf,concat:Vf,difference:Qv,differenceBy:td,differenceWith:ad,drop:ud,dropRight:sd,dropRightWhile:fd,dropWhile:ld,fill:Vd,findIndex:Yd,findLastIndex:ap,first:sp,flatten:Wi,flattenDeep:yp,flattenDepth:gp,fromPairs:Bp,head:sp,indexOf:lh,initial:vh,intersection:gh,intersectionBy:mh,intersectionWith:wh,join:My,last:ed,lastIndexOf:zy,nth:Wg,pull:vm,pullAll:fm,pullAllBy:dm,pullAllWith:pm,pullAt:mm,remove:zm,reverse:Ym,slice:h_,sortedIndex:P_,sortedIndexBy:C_,sortedIndexOf:R_,sortedLastIndex:W_,sortedLastIndexBy:T_,sortedLastIndexOf:M_,sortedUniq:D_,sortedUniqBy:L_,tail:ew,take:rw,takeRight:tw,takeRightWhile:nw,takeWhile:aw,union:hx,unionBy:gx,unionWith:mx,uniq:_x,uniqBy:wx,uniqWith:xx,unzip:Ax,unzipWith:Ex,without:Bx,xor:qx,xorBy:Vx,xorWith:Kx,zip:Xx,zipObject:Jx,zipObjectDeep:Qx,zipWith:rS};var nS={countBy:hv,each:dd,eachRight:_d,every:Ud,filter:Kd,find:Qd,findLast:op,flatMap:lp,flatMapDeep:dp,flatMapDepth:pp,forEach:dd,forEachRight:_d,groupBy:zp,includes:ch,invokeMap:Lh,keyBy:Fy,map:fp,orderBy:Yg,partition:em,reduce:Fm,reduceRight:$m,reject:Um,sample:t_,sampleSize:o_,shuffle:l_,size:p_,some:m_,sortBy:w_};var aS={now:xv};var iS={after:de,ary:Ht,before:Ji,bind:to,bindKey:co,curry:bv,curryRight:_v,debounce:Iv,defer:Vv,delay:Kv,flip:mp,memoize:hi,negate:jg,once:Vg,overArgs:ib,partial:Zb,partialRight:Jb,rearg:Dm,rest:Gm,spread:z_,throttle:kw,unary:tx,wrap:Dx};var oS={castArray:is,clone:Mf,cloneDeep:Lf,cloneDeepWith:$f,cloneWith:zf,conformsTo:rv,eq:Gt,gt:Gp,gte:Zp,isArguments:yn,isArray:V,isArrayBuffer:zh,isArrayLike:nn,isArrayLikeObject:Wv,isBoolean:Hh,isBuffer:On,isDate:Xh,isElement:Yh,isEmpty:ty,isEqual:ny,isEqualWith:ay,isError:Ki,isFinite:oy,isFunction:me,isInteger:uy,isLength:tn,isMap:Xc,isMatch:sy,isMatchWith:cy,isNaN:vy,isNative:yy,isNil:gy,isNull:by,isNumber:ly,isObject:ee,isObjectLike:F,isPlainObject:Hi,isRegExp:Sy,isSafeInteger:jy,isSet:rf,isString:ih,isSymbol:$,isTypedArray:oa,isUndefined:Iy,isWeakMap:Ey,isWeakSet:Py,lt:Xy,lte:Jy,toArray:Pg,toFinite:fe,toInteger:le,toLength:qd,toNumber:ue,toPlainObject:Mv,toSafeInteger:$w,toString:xi};var uS={add:Q,ceil:fs,divide:od,floor:wp,max:og,maxBy:ug,mean:lg,meanBy:vg,min:mg,minBy:_g,multiply:Sg,round:Qm,subtract:Y_,sum:J_,sumBy:Q_};var sS={clamp:ys,inRange:nh,random:Im};var cS={assign:_a,assignIn:Aa,assignInWith:ka,assignWith:Ca,at:Bi,create:yv,defaults:Cv,defaultsDeep:Uv,entries:Ed,entriesIn:Pd,extend:Aa,extendWith:ka,findKey:rp,findLastKey:up,forIn:Rp,forInRight:Wp,forOwn:Tp,forOwnRight:Mp,functions:Lp,functionsIn:Fp,get:Ai,has:Qp,hasIn:$l,invert:Ah,invertBy:Rh,invoke:Bh,keys:ya,keysIn:ja,mapKeys:Qy,mapValues:eg,merge:pg,mergeWith:Nv,omit:$g,omitBy:Hg,pick:nm,pickBy:qg,result:Km,set:u_,setWith:s_,toPairs:Ed,toPairsIn:Pd,transform:zw,unset:jx,update:Px,updateWith:Cx,values:uh,valuesIn:Tx};var fS={at:Fx,chain:ls,commit:qf,lodash:gr,next:Cg,plant:am,reverse:$x,tap:iw,thru:Pw,toIterator:Mw,toJSON:Dw,value:Dw,valueOf:Dw,wrapperChain:Nx};var lS={camelCase:as,capitalize:Ko,deburr:uu,endsWith:wd,escape:Bd,escapeRegExp:Fd,kebabCase:Dy,lowerCase:Hy,lowerFirst:Gy,pad:$b,padEnd:Ub,padStart:zb,parseInt:Vb,repeat:qm,replace:Hm,snakeCase:g_,split:N_,startCase:H_,startsWith:V_,template:Aw,templateSettings:bw,toLower:Lw,toUpper:Uw,trim:Gw,trimEnd:Zw,trimStart:Yw,truncate:rx,unescape:sx,upperCase:Wx,upperFirst:Go,words:Qu};var vS={attempt:Xi,bindAll:ao,cond:Xl,conforms:ev,constant:Pr,defaultTo:Av,flow:kp,flowRight:Cp,identity:pe,iteratee:Ry,matches:tg,matchesProperty:ag,method:yg,methodOf:bg,mixin:wg,noop:ar,nthArg:Tg,over:eb,overEvery:ub,overSome:cb,property:Gl,propertyOf:im,range:Rm,rangeRight:Tm,stubArray:Ws,stubFalse:gn,stubObject:G_,stubString:K_,stubTrue:Z_,times:Tw,toPath:Fw,uniqueId:Ox};function lazyClone(){var e=new nr(this.__wrapped__);e.__actions__=dr(this.__actions__);e.__dir__=this.__dir__;e.__filtered__=this.__filtered__;e.__iteratees__=dr(this.__iteratees__);e.__takeCount__=this.__takeCount__;e.__views__=dr(this.__views__);return e}var dS=lazyClone;function lazyReverse(){if(this.__filtered__){var e=new nr(this);e.__dir__=-1;e.__filtered__=true}else{e=this.clone();e.__dir__*=-1}return e}var pS=lazyReverse;var hS=Math.max,yS=Math.min;function getView(e,r,t){var n=-1,a=t.length;while(++n0||r<0)){return new nr(t)}if(e<0){t=t.takeRight(-e)}else if(e){t=t.drop(e)}if(r!==undefined){r=le(r);t=r<0?t.dropRight(-r):t.take(r-e)}return t};nr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()};nr.prototype.toArray=function(){return this.take(IS)};ov(nr.prototype,function(e,r){var t=/^(?:filter|find|map|reject)|While$/.test(r),n=/^(?:head|last)$/.test(r),a=gr[n?"take"+(r=="last"?"Right":""):r],i=n||/^find/.test(r);if(!a){return}gr.prototype[r]=function(){var r=this.__wrapped__,o=n?[1]:arguments,u=r instanceof nr,s=o[0],c=u||V(r);var f=function(e){var r=a.apply(gr,ki([e],o));return n&&l?r[0]:r};if(c&&t&&typeof s=="function"&&s.length!=1){u=c=false}var l=this.__chain__,v=!!this.__actions__.length,d=i&&!l,p=u&&!v;if(!i&&c){r=p?r:new nr(this);var h=e.apply(r,o);h.__actions__.push({func:Pw,args:[f],thisArg:undefined});return new vr(h,l)}if(d&&p){return e.apply(this,o)}h=this.thru(f);return d?n?h.value()[0]:h.value():h}});Dr(["pop","push","shift","sort","splice","unshift"],function(e){var r=AS[e],t=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);gr.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var a=this.value();return r.apply(V(a)?a:[],e)}return this[t](function(t){return r.apply(V(t)?t:[],e)})}});ov(nr.prototype,function(e,r){var t=gr[r];if(t){var n=t.name+"";if(!kS.call(sr,n)){sr[n]=[]}sr[n].push({name:r,func:t})}});sr[xt(undefined,SS).name]=[{name:"wrapper",func:undefined}];nr.prototype.clone=dS;nr.prototype.reverse=pS;nr.prototype.value=wS;gr.prototype.at=fS.at;gr.prototype.chain=fS.wrapperChain;gr.prototype.commit=fS.commit;gr.prototype.next=fS.next;gr.prototype.plant=fS.plant;gr.prototype.reverse=fS.reverse;gr.prototype.toJSON=gr.prototype.valueOf=gr.prototype.value=fS.value;gr.prototype.first=gr.prototype.head;if(PS){gr.prototype[PS]=fS.toIterator}var TS=gr;class image_tag_ImageTag{constructor(e){const{repository:r="gableroux",name:t="unity3d",version:n="2019.2.11f1",platform:a}=e;if(!image_tag_ImageTag.versionPattern.test(n)){throw new Error(`Invalid version "${n}".`)}if(!Qp(image_tag_ImageTag.targetPlatformToImageSuffixMap,a)){throw new Error(`Platform "${a}" is currently not supported.`)}const i=Ai(image_tag_ImageTag.targetPlatformToImageSuffixMap,a,image_tag_ImageTag.imageSuffixes.generic);Object.assign(this,{repository:r,name:t,version:n,platform:a,builderPlatform:i})}static get versionPattern(){return/^20\d{2}\.\d\.\w{3,4}|3$/}static get imageSuffixes(){return{generic:"",webgl:"webgl",mac:"mac",windows:"windows",android:"android",ios:"ios",facebook:"facebook"}}static get targetPlatformToImageSuffixMap(){const{generic:e,webgl:r,mac:t,windows:n,android:a,ios:i,facebook:u}=image_tag_ImageTag.imageSuffixes;return{[o.types.StandaloneOSX]:t,[o.types.StandaloneWindows]:n,[o.types.StandaloneWindows64]:n,[o.types.StandaloneLinux64]:n,[o.types.iOS]:i,[o.types.Android]:a,[o.types.WebGL]:r,[o.types.WSAPlayer]:n,[o.types.PS4]:n,[o.types.XboxOne]:n,[o.types.tvOS]:n,[o.types.Switch]:n,[o.types.Lumin]:n,[o.types.BJM]:n,[o.types.Stadia]:n,[o.types.Facebook]:u,[o.types.NoTarget]:e,[o.types.Test]:e}}get tag(){return Zw(`${this.version}-${this.builderPlatform}`,"-")}get image(){return Yw(`${this.repository}/${this.name}`,"/")}toString(){const{image:e,tag:r}=this;return`${e}:${r}`}}var MS=image_tag_ImageTag;class docker_Docker{static async build(e,r=false){const{path:t,dockerfile:n,baseImage:a}=e;const{version:i,platform:o}=a;const u=new MS({repository:"",name:"unity-builder",version:i,platform:o});const s=`docker build ${t} --file ${n} --build-arg IMAGE=${a} --tag ${u}`;await Object(v.exec)(s,null,{silent:r});return u}static async run(e,r,t=false){const{version:n,workspace:a,platform:i,projectPath:o,buildName:u,buildPath:s,buildFile:c,buildMethod:f,buildVersion:l,customParameters:d}=r;const p=`docker run --workdir /github/workspace --rm --env UNITY_LICENSE --env UNITY_LICENSE_FILE --env UNITY_EMAIL --env UNITY_PASSWORD --env UNITY_SERIAL --env UNITY_VERSION="${n}" --env PROJECT_PATH="${o}" --env BUILD_TARGET="${i}" --env BUILD_NAME="${u}" --env BUILD_PATH="${s}" --env BUILD_FILE="${c}" --env BUILD_METHOD="${f}" --env VERSION="${l}" --env CUSTOM_PARAMETERS="${d}" --env HOME=/github/home --env GITHUB_REF --env GITHUB_SHA --env GITHUB_REPOSITORY --env GITHUB_ACTOR --env GITHUB_WORKFLOW --env GITHUB_HEAD_REF --env GITHUB_BASE_REF --env GITHUB_EVENT_NAME --env GITHUB_WORKSPACE=/github/workspace --env GITHUB_ACTION --env GITHUB_EVENT_PATH --env RUNNER_OS --env RUNNER_TOOL_CACHE --env RUNNER_TEMP --env RUNNER_WORKSPACE --volume "/var/run/docker.sock":"/var/run/docker.sock" --volume "/home/runner/work/_temp/_github_home":"/github/home" --volume "/home/runner/work/_temp/_github_workflow":"/github/workflow" --volume "${a}":"/github/workspace" ${e}`;await Object(v.exec)(p,null,{silent:t})}}var BS=docker_Docker;const DS=t(470);async function src_action(){i.checkCompatibility();m.verify();const{dockerfile:e,workspace:r,actionFolder:t}=i;const n=u.create(await g.getFromUser());const a=new MS(n);const o=await BS.build({path:t,dockerfile:e,baseImage:a});await BS.run(o,{workspace:r,...n})}src_action().catch(e=>{DS.setFailed(e.message)})},87:function(e){e.exports=require("os")},129:function(e){e.exports=require("child_process")},357:function(e){e.exports=require("assert")},431:function(e,r,t){"use strict";var n=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(Object.hasOwnProperty.call(e,t))r[t]=e[t];r["default"]=e;return r};Object.defineProperty(r,"__esModule",{value:true});const a=n(t(87));function issueCommand(e,r,t){const n=new Command(e,r,t);process.stdout.write(n.toString()+a.EOL)}r.issueCommand=issueCommand;function issue(e,r=""){issueCommand(e,{},r)}r.issue=issue;const i="::";class Command{constructor(e,r,t){if(!e){e="missing.command"}this.command=e;this.properties=r;this.message=t}toString(){let e=i+this.command;if(this.properties&&Object.keys(this.properties).length>0){e+=" ";let r=true;for(const t in this.properties){if(this.properties.hasOwnProperty(t)){const n=this.properties[t];if(n){if(r){r=false}else{e+=","}e+=`${t}=${escapeProperty(n)}`}}}}e+=`${i}${escapeData(this.message)}`;return e}}function escapeData(e){return(e||"").replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A")}function escapeProperty(e){return(e||"").replace(/%/g,"%25").replace(/\r/g,"%0D").replace(/\n/g,"%0A").replace(/:/g,"%3A").replace(/,/g,"%2C")}},470:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};var a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var t in e)if(Object.hasOwnProperty.call(e,t))r[t]=e[t];r["default"]=e;return r};Object.defineProperty(r,"__esModule",{value:true});const i=t(431);const o=a(t(87));const u=a(t(622));var s;(function(e){e[e["Success"]=0]="Success";e[e["Failure"]=1]="Failure"})(s=r.ExitCode||(r.ExitCode={}));function exportVariable(e,r){process.env[e]=r;i.issueCommand("set-env",{name:e},r)}r.exportVariable=exportVariable;function setSecret(e){i.issueCommand("add-mask",{},e)}r.setSecret=setSecret;function addPath(e){i.issueCommand("add-path",{},e);process.env["PATH"]=`${e}${u.delimiter}${process.env["PATH"]}`}r.addPath=addPath;function getInput(e,r){const t=process.env[`INPUT_${e.replace(/ /g,"_").toUpperCase()}`]||"";if(r&&r.required&&!t){throw new Error(`Input required and not supplied: ${e}`)}return t.trim()}r.getInput=getInput;function setOutput(e,r){i.issueCommand("set-output",{name:e},r)}r.setOutput=setOutput;function setFailed(e){process.exitCode=s.Failure;error(e)}r.setFailed=setFailed;function debug(e){i.issueCommand("debug",{},e)}r.debug=debug;function error(e){i.issue("error",e)}r.error=error;function warning(e){i.issue("warning",e)}r.warning=warning;function info(e){process.stdout.write(e+o.EOL)}r.info=info;function startGroup(e){i.issue("group",e)}r.startGroup=startGroup;function endGroup(){i.issue("endgroup")}r.endGroup=endGroup;function group(e,r){return n(this,void 0,void 0,function*(){startGroup(e);let t;try{t=yield r()}finally{endGroup()}return t})}r.group=group;function saveState(e,r){i.issueCommand("save-state",{name:e},r)}r.saveState=saveState;function getState(e){return process.env[`STATE_${e}`]||""}r.getState=getState},614:function(e){e.exports=require("events")},622:function(e){e.exports=require("path")},669:function(e){e.exports=require("util")},672:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};var a;Object.defineProperty(r,"__esModule",{value:true});const i=t(357);const o=t(747);const u=t(622);a=o.promises,r.chmod=a.chmod,r.copyFile=a.copyFile,r.lstat=a.lstat,r.mkdir=a.mkdir,r.readdir=a.readdir,r.readlink=a.readlink,r.rename=a.rename,r.rmdir=a.rmdir,r.stat=a.stat,r.symlink=a.symlink,r.unlink=a.unlink;r.IS_WINDOWS=process.platform==="win32";function exists(e){return n(this,void 0,void 0,function*(){try{yield r.stat(e)}catch(e){if(e.code==="ENOENT"){return false}throw e}return true})}r.exists=exists;function isDirectory(e,t=false){return n(this,void 0,void 0,function*(){const n=t?yield r.stat(e):yield r.lstat(e);return n.isDirectory()})}r.isDirectory=isDirectory;function isRooted(e){e=normalizeSeparators(e);if(!e){throw new Error('isRooted() parameter "p" cannot be empty')}if(r.IS_WINDOWS){return e.startsWith("\\")||/^[A-Z]:/i.test(e)}return e.startsWith("/")}r.isRooted=isRooted;function mkdirP(e,t=1e3,a=1){return n(this,void 0,void 0,function*(){i.ok(e,"a path argument must be provided");e=u.resolve(e);if(a>=t)return r.mkdir(e);try{yield r.mkdir(e);return}catch(n){switch(n.code){case"ENOENT":{yield mkdirP(u.dirname(e),t,a+1);yield r.mkdir(e);return}default:{let t;try{t=yield r.stat(e)}catch(e){throw n}if(!t.isDirectory())throw n}}}})}r.mkdirP=mkdirP;function tryGetExecutablePath(e,t){return n(this,void 0,void 0,function*(){let n=undefined;try{n=yield r.stat(e)}catch(r){if(r.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${r}`)}}if(n&&n.isFile()){if(r.IS_WINDOWS){const r=u.extname(e).toUpperCase();if(t.some(e=>e.toUpperCase()===r)){return e}}else{if(isUnixExecutable(n)){return e}}}const a=e;for(const i of t){e=a+i;n=undefined;try{n=yield r.stat(e)}catch(r){if(r.code!=="ENOENT"){console.log(`Unexpected error attempting to determine if executable file exists '${e}': ${r}`)}}if(n&&n.isFile()){if(r.IS_WINDOWS){try{const t=u.dirname(e);const n=u.basename(e).toUpperCase();for(const a of yield r.readdir(t)){if(n===a.toUpperCase()){e=u.join(t,a);break}}}catch(r){console.log(`Unexpected error attempting to determine the actual case of the file '${e}': ${r}`)}return e}else{if(isUnixExecutable(n)){return e}}}}return""})}r.tryGetExecutablePath=tryGetExecutablePath;function normalizeSeparators(e){e=e||"";if(r.IS_WINDOWS){e=e.replace(/\//g,"\\");return e.replace(/\\\\+/g,"\\")}return e.replace(/\/\/+/g,"/")}function isUnixExecutable(e){return(e.mode&1)>0||(e.mode&8)>0&&e.gid===process.getgid()||(e.mode&64)>0&&e.uid===process.getuid()}},747:function(e){e.exports=require("fs")},986:function(e,r,t){"use strict";var n=this&&this.__awaiter||function(e,r,t,n){function adopt(e){return e instanceof t?e:new t(function(r){r(e)})}return new(t||(t=Promise))(function(t,a){function fulfilled(e){try{step(n.next(e))}catch(e){a(e)}}function rejected(e){try{step(n["throw"](e))}catch(e){a(e)}}function step(e){e.done?t(e.value):adopt(e.value).then(fulfilled,rejected)}step((n=n.apply(e,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:true});const a=t(9);function exec(e,r,t){return n(this,void 0,void 0,function*(){const n=a.argStringToArray(e);if(n.length===0){throw new Error(`Parameter 'commandLine' cannot be null or empty.`)}const i=n[0];r=n.slice(1).concat(r||[]);const o=new a.ToolRunner(i,r,t);return o.exec()})}r.exec=exec}},function(e){"use strict";!function(){e.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})}}();!function(){var r=Object.prototype.hasOwnProperty;e.d=function(e,t,n){if(!r.call(e,t)){Object.defineProperty(e,t,{enumerable:true,get:n})}}}();!function(){e.t=function(r,t){if(t&1)r=this(r);if(t&8)return r;if(t&4&&typeof r==="object"&&r&&r.__esModule)return r;var n=Object.create(null);e.r(n);Object.defineProperty(n,"default",{enumerable:true,value:r});if(t&2&&typeof r!="string")for(var a in r)e.d(n,a,function(e){return r[e]}.bind(null,a));return n}}();!function(){e.n=function(r){var t=r&&r.__esModule?function getDefault(){return r["default"]}:function getModuleExports(){return r};e.d(t,"a",t);return t}}();!function(){e.hmd=function(e){e=Object.create(e);if(!e.children)e.children=[];Object.defineProperty(e,"loaded",{enumerable:true,get:function(){return e.l}});Object.defineProperty(e,"id",{enumerable:true,get:function(){return e.i}});Object.defineProperty(e,"exports",{enumerable:true,set:function(){throw new Error("ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: "+e.id)}});return e}}()}); \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index eed52d7e..79774446 100644 --- a/jest.config.js +++ b/jest.config.js @@ -5,4 +5,5 @@ module.exports = { moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], transform: { '^.+\\.(js|jsx)?$': 'babel-jest' }, transformIgnorePatterns: [`/node_modules/(?!${esModules})`], + setupFilesAfterEnv: ['./src/jest.setup.js'], }; diff --git a/src/index.js b/src/index.js index 47cd11fa..687bd95d 100644 --- a/src/index.js +++ b/src/index.js @@ -7,8 +7,8 @@ async function action() { Cache.verify(); const { dockerfile, workspace, actionFolder } = Action; - const buildParameters = BuildParameters.create(Input.getFromUser()); - const baseImage = new ImageTag({ ...buildParameters, version: buildParameters.unityVersion }); + const buildParameters = BuildParameters.create(await Input.getFromUser()); + const baseImage = new ImageTag(buildParameters); // Build docker image const builtImage = await Docker.build({ path: actionFolder, dockerfile, baseImage }); diff --git a/src/jest.setup.js b/src/jest.setup.js new file mode 100644 index 00000000..657a3840 --- /dev/null +++ b/src/jest.setup.js @@ -0,0 +1,15 @@ +expect.extend({ + toBeEitherAFunctionOrAnObject(received) { + const type = typeof received; + + const pass = ['object', 'function'].includes(type); + const message = `Expected a function or an object, received ${type}`; + + return { + message, + pass, + }; + }, +}); + +jest.mock('./model/input'); diff --git a/src/model/__mocks__/input.js b/src/model/__mocks__/input.js new file mode 100644 index 00000000..1cce57c4 --- /dev/null +++ b/src/model/__mocks__/input.js @@ -0,0 +1,17 @@ +// Import this named export into your test file: +import Platform from '../platform'; + +export const mockGetFromUser = jest.fn().mockResolvedValue({ + version: '', + targetPlatform: Platform.types.Test, + projectPath: '.', + buildName: Platform.types.Test, + buildsPath: 'build', + buildMethod: undefined, + buildVersion: '1.3.37', + customParameters: '', +}); + +export default { + getFromUser: mockGetFromUser, +}; diff --git a/src/model/__mocks__/versioning.js b/src/model/__mocks__/versioning.js new file mode 100644 index 00000000..e83d029f --- /dev/null +++ b/src/model/__mocks__/versioning.js @@ -0,0 +1,5 @@ +export const mockDetermineVersion = jest.fn(); + +export default { + determineVersion: mockDetermineVersion, +}; diff --git a/src/model/build-parameters.js b/src/model/build-parameters.js index b8abac96..c805013b 100644 --- a/src/model/build-parameters.js +++ b/src/model/build-parameters.js @@ -3,27 +3,25 @@ import Platform from './platform'; class BuildParameters { static create(parameters) { const { - unityVersion, + version, targetPlatform, projectPath, buildName, buildsPath, buildMethod, - versioning, - version, + buildVersion, customParameters, } = parameters; return { - unityVersion, + version, platform: targetPlatform, projectPath, buildName, buildPath: `${buildsPath}/${targetPlatform}`, buildFile: this.parseBuildFile(buildName, targetPlatform), buildMethod, - versioning, - version, + buildVersion, customParameters, }; } diff --git a/src/model/build-parameters.test.js b/src/model/build-parameters.test.js index 2acd0839..a18edb33 100644 --- a/src/model/build-parameters.test.js +++ b/src/model/build-parameters.test.js @@ -4,7 +4,7 @@ import Platform from './platform'; describe('BuildParameters', () => { describe('create', () => { const someParameters = { - unityVersion: 'someVersion', + version: 'someVersion', targetPlatform: 'somePlatform', projectPath: 'path/to/project', buildName: 'someBuildName', @@ -18,9 +18,7 @@ describe('BuildParameters', () => { }); it('returns the version', () => { - expect(BuildParameters.create(someParameters).unityVersion).toStrictEqual( - someParameters.unityVersion, - ); + expect(BuildParameters.create(someParameters).version).toStrictEqual(someParameters.version); }); it('returns the platform', () => { diff --git a/src/model/docker.js b/src/model/docker.js index 6062ba33..e4af28a9 100644 --- a/src/model/docker.js +++ b/src/model/docker.js @@ -19,7 +19,7 @@ class Docker { static async run(image, parameters, silent = false) { const { - unityVersion, + version, workspace, platform, projectPath, @@ -27,8 +27,7 @@ class Docker { buildPath, buildFile, buildMethod, - versioning, - version, + buildVersion, customParameters, } = parameters; @@ -40,15 +39,14 @@ class Docker { --env UNITY_EMAIL \ --env UNITY_PASSWORD \ --env UNITY_SERIAL \ - --env UNITY_VERSION="${unityVersion}" \ + --env UNITY_VERSION="${version}" \ --env PROJECT_PATH="${projectPath}" \ --env BUILD_TARGET="${platform}" \ --env BUILD_NAME="${buildName}" \ --env BUILD_PATH="${buildPath}" \ --env BUILD_FILE="${buildFile}" \ --env BUILD_METHOD="${buildMethod}" \ - --env VERSIONING="${versioning}" \ - --env VERSION="${version}" \ + --env VERSION="${buildVersion}" \ --env CUSTOM_PARAMETERS="${customParameters}" \ --env HOME=/github/home \ --env GITHUB_REF \ diff --git a/src/model/error/command-execution-error.js b/src/model/error/command-execution-error.js new file mode 100644 index 00000000..d256ffb3 --- /dev/null +++ b/src/model/error/command-execution-error.js @@ -0,0 +1,8 @@ +class CommandExecutionError extends Error { + constructor(message) { + super(message); + this.name = 'CommandExecutionError'; + } +} + +export default CommandExecutionError; diff --git a/src/model/error/command-execution-error.test.js b/src/model/error/command-execution-error.test.js new file mode 100644 index 00000000..c20fc2e6 --- /dev/null +++ b/src/model/error/command-execution-error.test.js @@ -0,0 +1,14 @@ +import CommandExecutionError from './command-execution-error'; + +describe('CommandExecutionError', () => { + it('instantiates', () => { + expect(() => new CommandExecutionError()).not.toThrow(); + }); + + test.each([1, 'one', { name: '!' }])('Displays title %s', message => { + const error = new CommandExecutionError(message); + + expect(error.name).toStrictEqual('CommandExecutionError'); + expect(error.message).toStrictEqual(message.toString()); + }); +}); diff --git a/src/model/error/not-implemented-exception.js b/src/model/error/not-implemented-exception.js new file mode 100644 index 00000000..ae809fe1 --- /dev/null +++ b/src/model/error/not-implemented-exception.js @@ -0,0 +1,8 @@ +class NotImplementedException extends Error { + constructor(message) { + super(message); + this.name = 'NotImplementedException'; + } +} + +export default NotImplementedException; diff --git a/src/model/error/not-implemented-exception.test.js b/src/model/error/not-implemented-exception.test.js new file mode 100644 index 00000000..8fa3e927 --- /dev/null +++ b/src/model/error/not-implemented-exception.test.js @@ -0,0 +1,14 @@ +import NotImplementedException from './not-implemented-exception'; + +describe('NotImplementedException', () => { + it('instantiates', () => { + expect(() => new NotImplementedException()).not.toThrow(); + }); + + test.each([1, 'one', { name: '!' }])('Displays title %s', message => { + const error = new NotImplementedException(message); + + expect(error.name).toStrictEqual('NotImplementedException'); + expect(error.message).toStrictEqual(message.toString()); + }); +}); diff --git a/src/model/index.js b/src/model/index.js index 69ff89c5..9649ec2c 100644 --- a/src/model/index.js +++ b/src/model/index.js @@ -7,5 +7,17 @@ import ImageTag from './image-tag'; import Platform from './platform'; import Project from './project'; import Unity from './unity'; +import Versioning from './versioning'; -export { Action, BuildParameters, Cache, Docker, Input, ImageTag, Platform, Project, Unity }; +export { + Action, + BuildParameters, + Cache, + Docker, + Input, + ImageTag, + Platform, + Project, + Unity, + Versioning, +}; diff --git a/src/model/index.test.js b/src/model/index.test.js index bd5fcbb5..c13bd86c 100644 --- a/src/model/index.test.js +++ b/src/model/index.test.js @@ -12,6 +12,6 @@ describe('Index', () => { 'Project', 'Unity', ])('exports %s', exportedModule => { - expect(typeof Index[exportedModule]).toStrictEqual('function'); + expect(Index[exportedModule]).toBeEitherAFunctionOrAnObject(); }); }); diff --git a/src/model/input.js b/src/model/input.js index 73a849e1..d10e56ad 100644 --- a/src/model/input.js +++ b/src/model/input.js @@ -1,43 +1,36 @@ import Platform from './platform'; -import ValidationError from './error/validation-error'; +import Versioning from './versioning'; const core = require('@actions/core'); -const versioningStrategies = ['None', 'Semantic', 'Tag', 'Custom']; - class Input { - static getFromUser() { + static async getFromUser() { // Input variables specified in workflows using "with" prop. - const unityVersion = core.getInput('unityVersion'); + const version = core.getInput('unityVersion'); const targetPlatform = core.getInput('targetPlatform') || Platform.default; const rawProjectPath = core.getInput('projectPath') || '.'; const buildName = core.getInput('buildName') || targetPlatform; const buildsPath = core.getInput('buildsPath') || 'build'; const buildMethod = core.getInput('buildMethod'); // processed in docker file - const versioning = core.getInput('versioning') || 'Semantic'; - const version = core.getInput('version') || ''; + const versioningStrategy = core.getInput('versioning') || 'Semantic'; + const specifiedVersion = core.getInput('version') || ''; const customParameters = core.getInput('customParameters') || ''; // Sanitise input const projectPath = rawProjectPath.replace(/\/$/, ''); - // Validate input - if (!versioningStrategies.includes(versioning)) { - throw new ValidationError( - `Versioning strategy should be one of ${versioningStrategies.join(', ')}.`, - ); - } + // Parse input + const buildVersion = await Versioning.determineVersion(versioningStrategy, specifiedVersion); - // Return sanitised input + // Return validated input return { - unityVersion, + version, targetPlatform, projectPath, buildName, buildsPath, buildMethod, - versioning, - version, + buildVersion, customParameters, }; } diff --git a/src/model/input.test.js b/src/model/input.test.js index 36e56517..fafd5f7e 100644 --- a/src/model/input.test.js +++ b/src/model/input.test.js @@ -1,13 +1,28 @@ +import { mockDetermineVersion } from './__mocks__/versioning'; import Input from './input'; +jest.restoreAllMocks(); +jest.mock('./versioning'); + +beforeEach(() => { + mockDetermineVersion.mockClear(); +}); + describe('Input', () => { describe('getFromUser', () => { - it('does not throw', () => { - expect(() => Input.getFromUser()).not.toThrow(); + it('does not throw', async () => { + await expect(Input.getFromUser()).resolves.not.toBeNull(); }); - it('returns an object', () => { - expect(typeof Input.getFromUser()).toStrictEqual('object'); + it('returns an object', async () => { + await expect(typeof (await Input.getFromUser())).toStrictEqual('object'); + }); + + it.skip('calls version generator once', async () => { + await Input.getFromUser(); + + // Todo - make sure the versioning mock is actually hit after restoreAllMocks is used. + expect(mockDetermineVersion).toHaveBeenCalledTimes(1); }); }); }); diff --git a/src/model/project.js b/src/model/project.js index c487e6a1..ef625939 100644 --- a/src/model/project.js +++ b/src/model/project.js @@ -4,7 +4,7 @@ import Action from './action'; class Project { static get relativePath() { - const { projectPath } = Input.getFromUser(); + const projectPath = Input.getFromUser().then(result => result.projectPath); return `${projectPath}`; } diff --git a/src/model/system.js b/src/model/system.js new file mode 100644 index 00000000..b8930313 --- /dev/null +++ b/src/model/system.js @@ -0,0 +1,26 @@ +import { exec } from '@actions/exec'; + +class System { + static async run(command, arguments_, options) { + let result = ''; + let error = ''; + + const listeners = { + stdout: dataBuffer => { + result += dataBuffer.toString(); + }, + stderr: dataBuffer => { + error += dataBuffer.toString(); + }, + }; + + const exitCode = await exec(command, arguments_, { ...options, listeners }); + if (exitCode !== 0) { + throw new Error(error); + } + + return result; + } +} + +export default System; diff --git a/src/model/versioning.js b/src/model/versioning.js new file mode 100644 index 00000000..42efe459 --- /dev/null +++ b/src/model/versioning.js @@ -0,0 +1,187 @@ +import * as core from '@actions/core'; +import { exec } from '@actions/exec'; +import NotImplementedException from './error/not-implemented-exception'; +import ValidationError from './error/validation-error'; +import System from './system'; + +export default class Versioning { + static get strategies() { + return { None: 'None', Semantic: 'Semantic', Tag: 'Tag', Custom: 'Custom' }; + } + + /** + * Get the branch name of the (related) branch + */ + static get branch() { + return this.headRef || this.ref.slice(11); + } + + /** + * For pull requests we can reliably use GITHUB_HEAD_REF + */ + static get headRef() { + return process.env.GITHUB_HEAD_REF; + } + + /** + * For branches GITHUB_REF will have format `refs/heads/feature-branch-1` + */ + static get ref() { + return process.env.GITHUB_REF; + } + + /** + * Regex to parse version description into separate fields + */ + static get descriptionRegex() { + return /^v([\d.]+)-(\d+)-g(\w+)-?(\w+)*/g; + } + + static async determineVersion(strategy, inputVersion) { + // Validate input + if (!Object.hasOwnProperty.call(this.strategies, strategy)) { + throw new ValidationError( + `Versioning strategy should be one of ${Object.values(this.strategies).join(', ')}.`, + ); + } + + let version; + switch (strategy) { + case this.strategies.None: + version = 'none'; + break; + case this.strategies.Custom: + version = inputVersion; + break; + case this.strategies.Semantic: + version = await this.generateSemanticVersion(); + break; + case this.strategies.Tag: + version = await this.generateTagVersion(); + break; + default: + throw new NotImplementedException(`Strategy ${strategy} is not implemented.`); + } + + return version; + } + + /** + * Automatically generates a version based on SemVer out of the box. + * + * The version works as follows: `..` for example `0.1.2`. + * + * The latest tag dictates `.` + * The number of commits since that tag dictates``. + * + * @See: https://semver.org/ + */ + static async generateSemanticVersion() { + await this.fetchAll(); + + if (await this.isDirty()) { + throw new Error('Branch is dirty. Refusing to base semantic version on uncommitted changes'); + } + + if (!(await this.hasAnyVersionTags())) { + const version = `0.0.${await this.getTotalNumberOfCommits()}`; + core.info(`Generated version ${version} (no version tags found).`); + return version; + } + + const { tag, commits, hash } = await this.parseSemanticVersion(); + core.info(`Found semantic version ${tag}.${commits} for ${this.branch}@${hash}`); + + return `${tag}.${commits}`; + } + + /** + * Generate the proper version for unity based on an existing tag. + */ + static async generateTagVersion() { + let tag = await this.getTag(); + + if (tag.charAt(0) === 'v') { + tag = tag.slice(1); + } + + return tag; + } + + /** + * Parses the versionDescription into their named parts. + */ + static async parseSemanticVersion() { + const description = await this.getVersionDescription(); + const [match, tag, commits, hash] = this.descriptionRegex.exec(description); + + if (!match) { + throw new Error(`Failed to parse git describe output: "${description}"`); + } + + return { + match, + tag, + commits, + hash, + }; + } + + static async fetchAll() { + await exec('git', ['fetch', '--all']); + } + + /** + * Retrieves information about the branch. + * + * Format: `v0.12-24-gd2198ab` + * + * In this format v0.12 is the latest tag, 24 are the number of commits since, and gd2198ab + * identifies the current commit. + */ + static async getVersionDescription() { + return System.run('git', ['describe', '--long', '--tags', '--always', `origin/${this.branch}`]); + } + + /** + * Returns whether there are uncommitted changes that are not ignored. + */ + static async isDirty() { + const output = await System.run('git', ['status', '--porcelain']); + + return output !== ''; + } + + /** + * Get the tag if there is one pointing at HEAD + */ + static async getTag() { + return System.run('git', ['tag', '--points-at', 'HEAD']); + } + + /** + * Whether or not the repository has any version tags yet. + */ + static async hasAnyVersionTags() { + const numberOfVersionCommits = await System.run('git', [ + '--list', + '--merged', + 'HEAD', + '|', + 'grep v[0-9]*', + '|', + 'wc -l', + ]); + + return numberOfVersionCommits !== '0'; + } + + /** + * Get the total number of commits on head. + */ + static async getTotalNumberOfCommits() { + const numberOfCommitsAsString = await System.run('git', ['rev-list', '--count', 'HEAD']); + + return parseInt(numberOfCommitsAsString, 10); + } +}