{"version":3,"sources":["https://lively-kernel.org/lively4/swd21-pipes-and-filters/demos/swd21/pipes-and-filters/pipe2.js;"],"names":["OutputPipe","elementArray","outputElement","pop","currentArray","tmpArray","currentValue","value","length","JSON","parse","push","popElement","stringify","concat","element","putDataIntoDataSink","outPutElement"],"mappings":";;;;;;;;;;;;AAAqBA,gB;AAEnB,8BAAc;AAAA;;AACZ,eAAKC,YAAL,GAAoB,EAApB;AACA,eAAKC,aAAL,GAAqB,EAArB;AACD;;;;uCAGY;AACX,mBAAO,KAAKD,YAAL,CAAkBE,GAAlB,EAAP;AACD;;;gDAEqB;AACpB,gBAAIC,eAAe,EAAnB;AACA,gBAAIC,WAAW,EAAf;;AAEA,gBAAIC,eAAe,KAAKJ,aAAL,CAAmBK,KAAtC;AACA,gBAAID,gBAAgBA,aAAaE,MAAb,GAAsB,CAA1C,EAA6C;AAC3CJ,6BAAeK,KAAKC,KAAL,CAAWJ,YAAX,CAAf;AACD;AACDD,qBAASM,IAAT,CAAc,KAAKC,UAAL,EAAd;AACA,iBAAKV,aAAL,CAAmBK,KAAnB,GAA2BE,KAAKI,SAAL,CAAeT,aAAaU,MAAb,CAAoBT,QAApB,CAAf,CAA3B;AACD;;;qCAEUU,O,EAAS;AAClB,iBAAKd,YAAL,CAAkBU,IAAlB,CAAuBI,OAAvB;AACA,iBAAKC,mBAAL;AACD;;;2CAEgBC,a,EAAc;AAC7B,iBAAKf,aAAL,GAAqBe,aAArB;AACD;;;;;;yBA/BkBjB,U","file":"pipe2.js;","sourcesContent":["export default class OutputPipe {\n  \n  constructor() {\n    this.elementArray = [];\n    this.outputElement = \"\";\n  }\n  \n  \n  popElement() {\n    return this.elementArray.pop()\n  }\n  \n  putDataIntoDataSink() {\n    var currentArray = []\n    var tmpArray = []\n    \n    var currentValue = this.outputElement.value\n    if (currentValue && currentValue.length > 0) {\n      currentArray = JSON.parse(currentValue)\n    }\n    tmpArray.push(this.popElement())\n    this.outputElement.value = JSON.stringify(currentArray.concat(tmpArray))\n  }\n\n  addElement(element) {\n    this.elementArray.push(element)\n    this.putDataIntoDataSink();\n  }\n  \n  setOutputElement(outPutElement){\n    this.outputElement = outPutElement;\n  }\n  \n}"]}