{
  "version": 1,
  "title": "Base64 Decode",
  "type": "shellScript",
  "template": "#!/usr/bin/osascript -l JavaScript\nObjC.import('Foundation');\n\nvar input = ObjC.unwrap($.NSProcessInfo.processInfo.environment.objectForKey('ONTEXT_TEXT'));\nvar data = $.NSData.alloc.initWithBase64EncodedStringOptions($(input.replace(/\\s+/g, '')), 0);\nvar text = data.isNil() ? null : $.NSString.alloc.initWithDataEncoding(data, $.NSUTF8StringEncoding);\nif (!text || text.isNil()) throw new Error('The selection is not Base64-encoded UTF-8 text.');\nvar output = ObjC.unwrap(text);\n\n$.NSFileHandle.fileHandleWithStandardOutput.writeData($(output).dataUsingEncoding($.NSUTF8StringEncoding));\nundefined;\n",
  "regex": "^\\s*[A-Za-z0-9+/=\\s]+$",
  "outputBehavior": "replaceSelection",
  "marketplace": {
    "id": "starter-base64-decode",
    "signature": "edNAAWTjq4hI35X85FkMeGhpxVIOfsbi1xFVvBI33juiq63synN7437mmR7DeV/5N4kRIDG13o1OSXlv5yG7Dw=="
  }
}
