(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{12:function(e,t,n){e.exports=n(21)},20:function(e,t,n){},21:function(e,t,n){"use strict";n.r(t);var a=n(1),i=n(2),r=n(6),s=n.n(r),l=function(){function e(t,n){Object(a.a)(this,e),this.version=4,this.emphasizeBytes=void 0,this.debugMode=!1,this.uiTheme=void 0,this.handlers=void 0,this.commandResults=void 0,this.persistedVersion=void 0,this.wasOldVersion=void 0,this.env=void 0,this.commandResults=[],this.handlers=[],this.uiTheme=t.uiTheme||"midnight",this.env=n,this.emphasizeBytes=t.emphasizeBytes||!0,this.persistedVersion=t.version||.1,this.wasOldVersion=null!=t.version&&this.version>this.persistedVersion,this.debugMode="prod"!==n||!0===t.debugMode}return Object(i.a)(e,[{key:"addCommandResult",value:function(e){this.commandResults.unshift(e),s.a.debug("result added",e),this.triggerChanged()}},{key:"clearCommandResults",value:function(){this.commandResults=[],this.triggerChanged()}},{key:"toggleEmphasizeBytes",value:function(){this.emphasizeBytes=!this.emphasizeBytes,this.triggerChanged()}},{key:"onChange",value:function(e){this.handlers.push(e)}},{key:"triggerChanged",value:function(){var e=this;this.handlers.forEach(function(t){return t(e)})}},{key:"setUiTheme",value:function(e){this.uiTheme=e,this.triggerChanged()}},{key:"toggleDebugMode",value:function(){this.debugMode=!this.debugMode,this.triggerChanged()}},{key:"getPersistData",value:function(){return{emphasizeBytes:this.emphasizeBytes,uiTheme:this.uiTheme,version:this.version,debugMode:this.debugMode}}}]),e}(),o={getPersistedData:function(){var e=window.localStorage.getItem("AppState");if(!e)return{};try{return JSON.parse(e)}catch(t){return console.error("Failed to parse AppState json. Json Value: \n"+e,t),{}}},watch:function(e){var t=this;e.onChange(function(){return t.persistData(e)})},persistData:function(e){localStorage.setItem("AppState",JSON.stringify(e.getPersistData()))}},u=function(e){return"object"==typeof e&&!(e instanceof Array)&&e instanceof Object},c=function(e){return"function"==typeof e},h=function(e){return"string"==typeof e},d=new(function(){function e(){Object(a.a)(this,e),this.debugMode=void 0,this.handlers=void 0,this.errorHandler=void 0,this.handlers=[],this.debugMode=!1,this.errorHandler=null}return Object(i.a)(e,[{key:"execute",value:function(e){s.a.debug("Executing command: ".concat(e));var t=e.trim().toLowerCase(),n=this.findHandler(t);if(null!=n)if(this.debugMode)this.invokeHandler(t,n);else try{this.invokeHandler(t,n)}catch(a){this.handleError(t,a)}else s.a.debug("Handled is not found for command: ".concat(e)),this.handleError(t,new Error("Unsupported expression: "+t.trim()))}},{key:"onError",value:function(e){this.errorHandler=e}},{key:"command",value:function(e,t){var n=this.createHandler(e,t);null!=n?c(n.canHandle)?c(n.handle)?this.handlers.push(n):console.warn('handler is missing "handle" function. registration denied.'):console.warn('handler is missing "canHandle" function. registration denied.'):console.warn("unexpected set of arguments: ",JSON.stringify(arguments))}},{key:"createHandler",value:function(e,t){return u(e)?e:h(e)?{canHandle:function(t){return t===e},handle:t}:null}},{key:"findHandler",value:function(e){return this.handlers.filter(function(t){return t.canHandle(e)})[0]}},{key:"invokeHandler",value:function(e,t){var n=t.handle({input:e});null!=n&&s.a.debug(n)}},{key:"handleError",value:function(e,t){this.debugMode&&console.error(e,t),null!=this.errorHandler&&this.errorHandler(e,t)}}]),e}()),m=n(4),p=n(3),f=n(5),g=function(){function e(t){Object(a.a)(this,e),this.input=void 0,this.inputHash=void 0,this.input=t,this.inputHash=this.encodeHash(t)}return Object(i.a)(e,[{key:"encodeHash",value:function(e){return encodeURI(e.trim().replace(/\s/g,","))}}]),e}(),v=function(e){function t(e){return Object(a.a)(this,t),Object(m.a)(this,Object(p.a)(t).call(this,e))}return Object(f.a)(t,e),t}(g),b=function(e){function t(e){return Object(a.a)(this,t),Object(m.a)(this,Object(p.a)(t).call(this,e))}return Object(f.a)(t,e),t}(g),E=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(m.a)(this,Object(p.a)(t).call(this,e))).message=void 0,n.message="Sorry, i don''t know what ".concat(e," is :("),n}return Object(f.a)(t,e),t}(g),y=function(e){function t(e,n){var i;return Object(a.a)(this,t),(i=Object(m.a)(this,Object(p.a)(t).call(this,e))).expression=void 0,i.expression=n,i}return Object(f.a)(t,e),t}(g),x=function(e){function t(e,n){var i;return Object(a.a)(this,t),(i=Object(m.a)(this,Object(p.a)(t).call(this,e))).error=void 0,i.error=n,i}return Object(f.a)(t,e),t}(g),O=function(e){function t(e){return Object(a.a)(this,t),Object(m.a)(this,Object(p.a)(t).call(this,e))}return Object(f.a)(t,e),t}(g),w=function(e){function t(e,n){var i;return Object(a.a)(this,t),(i=Object(m.a)(this,Object(p.a)(t).call(this,e))).value=void 0,i.value=n,i}return Object(f.a)(t,e),t}(g),k=n(7),B=n(8),_=function(){function e(t,n){Object(a.a)(this,e),this.numbers=void 0,this.expressionString=void 0,this.maxBitsLength=void 0,this.expressionString=t,this.numbers=n,this.maxBitsLength=n.map(function(e){return e.lengthInBits}).reduce(function(e,t){return e>=t?e:t},0)}return Object(i.a)(e,[{key:"toString",value:function(){return this.numbers.map(function(e){return e.value.toString()}).join(" ")}}]),e}(),j=function e(t,n){Object(a.a)(this,e),this.expressionString=void 0,this.expressionItems=void 0,this.expressionString=t,this.expressionItems=n},S=function(){function e(){Object(a.a)(this,e),this.factories=void 0,this.factories=[]}return Object(i.a)(e,[{key:"canParse",value:function(e){for(var t=e.replace(/^\s+|\s+$/,""),n=this.factories.length-1;n>=0;n--)if(!0===this.factories[n].canCreate(t))return!0;return!1}},{key:"parse",value:function(e){for(var t,n=e.replace(/^\s+|\s+$/,""),a=0,i=this.factories.length;a0&&n.push(k.a.parse(e.trim()))}),new _(e,n)}}]),e}(),C=function(){function e(){Object(a.a)(this,e),this.fullRegex=void 0,this.regex=void 0,this.fullRegex=/^((<<|>>|>>>|\||\&|\^)?(~?-?([b,x,a-f,0-9]+)))+$/,this.regex=/(<<|>>|>>>|\||\&|\^)?(~?-?(?:[b,x,a-f,0-9]+))/g}return Object(i.a)(e,[{key:"canCreate",value:function(e){return this.fullRegex.lastIndex=0,this.fullRegex.test(this.normalizeString(e))}},{key:"create",value:function(e){for(var t,n=[],a=this.normalizeString(e);null!=(t=this.regex.exec(a));)n.push(this.parseMatch(t));return new j(a,n)}},{key:"parseMatch",value:function(e){var t=e[0],n=e[1],a=e[2],i=null;return i=0==a.indexOf("~")?new B.a(a,k.a.parse(a.substring(1)),"~"):k.a.parse(a),null==n?i:new B.a(t,i,n)}},{key:"normalizeString",value:function(e){return e.replace(/\s+/g,"")}}]),e}(),I=new S;I.addFactory(new N),I.addFactory(new C);var M=n(10),R=n.n(M),z=function(e,t){e.debugMode=t.debugMode,t.onChange(function(){return e.debugMode=t.debugMode}),e.command("help",function(e){return t.addCommandResult(new v(e.input))}),e.command("clear",function(e){return t.clearCommandResults()}),e.command("em",function(e){return t.toggleEmphasizeBytes()}),e.command("dark",function(e){return t.setUiTheme("dark")}),e.command("light",function(e){return t.setUiTheme("light")}),e.command("midnight",function(e){return t.setUiTheme("midnight")}),e.command("about",function(e){return t.addCommandResult(new b(e.input))}),e.command("whatsnew",function(e){return t.addCommandResult(new O(e.input))}),e.command("guid",function(e){return t.addCommandResult(new w(e.input,R()()))}),e.command("-notrack",function(e){}),e.command("-debug",function(e){t.toggleDebugMode(),t.addCommandResult(new w(e.input,"Debug Mode: ".concat(t.debugMode)))}),e.command({canHandle:function(e){return I.canParse(e)},handle:function(e){var n=I.parse(e.input);t.toggleDebugMode(),t.addCommandResult(new y(e.input,n))}}),e.command({canHandle:function(){return!0},handle:function(e){return t.addCommandResult(new E(e.input))}}),e.onError(function(e,n){return t.addCommandResult(new x(e,n))})},D=n(0),L=n.n(D),H=function(e){function t(e){var n;return Object(a.a)(this,t),(n=Object(m.a)(this,Object(p.a)(t).call(this,e))).history=void 0,n.historyIndex=void 0,n.nameInput=void 0,n.nameInput=null,n.history=[],n.historyIndex=-1,n}return Object(f.a)(t,e),Object(i.a)(t,[{key:"componentDidMount",value:function(){null!=this.nameInput&&this.nameInput.focus()}},{key:"render",value:function(){var e=this;return L.a.createElement("input",{id:"in",type:"text",ref:function(t){e.nameInput=t},onKeyUp:function(t){return e.onKeyUp(t)},onKeyDown:function(t){return e.onKeyDown(t)},className:"expressionInput mono",placeholder:"type expression like '1>>2' or 'help' "})}},{key:"onKeyUp",value:function(e){var t=e.target;if(13==e.keyCode&&0!=t.value.trim().length){var n=t.value;this.history.unshift(n),this.historyIndex=-1,t.value="",this.props.onCommandEntered(n)}}},{key:"onKeyDown",value:function(e){if(38==e.keyCode){var t=this.historyIndex+1;return this.history.length>t&&(e.target.value=this.history[t],this.historyIndex=t),void e.preventDefault()}40==e.keyCode&&(this.historyIndex>0&&(e.target.value=this.history[--this.historyIndex]),e.preventDefault())}}]),t}(L.a.Component);var F=function(e){return L.a.createElement("a",{href:"javascript:void(0)",onClick:function(t){return d.execute(e.command||e.text)}},e.text)};var U=function(){return L.a.createElement("div",{className:"help helpResultTpl"},L.a.createElement("div",{style:{overflow:"hidden"}},L.a.createElement("div",{style:{float:"left",marginRight:"20px"}},L.a.createElement("div",{className:"section"},L.a.createElement("strong",null,"Supported Commands"),L.a.createElement("ul",null,L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"23 | 34"}))," \u2014 type bitwise expression to see result in binary (only positive integers are supported now)"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"23 34"}))," \u2014 type one or more numbers to see their binary representations"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"clear"}))," \u2014 clear output pane"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"help"}))," \u2014 display this help"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"whatsnew"}))," \u2014 display changelog"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"em"}))," \u2014 turn On/Off Emphasize Bytes"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"light"}))," \u2014 set Light theme"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"dark"}))," \u2014 set Dark theme"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"midnight"}))," \u2014 set Midnight theme"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"about"}))," \u2014 about the app"),L.a.createElement("li",null,L.a.createElement("code",null,L.a.createElement(F,{text:"guid"}))," \u2014 generate ",L.a.createElement("a",{href:"https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29"},"v4")," GUID")))),L.a.createElement("div",{style:{float:"left"}},L.a.createElement("div",{className:"section"},L.a.createElement("strong",null,"Supported Bitwise Operations"),L.a.createElement("br",null),L.a.createElement("small",null,L.a.createElement("a",{href:"https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators"},"as implemented in JavaScript engine")),L.a.createElement("ul",null,L.a.createElement("li",null,L.a.createElement("code",null,"&")," \u2014 bitwise AND"),L.a.createElement("li",null,L.a.createElement("code",null,"|")," \u2014 bitwise inclusive OR"),L.a.createElement("li",null,L.a.createElement("code",null,"^")," \u2014 bitwise exclusive XOR"),L.a.createElement("li",null,L.a.createElement("code",null,"~")," \u2014 bitwise NOT"),L.a.createElement("li",null,L.a.createElement("code",null,"<<")," \u2014 left shift"),L.a.createElement("li",null,L.a.createElement("code",null,">>")," \u2014 sign propagating right shift"),L.a.createElement("li",null,L.a.createElement("code",null,">>>")," \u2014 zero-fill right shift"))))))};var P=function(){return L.a.createElement("div",{className:"aboutTpl","data-result-type":"help"},L.a.createElement("p",null," Created by ",L.a.createElement("a",{href:"http://boryslevytskyi.github.io/"},"Borys Levytskyi"),". Please give it a like if BitwiseCmd has helped you in your work."),L.a.createElement("p",null,"If you have an idea, suggestion or you've spotted a bug here, please send it to ",L.a.createElement("a",{href:"mailto:bitwisecmd@gmail.com?subject=Feedback"},"bitwisecmd@gmail.com")," or tweet on ",L.a.createElement("a",{href:"http://twitter.com/BitwiseCmd"},"@BitwiseCmd"),". Your feedback is greatly appreciated."),L.a.createElement("p",null,L.a.createElement("a",{href:"https://github.com/BorisLevitskiy/BitwiseCmd"},"Project on ",L.a.createElement("strong",null,"GitHub"))))},T=function(e,t,n){var a=Array.prototype.slice.call(e);n=n||"0";if(null==t)return e;for(;t>a.length;)a.unshift(n);return a.join("")};var A=function(e){function t(){return Object(a.a)(this,t),Object(m.a)(this,Object(p.a)(t).apply(this,arguments))}return Object(f.a)(t,e),Object(i.a)(t,[{key:"render",value:function(){return L.a.createElement("span",null,this.getChildren())}},{key:"onBitClick",value:function(e,t){this.props.allowFlipBits&&this.props.onFlipBit&&this.props.onFlipBit({index:e,binaryString:this.props.binaryString,$event:t})}},{key:"getChildren",value:function(){var e=this.createBits(this.props.binaryString.split(""));return this.props.emphasizeBytes?this.splitIntoBytes(e):e}},{key:"createBits",value:function(e){var t=this,n=this.props.allowFlipBits||!1?" flipable":"";return e.map(function(e,a){var i="0"==e?"zero".concat(n):"one".concat(n);return L.a.createElement("span",{className:i,key:a,onClick:function(e){return t.onBitClick(a,e)}},e)})}},{key:"splitIntoBytes",value:function(e){for(var t=[],n=0;e.length>0;)t.push(L.a.createElement("span",{key:n++,className:"byte"},e.splice(0,8)));return t}}]),t}(L.a.Component),K=function(){function e(t){var n=t.emphasizeBytes,i=void 0!==n&&n,r=t.allowFlipBits,s=void 0!==r&&r;Object(a.a)(this,e),this.emphasizeBytes=void 0,this.items=void 0,this.maxNumberOfBits=void 0,this.allowFlipBits=void 0,this.emphasizeBytes=i,this.items=[],this.maxNumberOfBits=0,this.allowFlipBits=!0===s}return Object(i.a)(e,[{key:"addOperandRow",value:function(e){this.maxNumberOfBits=Math.max(e.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:"",css:"",expressionItem:e,allowFlipBits:this.allowFlipBits,label:""})}},{key:"addExpressionOperandRow",value:function(e){var t=e.isNotExpression?e.evaluate():e.getUnderlyingOperand();this.maxNumberOfBits=Math.max(t.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:e.sign,css:"",label:this.getLabel(t),expressionItem:e.operand,allowFlipBits:this.allowFlipBits})}},{key:"addShiftExpressionResultRow",value:function(e,t){this.maxNumberOfBits=Math.max(t.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:e.sign+e.operand.toString(),css:"expression-result",expressionItem:t,allowFlipBits:!1,label:""})}},{key:"addExpressionResultRow",value:function(e){this.maxNumberOfBits=Math.max(e.getLengthInBits(),this.maxNumberOfBits),this.items.push({sign:"=",css:"expression-result",expressionItem:e,allowFlipBits:!1,label:""})}},{key:"getLabel",value:function(e){return"bin"==e.base?e.toString("dec"):e.toString()}}],[{key:"buildListOfNumbers",value:function(t,n){var a=new e(n);return t.numbers.forEach(function(e){return a.addOperandRow(e)}),a.maxNumberOfBits=e.getNumberOfBits(a.maxNumberOfBits,a.emphasizeBytes),a}},{key:"buildMultiple",value:function(t,n){t.expressionItems[0];for(var a,i=0,r=t.expressionItems.length,s=new e(n),l=null;i"),this.props.content.input,L.a.createElement("a",{className:"hashLink",title:"Link for this expression",href:window.location.pathname+"#"+this.props.inputHash},"#")),L.a.createElement("div",{className:"content"},this.findResultComponent(this.props.content)))}},{key:"findResultComponent",value:function(e){return e instanceof v?L.a.createElement(U,null):e instanceof b?L.a.createElement(P,null):e instanceof y?L.a.createElement(V,{expression:e.expression,emphasizeBytes:this.props.appState.emphasizeBytes}):e instanceof O?L.a.createElement($,null):e instanceof w?L.a.createElement("p",null,e.value):e instanceof x?L.a.createElement("div",{className:"result"},L.a.createElement("div",{className:"error"},"(X_X) Ooops.. Something ain' right: ",L.a.createElement("strong",null,e.error.message))):L.a.createElement("div",{className:"result"},L.a.createElement("div",{className:"error"},"\xaf\\_(\u30c4)_/\xaf Sorry, i don\u2032t know what ",L.a.createElement("strong",null,this.props.content.input)," is"))}}]),t}(L.a.Component);var q=function(e){var t=[],n=e.appState;return"prod"!=e.appState.env&&t.push(n.env),e.appState.debugMode&&t.push("debug"),"false"===localStorage.getItem("TrackAnalytics")&&t.push("notrack"),0==t.length?null:L.a.createElement("div",null,t.map(function(e){return L.a.createElement("span",null,e,"\xa0")}))},G=function(e){function t(){return Object(a.a)(this,t),Object(m.a)(this,Object(p.a)(t).apply(this,arguments))}return Object(f.a)(t,e),Object(i.a)(t,[{key:"componentWillMount",value:function(){var e=this;this.refresh(),this.props.appState.onChange(function(){return e.refresh()})}},{key:"refresh",value:function(){this.setState(this.props.appState)}},{key:"getIndicator",value:function(e){return e?"on":"off"}},{key:"getResultViews",value:function(){var e=this;return s.a.debug("getting result views"),this.state.commandResults.map(function(t,n){return L.a.createElement(W,{key:n,content:t,input:t.input,inputHash:t.inputHash,appState:e.props.appState})})}},{key:"toggleEmphasizeBytes",value:function(){this.props.appState.toggleEmphasizeBytes()}},{key:"render",value:function(){var e=this;return L.a.createElement("div",{className:"app-root ".concat(this.state.uiTheme)},L.a.createElement(q,{appState:this.props.appState}),L.a.createElement("div",{className:"header"},L.a.createElement("h1",null,"Bitwise",L.a.createElement("span",{className:"header-cmd"},"Cmd")),L.a.createElement("ul",{className:"top-links"},L.a.createElement("li",null,L.a.createElement("a",{href:"https://github.com/BorisLevitskiy/BitwiseCmd"},L.a.createElement("i",{className:"icon github"},"\xa0"),L.a.createElement("span",{className:"link-text"},"Project on GitHub"))),L.a.createElement("li",null,L.a.createElement("a",{href:"https://twitter.com/BitwiseCmd"},L.a.createElement("i",{className:"icon twitter"},"\xa0"),L.a.createElement("span",{className:"link-text"},"Twitter"))),L.a.createElement("li",null,L.a.createElement("a",{href:"mailto:bitwisecmd@gmail.com?subject=Feedback"},L.a.createElement("i",{className:"icon feedback"},"\xa0"),L.a.createElement("span",{className:"link-text"},"Send Feedback"))))),L.a.createElement("div",{className:"expressionInput-container"},L.a.createElement(H,{onCommandEntered:function(e){return d.execute(e)}}),L.a.createElement("span",{className:"configPnl"},L.a.createElement("span",{id:"emphasizeBytes","data-cmd":"em",className:"indicator "+this.getIndicator(this.state.emphasizeBytes),title:"Toggle Emphasize Bytes",onClick:function(t){return e.toggleEmphasizeBytes()}},"[em]"))),L.a.createElement("div",{id:"output"},this.getResultViews()))}}]),t}(L.a.Component),X={encodeHash:function(e){return encodeURI(e.trim().replace(/\s/g,","))},decodeHash:function(e){return decodeURI(e).replace(/^\#/,"").replace(/,/g," ")},getArgs:function(e){var t=this.decodeHash(e),n=[];return function(e){var t=[];e.indexOf("||")?e.split("||").forEach(function(e){e.length>0&&t.push(e)}):t.push(e);return t}(t).forEach(function(e){n.push(e)}),n}};var Y,Q=n(11),Z=n.n(Q),ee=(n(20),"bitwisecmd.com"===window.location.host?"prod":"stage");"prod"!=(Y=ee)?(s.a.setLevel("debug"),s.a.debug("Log level is set to debug. Env: ".concat(Y))):s.a.setLevel("warn");var te=function(e){var t=o.getPersistedData(),n=new l(t,e);return o.watch(n),s.a.debug("appState initialized",n),n}(ee);z(d,te),function(){var e=X.getArgs(window.location.hash),t=["help","1|2&6","1 2 4 8 16 32 0b1000000 0x80"];te.wasOldVersion&&(t=["whatsnew"]);e.length>0&&(t=e);t.forEach(d.execute.bind(d))}();var ne=L.a.createElement(G,{appState:te});Z.a.render(ne,document.getElementById("root")),s.a.debug("started")},7:function(e,t,n){"use strict";var a=n(1),i=n(2),r=[{regex:/^-?\d+$/,radix:10,base:"dec",prefix:"^$"},{regex:/^-?0x[0-9,a-f]+$/i,radix:16,base:"hex",prefix:/0x/i},{regex:/^-?0b[0-1]+$/i,radix:2,base:"bin",prefix:/0b/i}],s=new(function(){function e(t){Object(a.a)(this,e),this.parsers=void 0,this.parsers=t}return Object(i.a)(e,[{key:"parse",value:function(e){var t=this;return this.parsers.map(function(n){return t.applyParser(n,e)}).reduce(function(e,t){return e||t})}},{key:"parseOperator",value:function(e){var t=e.match(e);return null==t||0==t.length?null:t[0]}},{key:"applyParser",value:function(e,t){return e.regex.test(t)?{value:parseInt(t.replace(e.prefix,""),e.radix),base:e.base,input:t}:null}}]),e}())(r);n.d(t,"a",function(){return o});var l=1,o=function(){function e(t,n){Object(a.a)(this,e),this.id=void 0,this.value=void 0,this.base=void 0,this.lengthInBits=void 0,this.isExpression=void 0,this.id=l++,this.value=t,this.base=n||"dec",this.lengthInBits=e.getBitLength(this.value),this.isExpression=!1}return Object(i.a)(e,[{key:"getLengthInBits",value:function(){return this.value<0?32:Math.floor(Math.log(this.value)/Math.log(2))+1}},{key:"getOtherBase",value:function(e){switch(e||this.base){case"dec":case"bin":return"hex";case"hex":return"dec";default:throw new Error(e+" kind doesn't have opposite kind")}}},{key:"toString",value:function(t){return e.toBaseString(this.value,t||this.base)}},{key:"toOtherKindString",value:function(){return this.toString(this.getOtherBase())}},{key:"toDecimalString",value:function(){return this.toString("dec")}},{key:"toHexString",value:function(){return this.toString("hex")}},{key:"toBinaryString",value:function(){return this.toString("bin")}},{key:"setValue",value:function(t){this.value=t,this.lengthInBits=e.getBitLength(t)}},{key:"evaluate",value:function(){return this}},{key:"getUnderlyingOperand",value:function(){return this}}],[{key:"getBitLength",value:function(e){return Math.floor(Math.log(e)/Math.log(2))+1}},{key:"getBase",value:function(e){switch(e){case"bin":return 2;case"hex":return 16;case"dec":return 10}}},{key:"create",value:function(t,n){return new e(t,n||"dec")}},{key:"parse",value:function(t){var n=s.parse(t);if(!n)throw new Error(t+" is not a valid number");return new e(n.value,n.base)}},{key:"toBaseString",value:function(e,t){switch(t){case"hex":var n=Math.abs(e).toString(16);return e>=0?"0x"+n:"-0x"+n;case"bin":return(e>>>0).toString(2);case"dec":return e.toString(10);default:throw new Error("Unexpected kind: "+t)}}},{key:"toHexString",value:function(e){return 0===e.indexOf("-")?"-0x"+e.substr(1):"0x"+e}}]),e}()},8:function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,"a",function(){return ExpressionOperand});var D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1),D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(2),_NumericOperand__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(7),ExpressionOperand=function(){function ExpressionOperand(e,t,n){Object(D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__.a)(this,ExpressionOperand),this.expressionString=void 0,this.operand=void 0,this.sign=void 0,this.isExpression=void 0,this.isShiftExpression=void 0,this.isNotExpression=void 0,this.expressionString=e,this.operand=t,this.sign=n,this.isExpression=!0,this.isShiftExpression=this.sign.indexOf("<")>=0||this.sign.indexOf(">")>=0,this.isNotExpression="~"===this.sign}return Object(D_MyStuff_Pet_BitwiseCmd_node_modules_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__.a)(ExpressionOperand,[{key:"evaluate",value:function evaluate(operand){if(operand instanceof ExpressionOperand)throw new Error("value shouldnt be expression");var evaluatedOperand=this.operand.evaluate(),str="";if("~"==this.sign)str="~"+evaluatedOperand.value;else{if(null==operand)throw new Error("Other is required for expression: "+this.expressionString);str=operand.value+this.sign+evaluatedOperand.value}return _NumericOperand__WEBPACK_IMPORTED_MODULE_2__.a.create(eval(str),evaluatedOperand.base)}},{key:"getUnderlyingOperand",value:function(){return this.operand.getUnderlyingOperand()}},{key:"toString",value:function(){return this.sign+this.operand.toString()}}]),ExpressionOperand}()}},[[12,1,2]]]); //# sourceMappingURL=main.ff2608fb.chunk.js.map