prisme-flow
Version:
prisme platform flow engine
2 lines • 59.8 kB
JavaScript
!function(a){function b(a,b){for(var c=a,d="";c;){var e=b[c];if("string"==typeof e)return e+d;if(e)return e.location.replace(/\/*$/,"/")+(d||e.main||e.name);if(e===!1)return"";var f=c.lastIndexOf("/");if(f===-1)break;d=c.substr(f)+d,c=c.slice(0,f)}return a}if(!("undefined"!=typeof a.window&&a.document||a.require&&a.define)){a.console||(a.console=function(){var a=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:a})},a.console.error=a.console.warn=a.console.log=a.console.trace=a.console),a.window=a,a.ace=a,a.onerror=function(a,b,c,d,e){postMessage({type:"error",data:{message:a,data:e.data,file:b,line:c,col:d,stack:e.stack}})},a.normalizeModule=function(b,c){if(c.indexOf("!")!==-1){var d=c.split("!");return a.normalizeModule(b,d[0])+"!"+a.normalizeModule(b,d[1])}if("."==c.charAt(0)){var e=b.split("/").slice(0,-1).join("/");for(c=(e?e+"/":"")+c;c.indexOf(".")!==-1&&f!=c;){var f=c;c=c.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return c},a.require=function(c,d){if(d||(d=c,c=null),!d.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");d=a.normalizeModule(c,d);var e=a.require.modules[d];if(e)return e.initialized||(e.initialized=!0,e.exports=e.factory().exports),e.exports;if(!a.require.tlns)return console.log("unable to load "+d);var f=b(d,a.require.tlns);return".js"!=f.slice(-3)&&(f+=".js"),a.require.id=d,a.require.modules[d]={},importScripts(f),a.require(c,d)},a.require.modules={},a.require.tlns={},a.define=function(b,c,d){if(2==arguments.length?(d=c,"string"!=typeof b&&(c=b,b=a.require.id)):1==arguments.length&&(d=b,c=[],b=a.require.id),"function"!=typeof d)return void(a.require.modules[b]={exports:d,initialized:!0});c.length||(c=["require","exports","module"]);var e=function(c){return a.require(b,c)};a.require.modules[b]={exports:{},factory:function(){var a=this,b=d.apply(this,c.map(function(b){switch(b){case"require":return e;case"exports":return a.exports;case"module":return a;default:return e(b)}}));return b&&(a.exports=b),a}}},a.define.amd={},require.tlns={},a.initBaseUrls=function(a){for(var b in a)require.tlns[b]=a[b]},a.initSender=function(){var b=a.require("ace/lib/event_emitter").EventEmitter,c=a.require("ace/lib/oop"),d=function(){};return function(){c.implement(this,b),this.callback=function(a,b){postMessage({type:"call",id:b,data:a})},this.emit=function(a,b){postMessage({type:"event",name:a,data:b})}}.call(d.prototype),new d};var c=a.main=null,d=a.sender=null;a.onmessage=function(b){var e=b.data;if(e.event&&d)d._signal(e.event,e.data);else if(e.command)if(c[e.command])c[e.command].apply(c,e.args);else{if(!a[e.command])throw new Error("Unknown command:"+e.command);a[e.command].apply(a,e.args)}else if(e.init){a.initBaseUrls(e.tlns),require("ace/lib/es5-shim"),d=a.sender=a.initSender();var f=require(e.module)[e.classname];c=a.main=new f(d)}}}}(this),define("ace/lib/oop",["require","exports","module"],function(a,b,c){"use strict";b.inherits=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})},b.mixin=function(a,b){for(var c in b)a[c]=b[c];return a},b.implement=function(a,c){b.mixin(a,c)}}),define("ace/range",["require","exports","module"],function(a,b,c){"use strict";var d=function(a,b){return a.row-b.row||a.column-b.column},e=function(a,b,c,d){this.start={row:a,column:b},this.end={row:c,column:d}};(function(){this.isEqual=function(a){return this.start.row===a.start.row&&this.end.row===a.end.row&&this.start.column===a.start.column&&this.end.column===a.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(a,b){return 0==this.compare(a,b)},this.compareRange=function(a){var b,c=a.end,d=a.start;return b=this.compare(c.row,c.column),1==b?(b=this.compare(d.row,d.column),1==b?2:0==b?1:0):b==-1?-2:(b=this.compare(d.row,d.column),b==-1?-1:1==b?42:0)},this.comparePoint=function(a){return this.compare(a.row,a.column)},this.containsRange=function(a){return 0==this.comparePoint(a.start)&&0==this.comparePoint(a.end)},this.intersects=function(a){var b=this.compareRange(a);return b==-1||0==b||1==b},this.isEnd=function(a,b){return this.end.row==a&&this.end.column==b},this.isStart=function(a,b){return this.start.row==a&&this.start.column==b},this.setStart=function(a,b){"object"==typeof a?(this.start.column=a.column,this.start.row=a.row):(this.start.row=a,this.start.column=b)},this.setEnd=function(a,b){"object"==typeof a?(this.end.column=a.column,this.end.row=a.row):(this.end.row=a,this.end.column=b)},this.inside=function(a,b){return 0==this.compare(a,b)&&(!this.isEnd(a,b)&&!this.isStart(a,b))},this.insideStart=function(a,b){return 0==this.compare(a,b)&&!this.isEnd(a,b)},this.insideEnd=function(a,b){return 0==this.compare(a,b)&&!this.isStart(a,b)},this.compare=function(a,b){return this.isMultiLine()||a!==this.start.row?a<this.start.row?-1:a>this.end.row?1:this.start.row===a?b>=this.start.column?0:-1:this.end.row===a?b<=this.end.column?0:1:0:b<this.start.column?-1:b>this.end.column?1:0},this.compareStart=function(a,b){return this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.compareEnd=function(a,b){return this.end.row==a&&this.end.column==b?1:this.compare(a,b)},this.compareInside=function(a,b){return this.end.row==a&&this.end.column==b?1:this.start.row==a&&this.start.column==b?-1:this.compare(a,b)},this.clipRows=function(a,b){if(this.end.row>b)var c={row:b+1,column:0};else if(this.end.row<a)var c={row:a,column:0};if(this.start.row>b)var d={row:b+1,column:0};else if(this.start.row<a)var d={row:a,column:0};return e.fromPoints(d||this.start,c||this.end)},this.extend=function(a,b){var c=this.compare(a,b);if(0==c)return this;if(c==-1)var d={row:a,column:b};else var f={row:a,column:b};return e.fromPoints(d||this.start,f||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return e.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new e(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new e(this.start.row,0,this.end.row,0)},this.toScreenRange=function(a){var b=a.documentToScreenPosition(this.start),c=a.documentToScreenPosition(this.end);return new e(b.row,b.column,c.row,c.column)},this.moveBy=function(a,b){this.start.row+=a,this.start.column+=b,this.end.row+=a,this.end.column+=b}}).call(e.prototype),e.fromPoints=function(a,b){return new e(a.row,a.column,b.row,b.column)},e.comparePoints=d,e.comparePoints=function(a,b){return a.row-b.row||a.column-b.column},b.Range=e}),define("ace/apply_delta",["require","exports","module"],function(a,b,c){"use strict";b.applyDelta=function(a,b,c){var d=b.start.row,e=b.start.column,f=a[d]||"";switch(b.action){case"insert":var g=b.lines;if(1===g.length)a[d]=f.substring(0,e)+b.lines[0]+f.substring(e);else{var h=[d,1].concat(b.lines);a.splice.apply(a,h),a[d]=f.substring(0,e)+a[d],a[d+b.lines.length-1]+=f.substring(e)}break;case"remove":var i=b.end.column,j=b.end.row;d===j?a[d]=f.substring(0,e)+f.substring(i):a.splice(d,j-d+1,f.substring(0,e)+a[j].substring(i))}}}),define("ace/lib/event_emitter",["require","exports","module"],function(a,b,c){"use strict";var d={},e=function(){this.propagationStopped=!0},f=function(){this.defaultPrevented=!0};d._emit=d._dispatchEvent=function(a,b){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var c=this._eventRegistry[a]||[],d=this._defaultHandlers[a];if(c.length||d){"object"==typeof b&&b||(b={}),b.type||(b.type=a),b.stopPropagation||(b.stopPropagation=e),b.preventDefault||(b.preventDefault=f),c=c.slice();for(var g=0;g<c.length&&(c[g](b,this),!b.propagationStopped);g++);return d&&!b.defaultPrevented?d(b,this):void 0}},d._signal=function(a,b){var c=(this._eventRegistry||{})[a];if(c){c=c.slice();for(var d=0;d<c.length;d++)c[d](b,this)}},d.once=function(a,b){var c=this;b&&this.addEventListener(a,function d(){c.removeEventListener(a,d),b.apply(null,arguments)})},d.setDefaultHandler=function(a,b){var c=this._defaultHandlers;if(c||(c=this._defaultHandlers={_disabled_:{}}),c[a]){var d=c[a],e=c._disabled_[a];e||(c._disabled_[a]=e=[]),e.push(d);var f=e.indexOf(b);f!=-1&&e.splice(f,1)}c[a]=b},d.removeDefaultHandler=function(a,b){var c=this._defaultHandlers;if(c){var d=c._disabled_[a];if(c[a]==b){c[a];d&&this.setDefaultHandler(a,d.pop())}else if(d){var e=d.indexOf(b);e!=-1&&d.splice(e,1)}}},d.on=d.addEventListener=function(a,b,c){this._eventRegistry=this._eventRegistry||{};var d=this._eventRegistry[a];return d||(d=this._eventRegistry[a]=[]),d.indexOf(b)==-1&&d[c?"unshift":"push"](b),b},d.off=d.removeListener=d.removeEventListener=function(a,b){this._eventRegistry=this._eventRegistry||{};var c=this._eventRegistry[a];if(c){var d=c.indexOf(b);d!==-1&&c.splice(d,1)}},d.removeAllListeners=function(a){this._eventRegistry&&(this._eventRegistry[a]=[])},b.EventEmitter=d}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(a,b,c){"use strict";var d=a("./lib/oop"),e=a("./lib/event_emitter").EventEmitter,f=b.Anchor=function(a,b,c){this.$onChange=this.onChange.bind(this),this.attach(a),"undefined"==typeof c?this.setPosition(b.row,b.column):this.setPosition(b,c)};(function(){function a(a,b,c){var d=c?a.column<=b.column:a.column<b.column;return a.row<b.row||a.row==b.row&&d}function b(b,c,d){var e="insert"==b.action,f=(e?1:-1)*(b.end.row-b.start.row),g=(e?1:-1)*(b.end.column-b.start.column),h=b.start,i=e?h:b.end;return a(c,h,d)?{row:c.row,column:c.column}:a(i,c,!d)?{row:c.row+f,column:c.column+(c.row==i.row?g:0)}:{row:h.row,column:h.column}}d.implement(this,e),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(a){if(!(a.start.row==a.end.row&&a.start.row!=this.row||a.start.row>this.row)){var c=b(a,{row:this.row,column:this.column},this.$insertRight);this.setPosition(c.row,c.column,!0)}},this.setPosition=function(a,b,c){var d;if(d=c?{row:a,column:b}:this.$clipPositionToDocument(a,b),this.row!=d.row||this.column!=d.column){var e={row:this.row,column:this.column};this.row=d.row,this.column=d.column,this._signal("change",{old:e,value:d})}},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(a){this.document=a||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(a,b){var c={};return a>=this.document.getLength()?(c.row=Math.max(0,this.document.getLength()-1),c.column=this.document.getLine(c.row).length):a<0?(c.row=0,c.column=0):(c.row=a,c.column=Math.min(this.document.getLine(c.row).length,Math.max(0,b))),b<0&&(c.column=0),c}}).call(f.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(a,b,c){"use strict";var d=a("./lib/oop"),e=a("./apply_delta").applyDelta,f=a("./lib/event_emitter").EventEmitter,g=a("./range").Range,h=a("./anchor").Anchor,i=function(a){this.$lines=[""],0===a.length?this.$lines=[""]:Array.isArray(a)?this.insertMergedLines({row:0,column:0},a):this.insert({row:0,column:0},a)};(function(){d.implement(this,f),this.setValue=function(a){var b=this.getLength()-1;this.remove(new g(0,0,b,this.getLine(b).length)),this.insert({row:0,column:0},a)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(a,b){return new h(this,a,b)},0==="aaa".split(/a/).length?this.$split=function(a){return a.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(a){return a.split(/\r\n|\r|\n/)},this.$detectNewLine=function(a){var b=a.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=b?b[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(a){this.$newLineMode!==a&&(this.$newLineMode=a,this._signal("changeNewLineMode"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(a){return"\r\n"==a||"\r"==a||"\n"==a},this.getLine=function(a){return this.$lines[a]||""},this.getLines=function(a,b){return this.$lines.slice(a,b+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(a){return this.getLinesForRange(a).join(this.getNewLineCharacter())},this.getLinesForRange=function(a){var b;if(a.start.row===a.end.row)b=[this.getLine(a.start.row).substring(a.start.column,a.end.column)];else{b=this.getLines(a.start.row,a.end.row),b[0]=(b[0]||"").substring(a.start.column);var c=b.length-1;a.end.row-a.start.row==c&&(b[c]=b[c].substring(0,a.end.column))}return b},this.insertLines=function(a,b){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(a,b)},this.removeLines=function(a,b){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(a,b)},this.insertNewLine=function(a){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(a,["",""])},this.insert=function(a,b){return this.getLength()<=1&&this.$detectNewLine(b),this.insertMergedLines(a,this.$split(b))},this.insertInLine=function(a,b){var c=this.clippedPos(a.row,a.column),d=this.pos(a.row,a.column+b.length);return this.applyDelta({start:c,end:d,action:"insert",lines:[b]},!0),this.clonePos(d)},this.clippedPos=function(a,b){var c=this.getLength();void 0===a?a=c:a<0?a=0:a>=c&&(a=c-1,b=void 0);var d=this.getLine(a);return void 0==b&&(b=d.length),b=Math.min(Math.max(b,0),d.length),{row:a,column:b}},this.clonePos=function(a){return{row:a.row,column:a.column}},this.pos=function(a,b){return{row:a,column:b}},this.$clipPosition=function(a){var b=this.getLength();return a.row>=b?(a.row=Math.max(0,b-1),a.column=this.getLine(b-1).length):(a.row=Math.max(0,a.row),a.column=Math.min(Math.max(a.column,0),this.getLine(a.row).length)),a},this.insertFullLines=function(a,b){a=Math.min(Math.max(a,0),this.getLength());var c=0;a<this.getLength()?(b=b.concat([""]),c=0):(b=[""].concat(b),a--,c=this.$lines[a].length),this.insertMergedLines({row:a,column:c},b)},this.insertMergedLines=function(a,b){var c=this.clippedPos(a.row,a.column),d={row:c.row+b.length-1,column:(1==b.length?c.column:0)+b[b.length-1].length};return this.applyDelta({start:c,end:d,action:"insert",lines:b}),this.clonePos(d)},this.remove=function(a){var b=this.clippedPos(a.start.row,a.start.column),c=this.clippedPos(a.end.row,a.end.column);return this.applyDelta({start:b,end:c,action:"remove",lines:this.getLinesForRange({start:b,end:c})}),this.clonePos(b)},this.removeInLine=function(a,b,c){var d=this.clippedPos(a,b),e=this.clippedPos(a,c);return this.applyDelta({start:d,end:e,action:"remove",lines:this.getLinesForRange({start:d,end:e})},!0),this.clonePos(d)},this.removeFullLines=function(a,b){a=Math.min(Math.max(0,a),this.getLength()-1),b=Math.min(Math.max(0,b),this.getLength()-1);var c=b==this.getLength()-1&&a>0,d=b<this.getLength()-1,e=c?a-1:a,f=c?this.getLine(e).length:0,h=d?b+1:b,i=d?0:this.getLine(h).length,j=new g(e,f,h,i),k=this.$lines.slice(a,b+1);return this.applyDelta({start:j.start,end:j.end,action:"remove",lines:this.getLinesForRange(j)}),k},this.removeNewLine=function(a){a<this.getLength()-1&&a>=0&&this.applyDelta({start:this.pos(a,this.getLine(a).length),end:this.pos(a+1,0),action:"remove",lines:["",""]})},this.replace=function(a,b){if(a instanceof g||(a=g.fromPoints(a.start,a.end)),0===b.length&&a.isEmpty())return a.start;if(b==this.getTextRange(a))return a.end;this.remove(a);var c;return c=b?this.insert(a.start,b):a.start},this.applyDeltas=function(a){for(var b=0;b<a.length;b++)this.applyDelta(a[b])},this.revertDeltas=function(a){for(var b=a.length-1;b>=0;b--)this.revertDelta(a[b])},this.applyDelta=function(a,b){var c="insert"==a.action;(c?a.lines.length<=1&&!a.lines[0]:!g.comparePoints(a.start,a.end))||(c&&a.lines.length>2e4&&this.$splitAndapplyLargeDelta(a,2e4),e(this.$lines,a,b),this._signal("change",a))},this.$splitAndapplyLargeDelta=function(a,b){for(var c=a.lines,d=c.length,e=a.start.row,f=a.start.column,g=0,h=0;;){g=h,h+=b-1;var i=c.slice(g,h);if(h>d){a.lines=i,a.start.row=e+g,a.start.column=f;break}i.push(""),this.applyDelta({start:this.pos(e+g,f),end:this.pos(e+h,f=0),action:a.action,lines:i},!0)}},this.revertDelta=function(a){this.applyDelta({start:this.clonePos(a.start),end:this.clonePos(a.end),action:"insert"==a.action?"remove":"insert",lines:a.lines.slice()})},this.indexToPosition=function(a,b){for(var c=this.$lines||this.getAllLines(),d=this.getNewLineCharacter().length,e=b||0,f=c.length;e<f;e++)if(a-=c[e].length+d,a<0)return{row:e,column:a+c[e].length+d};return{row:f-1,column:c[f-1].length}},this.positionToIndex=function(a,b){for(var c=this.$lines||this.getAllLines(),d=this.getNewLineCharacter().length,e=0,f=Math.min(a.row,c.length),g=b||0;g<f;++g)e+=c[g].length+d;return e+a.column}}).call(i.prototype),b.Document=i}),define("ace/lib/lang",["require","exports","module"],function(a,b,c){"use strict";b.last=function(a){return a[a.length-1]},b.stringReverse=function(a){return a.split("").reverse().join("")},b.stringRepeat=function(a,b){for(var c="";b>0;)1&b&&(c+=a),(b>>=1)&&(a+=a);return c};var d=/^\s\s*/,e=/\s\s*$/;b.stringTrimLeft=function(a){return a.replace(d,"")},b.stringTrimRight=function(a){return a.replace(e,"")},b.copyObject=function(a){var b={};for(var c in a)b[c]=a[c];return b},b.copyArray=function(a){for(var b=[],c=0,d=a.length;c<d;c++)a[c]&&"object"==typeof a[c]?b[c]=this.copyObject(a[c]):b[c]=a[c];return b},b.deepCopy=function a(b){if("object"!=typeof b||!b)return b;var c;if(Array.isArray(b)){c=[];for(var d=0;d<b.length;d++)c[d]=a(b[d]);return c}if("[object Object]"!==Object.prototype.toString.call(b))return b;c={};for(var d in b)c[d]=a(b[d]);return c},b.arrayToMap=function(a){for(var b={},c=0;c<a.length;c++)b[a[c]]=1;return b},b.createMap=function(a){var b=Object.create(null);for(var c in a)b[c]=a[c];return b},b.arrayRemove=function(a,b){for(var c=0;c<=a.length;c++)b===a[c]&&a.splice(c,1)},b.escapeRegExp=function(a){return a.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},b.escapeHTML=function(a){return a.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},b.getMatchOffsets=function(a,b){var c=[];return a.replace(b,function(a){c.push({offset:arguments[arguments.length-2],length:a.length})}),c},b.deferredCall=function(a){var b=null,c=function(){b=null,a()},d=function(a){return d.cancel(),b=setTimeout(c,a||0),d};return d.schedule=d,d.call=function(){return this.cancel(),a(),d},d.cancel=function(){return clearTimeout(b),b=null,d},d.isPending=function(){return b},d},b.delayedCall=function(a,b){var c=null,d=function(){c=null,a()},e=function(a){null==c&&(c=setTimeout(d,a||b))};return e.delay=function(a){c&&clearTimeout(c),c=setTimeout(d,a||b)},e.schedule=e,e.call=function(){this.cancel(),a()},e.cancel=function(){c&&clearTimeout(c),c=null},e.isPending=function(){return c},e}}),define("ace/worker/mirror",["require","exports","module","ace/range","ace/document","ace/lib/lang"],function(a,b,c){"use strict";var d=(a("../range").Range,a("../document").Document),e=a("../lib/lang"),f=b.Mirror=function(a){this.sender=a;var b=this.doc=new d(""),c=this.deferredUpdate=e.delayedCall(this.onUpdate.bind(this)),f=this;a.on("change",function(a){var d=a.data;if(d[0].start)b.applyDeltas(d);else for(var e=0;e<d.length;e+=2){if(Array.isArray(d[e+1]))var g={action:"insert",start:d[e],lines:d[e+1]};else var g={action:"remove",start:d[e],end:d[e+1]};b.applyDelta(g,!0)}return f.$timeout?c.schedule(f.$timeout):void f.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(a){this.$timeout=a},this.setValue=function(a){this.doc.setValue(a),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(a){this.sender.callback(this.doc.getValue(),a)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(f.prototype)}),define("ace/lib/es5-shim",["require","exports","module"],function(a,b,c){function d(){}function e(a){try{return Object.defineProperty(a,"sentinel",{}),"sentinel"in a}catch(a){}}function f(a){return a=+a,a!==a?a=0:0!==a&&a!==1/0&&a!==-(1/0)&&(a=(a>0||-1)*Math.floor(Math.abs(a))),a}Function.prototype.bind||(Function.prototype.bind=function(a){var b=this;if("function"!=typeof b)throw new TypeError("Function.prototype.bind called on incompatible "+b);var c=o.call(arguments,1),e=function(){if(this instanceof e){var d=b.apply(this,c.concat(o.call(arguments)));return Object(d)===d?d:this}return b.apply(a,c.concat(o.call(arguments)))};return b.prototype&&(d.prototype=b.prototype,e.prototype=new d,d.prototype=null),e});var g,h,i,j,k,l=Function.prototype.call,m=Array.prototype,n=Object.prototype,o=m.slice,p=l.bind(n.toString),q=l.bind(n.hasOwnProperty);if((k=q(n,"__defineGetter__"))&&(g=l.bind(n.__defineGetter__),h=l.bind(n.__defineSetter__),i=l.bind(n.__lookupGetter__),j=l.bind(n.__lookupSetter__)),2!=[1,2].splice(0).length)if(function(){function a(a){var b=new Array(a+2);return b[0]=b[1]=0,b}var b,c=[];if(c.splice.apply(c,a(20)),c.splice.apply(c,a(26)),b=c.length,c.splice(5,0,"XXX"),b+1==c.length,b+1==c.length)return!0}()){var r=Array.prototype.splice;Array.prototype.splice=function(a,b){return arguments.length?r.apply(this,[void 0===a?0:a,void 0===b?this.length-a:b].concat(o.call(arguments,2))):[]}}else Array.prototype.splice=function(a,b){var c=this.length;a>0?a>c&&(a=c):void 0==a?a=0:a<0&&(a=Math.max(c+a,0)),a+b<c||(b=c-a);var d=this.slice(a,a+b),e=o.call(arguments,2),f=e.length;if(a===c)f&&this.push.apply(this,e);else{var g=Math.min(b,c-a),h=a+g,i=h+f-g,j=c-h,k=c-g;if(i<h)for(var l=0;l<j;++l)this[i+l]=this[h+l];else if(i>h)for(l=j;l--;)this[i+l]=this[h+l];if(f&&a===k)this.length=k,this.push.apply(this,e);else for(this.length=k+f,l=0;l<f;++l)this[a+l]=e[l]}return d};Array.isArray||(Array.isArray=function(a){return"[object Array]"==p(a)});var s=Object("a"),t="a"!=s[0]||!(0 in s);if(Array.prototype.forEach||(Array.prototype.forEach=function(a){var b=J(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=arguments[1],e=-1,f=c.length>>>0;if("[object Function]"!=p(a))throw new TypeError;for(;++e<f;)e in c&&a.call(d,c[e],e,b)}),Array.prototype.map||(Array.prototype.map=function(a){var b=J(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0,e=Array(d),f=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var g=0;g<d;g++)g in c&&(e[g]=a.call(f,c[g],g,b));return e}),Array.prototype.filter||(Array.prototype.filter=function(a){var b,c=J(this),d=t&&"[object String]"==p(this)?this.split(""):c,e=d.length>>>0,f=[],g=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var h=0;h<e;h++)h in d&&(b=d[h],a.call(g,b,h,c)&&f.push(b));return f}),Array.prototype.every||(Array.prototype.every=function(a){var b=J(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var f=0;f<d;f++)if(f in c&&!a.call(e,c[f],f,b))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(a){var b=J(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0,e=arguments[1];if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");for(var f=0;f<d;f++)if(f in c&&a.call(e,c[f],f,b))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(a){var b=J(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduce of empty array with no initial value");var e,f=0;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f++];break}if(++f>=d)throw new TypeError("reduce of empty array with no initial value")}for(;f<d;f++)f in c&&(e=a.call(void 0,e,c[f],f,b));return e}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(a){var b=J(this),c=t&&"[object String]"==p(this)?this.split(""):b,d=c.length>>>0;if("[object Function]"!=p(a))throw new TypeError(a+" is not a function");if(!d&&1==arguments.length)throw new TypeError("reduceRight of empty array with no initial value");var e,f=d-1;if(arguments.length>=2)e=arguments[1];else for(;;){if(f in c){e=c[f--];break}if(--f<0)throw new TypeError("reduceRight of empty array with no initial value")}do f in this&&(e=a.call(void 0,e,c[f],f,b));while(f--);return e}),Array.prototype.indexOf&&[0,1].indexOf(1,2)==-1||(Array.prototype.indexOf=function(a){var b=t&&"[object String]"==p(this)?this.split(""):J(this),c=b.length>>>0;if(!c)return-1;var d=0;for(arguments.length>1&&(d=f(arguments[1])),d=d>=0?d:Math.max(0,c+d);d<c;d++)if(d in b&&b[d]===a)return d;return-1}),Array.prototype.lastIndexOf&&[0,1].lastIndexOf(0,-3)==-1||(Array.prototype.lastIndexOf=function(a){var b=t&&"[object String]"==p(this)?this.split(""):J(this),c=b.length>>>0;if(!c)return-1;var d=c-1;for(arguments.length>1&&(d=Math.min(d,f(arguments[1]))),d=d>=0?d:c-Math.abs(d);d>=0;d--)if(d in b&&a===b[d])return d;return-1}),Object.getPrototypeOf||(Object.getPrototypeOf=function(a){return a.__proto__||(a.constructor?a.constructor.prototype:n)}),!Object.getOwnPropertyDescriptor){var u="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(a,b){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError(u+a);if(q(a,b)){var c,d,e;if(c={enumerable:!0,configurable:!0},k){var f=a.__proto__;a.__proto__=n;var d=i(a,b),e=j(a,b);if(a.__proto__=f,d||e)return d&&(c.get=d),e&&(c.set=e),c}return c.value=a[b],c}}}if(Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(a){return Object.keys(a)}),!Object.create){var v;v=null===Object.prototype.__proto__?function(){return{__proto__:null}}:function(){var a={};for(var b in a)a[b]=null;return a.constructor=a.hasOwnProperty=a.propertyIsEnumerable=a.isPrototypeOf=a.toLocaleString=a.toString=a.valueOf=a.__proto__=null,a},Object.create=function(a,b){var c;if(null===a)c=v();else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return void 0!==b&&Object.defineProperties(c,b),c}}if(Object.defineProperty){var w=e({}),x="undefined"==typeof document||e(document.createElement("div"));if(!w||!x)var y=Object.defineProperty}if(!Object.defineProperty||y){var z="Property description must be an object: ",A="Object.defineProperty called on non-object: ",B="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(a,b,c){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError(A+a);if("object"!=typeof c&&"function"!=typeof c||null===c)throw new TypeError(z+c);if(y)try{return y.call(Object,a,b,c)}catch(a){}if(q(c,"value"))if(k&&(i(a,b)||j(a,b))){var d=a.__proto__;a.__proto__=n,delete a[b],a[b]=c.value,a.__proto__=d}else a[b]=c.value;else{if(!k)throw new TypeError(B);q(c,"get")&&g(a,b,c.get),q(c,"set")&&h(a,b,c.set)}return a}}Object.defineProperties||(Object.defineProperties=function(a,b){for(var c in b)q(b,c)&&Object.defineProperty(a,c,b[c]);return a}),Object.seal||(Object.seal=function(a){return a}),Object.freeze||(Object.freeze=function(a){return a});try{Object.freeze(function(){})}catch(a){Object.freeze=function(a){return function(b){return"function"==typeof b?b:a(b)}}(Object.freeze)}if(Object.preventExtensions||(Object.preventExtensions=function(a){return a}),Object.isSealed||(Object.isSealed=function(a){return!1}),Object.isFrozen||(Object.isFrozen=function(a){return!1}),Object.isExtensible||(Object.isExtensible=function(a){if(Object(a)===a)throw new TypeError;for(var b="";q(a,b);)b+="?";a[b]=!0;var c=q(a,b);return delete a[b],c}),!Object.keys){var C=!0,D=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],E=D.length;for(var F in{toString:null})C=!1;Object.keys=function a(b){if("object"!=typeof b&&"function"!=typeof b||null===b)throw new TypeError("Object.keys called on a non-object");var a=[];for(var c in b)q(b,c)&&a.push(c);if(C)for(var d=0,e=E;d<e;d++){var f=D[d];q(b,f)&&a.push(f)}return a}}Date.now||(Date.now=function(){return(new Date).getTime()});var G="\t\n\v\f\r \u2028\u2029\ufeff";if(!String.prototype.trim||G.trim()){G="["+G+"]";var H=new RegExp("^"+G+G+"*"),I=new RegExp(G+G+"*$");String.prototype.trim=function(){return String(this).replace(H,"").replace(I,"")}}var J=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)}}),define("ace/mode/jsonata_worker",["require","exports","ace/lib/oop","ace/worker/mirror"],function(a,b){var c=a("../lib/oop"),d=a("../worker/mirror").Mirror,e=function(){"use strict";function a(a){for(var b=1,c=[],d={},e=d;b<a.length;){var f=a.charAt(b);if(":"===f)break;var g=function(){c.push(d),e=d,d={}},h=function(a,b,c,d){for(var e=1,g=b;g<a.length;)if(g++,f=a.charAt(g),f===d){if(e--,0===e)break}else f===c&&e++;return g};switch(f){case"s":case"n":case"b":case"l":case"o":d.regex="["+f+"m]",d.type=f,g();break;case"a":d.regex="[asnblfom]",d.type=f,d.array=!0,g();break;case"f":d.regex="f",d.type=f,g();break;case"j":d.regex="[asnblom]",d.type=f,g();break;case"x":d.regex="[asnblfom]",d.type=f,g();break;case"-":e.context=!0,e.contextRegex=new RegExp(e.regex),e.regex+="?";break;case"?":case"+":e.regex+=f;break;case"(":var i=h(a,b,"(",")"),j=a.substring(b+1,i);if(j.indexOf("<")!==-1)throw{code:"S0402",stack:(new Error).stack,value:j,offset:b};d.regex="["+j+"m]",d.type="("+j+")",b=i,g();break;case"<":if("a"!==e.type&&"f"!==e.type)throw{code:"S0401",stack:(new Error).stack,value:e.type,offset:b};var k=h(a,b,"<",">");e.subtype=a.substring(b+1,k),b=k}b++}var l="^"+c.map(function(a){return"("+a.regex+")"}).join("")+"$",m=new RegExp(l),n=function(a){var b;if(B(a))b="f";else{var c=typeof a;switch(c){case"string":b="s";break;case"number":b="n";break;case"boolean":b="b";break;case"object":b=null===a?"l":Array.isArray(a)?"a":"o";break;case"undefined":b="m"}}return b},o=function(a,b){for(var d="^",e=0,f=0;f<c.length;f++){d+=c[f].regex;var g=b.match(d);if(null===g)throw{code:"T0410",stack:(new Error).stack,value:a[e],index:e+1};e=g[0].length}throw{code:"T0410",stack:(new Error).stack,value:a[e],index:e+1}};return{definition:a,validate:function(a,b){var d="";a.forEach(function(a){d+=n(a)});var e=m.exec(d);if(e){var f=[],g=0;return c.forEach(function(c,d){var h=a[g],i=e[d+1];if(""===i)if(c.context){var j=n(b);if(!c.contextRegex.test(j))throw{code:"T0411",stack:(new Error).stack,value:b,index:g+1};f.push(b)}else f.push(h),g++;else i.split("").forEach(function(b){if("a"===c.type){if("m"===b)h=void 0;else{h=a[g];var d=!0;if("undefined"!=typeof c.subtype)if("a"!==b&&i!==c.subtype)d=!1;else if("a"===b&&h.length>0){var e=n(h[0]);if(e!==c.subtype.charAt(0))d=!1;else{var j=h.filter(function(a){return n(a)!==e});d=0===j.length}}if(!d)throw{code:"T0412",stack:(new Error).stack,value:h,index:g+1,type:c.subtype};"a"!==b&&(h=[h])}f.push(h),g++}else f.push(h),g++})}),f}o(a,d)}}}function b(a){var b=!1;if("number"==typeof a){var c=parseFloat(a);if(b=!isNaN(c),b&&!isFinite(c))throw{code:"D1001",value:a,stack:(new Error).stack}}return b}function c(a){var c=!1;return Array.isArray(a)&&(c=0===a.filter(function(a){return!b(a)}).length),c}function d(a,b,c){var d,l=c.lookup("__evaluate_entry");switch(l&&l(a,b,c),a.type){case"path":
d=e(a,b,c);break;case"binary":d=g(a,b,c);break;case"unary":d=h(a,b,c);break;case"name":d=i(a,b,c);break;case"literal":d=j(a,b,c);break;case"wildcard":d=k(a,b,c);break;case"descendant":d=m(a,b,c);break;case"condition":d=w(a,b,c);break;case"block":d=x(a,b,c);break;case"regex":d=y(a,b,c);break;case"function":d=D(a,b,c);break;case"variable":d=z(a,b,c);break;case"lambda":d=G(a,b,c);break;case"partial":d=H(a,b,c)}a.hasOwnProperty("predicate")&&(d=f(a.predicate,d,c)),a.hasOwnProperty("group")&&(d=t(a.group,d,c));var n=c.lookup("__evaluate_exit");return n&&n(a,b,c,d),d}function e(a,b,c){var e,f,g=!1;"variable"===a[0].type?a[0].absolute=!0:"unary"===a[0].type&&"["===a[0].value&&(b=[null]);for(var h=0;h<a.length;h++){var i=a[h];i.keepArray===!0&&(g=!0);var j=[];if(e=void 0,f=i.absolute===!0?[b]:Array.isArray(b)?b:[b],a.length>1&&"literal"===i.type&&(i.type="name"),f.forEach(function(a){var b=d(i,a,c);"undefined"!=typeof b&&(Array.isArray(b)&&"["!==i.value?b.forEach(function(a){"undefined"!=typeof a&&j.push(a)}):j.push(b))}),1===j.length?e=g?j:j[0]:j.length>1&&(e=j),"undefined"==typeof e)break;b=e}return e}function f(a,e,f){var g,h=e,i=[];return a.forEach(function(a){if(Array.isArray(h)||(h=[h]),i=[],g=void 0,"literal"===a.type&&b(a.value)){var e=a.value;Number.isInteger(e)||(e=Math.floor(e)),e<0&&(e=h.length+e),g=h[e]}else h.forEach(function(e,g){var j=d(a,e,f);b(j)&&(j=[j]),c(j)?j.forEach(function(a){Number.isInteger(a)||(a=Math.floor(a)),a<0&&(a=h.length+a),a===g&&i.push(e)}):ga(j)&&i.push(e)});1===i.length?g=i[0]:i.length>1&&(g=i),h=g}),g}function g(a,b,c){var d;switch(a.value){case"+":case"-":case"*":case"/":case"%":d=o(a,b,c);break;case"=":case"!=":case"<":case"<=":case">":case">=":d=p(a,b,c);break;case"&":d=s(a,b,c);break;case"and":case"or":d=r(a,b,c);break;case"..":d=u(a,b,c);break;case":=":d=v(a,b,c);break;case"in":d=q(a,b,c);break;case"~>":d=A(a,b,c)}return d}function h(a,c,e){var f;switch(a.value){case"-":if(f=d(a.expression,c,e),!b(f))throw{code:"D1002",stack:(new Error).stack,position:a.position,token:a.value,value:f};f=-f;break;case"[":f=[],a.lhs.forEach(function(a){var b=d(a,c,e);"undefined"!=typeof b&&("["===a.value?f.push(b):f=ma(f,b))});break;case"{":f=t(a,c,e)}return f}function i(a,b,c){var d;if(Array.isArray(b)){var e=[];b.forEach(function(b){var d=i(a,b,c);"undefined"!=typeof d&&e.push(d)}),1===e.length?d=e[0]:e.length>1&&(d=e)}else null!==b&&"object"==typeof b&&(d=b[a.value]);return d}function j(a){return a.value}function k(a,b){var c,d=[];return null!==b&&"object"==typeof b&&Object.keys(b).forEach(function(a){var c=b[a];Array.isArray(c)?(c=l(c),d=ma(d,c)):d.push(c)}),1===d.length?c=d[0]:d.length>1&&(c=d),c}function l(a,b){return"undefined"==typeof b&&(b=[]),Array.isArray(a)?a.forEach(function(a){l(a,b)}):b.push(a),b}function m(a,b){var c,d=[];return"undefined"!=typeof b&&(n(b,d),c=1===d.length?d[0]:d),c}function n(a,b){Array.isArray(a)||b.push(a),Array.isArray(a)?a.forEach(function(a){n(a,b)}):null!==a&&"object"==typeof a&&Object.keys(a).forEach(function(c){n(a[c],b)})}function o(a,c,e){var f,g=d(a.lhs,c,e),h=d(a.rhs,c,e);if("undefined"==typeof g||"undefined"==typeof h)return f;if(!b(g))throw{code:"T2001",stack:(new Error).stack,position:a.position,token:a.value,value:g};if(!b(h))throw{code:"T2002",stack:(new Error).stack,position:a.position,token:a.value,value:h};switch(a.value){case"+":f=g+h;break;case"-":f=g-h;break;case"*":f=g*h;break;case"/":f=g/h;break;case"%":f=g%h}return f}function p(a,b,c){var e,f=d(a.lhs,b,c),g=d(a.rhs,b,c);if("undefined"==typeof f||"undefined"==typeof g)return!1;switch(a.value){case"=":e=f===g;break;case"!=":e=f!==g;break;case"<":e=f<g;break;case"<=":e=f<=g;break;case">":e=f>g;break;case">=":e=f>=g}return e}function q(a,b,c){var e=!1,f=d(a.lhs,b,c),g=d(a.rhs,b,c);if("undefined"==typeof f||"undefined"==typeof g)return!1;Array.isArray(g)||(g=[g]);for(var h=0;h<g.length;h++)if(g[h]===f){e=!0;break}return e}function r(a,b,c){var e;switch(a.value){case"and":e=ga(d(a.lhs,b,c))&&ga(d(a.rhs,b,c));break;case"or":e=ga(d(a.lhs,b,c))||ga(d(a.rhs,b,c))}return e}function s(a,b,c){var e,f=d(a.lhs,b,c),g=d(a.rhs,b,c),h="",i="";return"undefined"!=typeof f&&(h=U(f)),"undefined"!=typeof g&&(i=U(g)),e=h.concat(i)}function t(a,b,c){var e={},f={};Array.isArray(b)||(b=[b]),b.forEach(function(b){a.lhs.forEach(function(e){var g=d(e[0],b,c);if("string"!=typeof g)throw{code:"T1003",stack:(new Error).stack,position:a.position,value:g};var h={data:b,expr:e[1]};f.hasOwnProperty(g)?f[g].data=ma(f[g].data,b):f[g]=h})});for(var g in f){var h=f[g],i=d(h.expr,h.data,c);e[g]=i}return e}function u(a,b,c){var e,f=d(a.lhs,b,c),g=d(a.rhs,b,c);if("undefined"==typeof f||"undefined"==typeof g)return e;if(f>g)return e;if(!Number.isInteger(f))throw{code:"T2003",stack:(new Error).stack,position:a.position,token:a.value,value:f};if(!Number.isInteger(g))throw{code:"T2004",stack:(new Error).stack,position:a.position,token:a.value,value:g};e=new Array(g-f+1);for(var h=f,i=0;h<=g;h++,i++)e[i]=h;return e}function v(a,b,c){var e=d(a.rhs,b,c);if("variable"!==a.lhs.type)throw{code:"D2005",stack:(new Error).stack,position:a.position,token:a.value,value:"path"===a.lhs.type?a.lhs[0].value:a.lhs.value};return c.bind(a.lhs.value,e),e}function w(a,b,c){var e,f=d(a.condition,b,c);return ga(f)?e=d(a.then,b,c):"undefined"!=typeof a.else&&(e=d(a.else,b,c)),e}function x(a,b,c){var e,f=pa(c);return a.expressions.forEach(function(a){e=d(a,b,f)}),e}function y(a){a.value.lastIndex=0;var b=function(c){var d,e=a.value,f=e.exec(c);if(null!==f){if(d={match:f[0],start:f.index,end:f.index+f[0].length,groups:[]},f.length>1)for(var g=1;g<f.length;g++)d.groups.push(f[g]);d.next=function(){if(!(e.lastIndex>=c.length)){var d=b(c);if(d&&""===d.match&&e.lastIndex===a.value.lastIndex)throw{code:"D1004",stack:(new Error).stack,position:a.position,value:a.value.source};return d}}}return d};return b}function z(a,b,c){var d;return d=""===a.value?b:c.lookup(a.value)}function A(a,b,c){var e,f=d(a.lhs,b,c);if("function"===a.rhs.type)e=D(a.rhs,b,c,{context:f});else{var g=d(a.rhs,b,c);if(!B(g))throw{code:"T2006",stack:(new Error).stack,position:a.position,value:g};e=B(f)?E(xa,[f,g],c,null):E(g,[f],c,null)}return e}function B(a){return a&&(a._jsonata_function===!0||a._jsonata_lambda===!0)||"function"==typeof a}function C(a){return a&&a._jsonata_lambda===!0}function D(a,b,c,e){var f,g=[];a.arguments.forEach(function(a){g.push(d(a,b,c))}),e&&g.unshift(e.context);var h=d(a.procedure,b,c);if("undefined"==typeof h&&"path"===a.procedure.type&&c.lookup(a.procedure[0].value))throw{code:"T1005",stack:(new Error).stack,position:a.position,token:a.procedure[0].value};try{var i=g;h&&(i=I(h.signature,g,b)),f=E(h,i,b)}catch(b){throw b.position=a.position,b.token="path"===a.procedure.type?a.procedure[0].value:a.procedure.value,b}return f}function E(a,b,c){var e;for(e=F(a,b,c);C(e)&&e.thunk===!0;){var f=d(e.body.procedure,e.input,e.environment),g=[];e.body.arguments.forEach(function(a){g.push(d(a,e.input,e.environment))}),e=F(f,g,c)}return e}function F(a,b,c){var d;if(C(a))d=J(a,b);else if(a&&a._jsonata_function===!0)d=a.implementation.apply(c,b);else{if("function"!=typeof a)throw{code:"T1006",stack:(new Error).stack};d=a.apply(c,b)}return d}function G(a,b,c){var d={_jsonata_lambda:!0,input:b,environment:c,arguments:a.arguments,signature:a.signature,body:a.body};return a.thunk===!0&&(d.thunk=!0),d}function H(a,b,c){var e,f=[];a.arguments.forEach(function(a){"operator"===a.type&&"?"===a.value?f.push(a):f.push(d(a,b,c))});var g=d(a.procedure,b,c);if("undefined"==typeof g&&"path"===a.procedure.type&&c.lookup(a.procedure[0].value))throw{code:"T1007",stack:(new Error).stack,position:a.position,token:a.procedure[0].value};if(C(g))e=K(g,f);else if(g&&g._jsonata_function===!0)e=L(g.implementation,f);else{if("function"!=typeof g)throw{code:"T1008",stack:(new Error).stack,position:a.position,token:"path"===a.procedure.type?a.procedure[0].value:a.procedure.value};e=L(g,f)}return e}function I(a,b,c){if("undefined"==typeof a)return b;var d=a.validate(b,c);return d}function J(a,b){var c,e=pa(a.environment);return a.arguments.forEach(function(a,c){e.bind(a.value,b[c])}),c="function"==typeof a.body?M(a.body,e):d(a.body,a.input,e)}function K(a,b){var c=pa(a.environment),d=[];a.arguments.forEach(function(a,e){var f=b[e];f&&"operator"===f.type&&"?"===f.value?d.push(a):c.bind(a.value,f)});var e={_jsonata_lambda:!0,input:a.input,environment:c,arguments:d,body:a.body};return e}function L(a,b){var c=N(a);c=c.map(function(a){return"$"+a.trim()});var d="function("+c.join(", ")+"){ _ }",e=va(d);e.body=a;var f=K(e,b);return f}function M(a,b){var c=N(a),d=c.map(function(a){return b.lookup(a.trim())}),e=a.apply(null,d);return e}function N(a){var b=a.toString(),c=/\(([^\)]*)\)/.exec(b)[1],d=c.split(",");return d}function O(b,c){var d={_jsonata_function:!0,implementation:b};return"undefined"!=typeof c&&(d.signature=a(c)),d}function P(a){if("undefined"!=typeof a){var b=0;return a.forEach(function(a){b+=a}),b}}function Q(a){return"undefined"==typeof a?0:a.length}function R(a){if("undefined"!=typeof a&&0!==a.length)return Math.max.apply(Math,a)}function S(a){if("undefined"!=typeof a&&0!==a.length)return Math.min.apply(Math,a)}function T(a){if("undefined"!=typeof a&&0!==a.length){var b=0;return a.forEach(function(a){b+=a}),b/a.length}}function U(a){if("undefined"!=typeof a){var c;if("string"==typeof a)c=a;else if(B(a))c="";else{if("number"==typeof a&&!isFinite(a))throw{code:"D3001",value:a,stack:(new Error).stack};c=JSON.stringify(a,function(a,c){return"undefined"!=typeof c&&null!==c&&c.toPrecision&&b(c)?Number(c.toPrecision(13)):c&&B(c)?"":c})}return c}}function V(a,b,c){if("undefined"!=typeof a)return a.substr(b,c)}function W(a,b){if("undefined"!=typeof a){var c=a.indexOf(b);return c>-1?a.substr(0,c):a}}function X(a,b){if("undefined"!=typeof a){var c=a.indexOf(b);return c>-1?a.substr(c+b.length):a}}function Y(a){if("undefined"!=typeof a)return a.toLowerCase()}function Z(a){if("undefined"!=typeof a)return a.toUpperCase()}function $(a){if("undefined"!=typeof a)return a.length}function _(a){if("undefined"!=typeof a){var b=a.replace(/[ \t\n\r]+/gm," ");return" "===b.charAt(0)&&(b=b.substring(1))," "===b.charAt(b.length-1)&&(b=b.substring(0,b.length-1)),b}}function aa(a,b){if("undefined"!=typeof a){var c;if("string"==typeof b)c=a.indexOf(b)!==-1;else{var d=b(a);c="undefined"!=typeof d}return c}}function ba(a,b,c){if("undefined"!=typeof a){if(c<0)throw{stack:(new Error).stack,value:c,code:"D3040",index:3};var d=[];if("undefined"==typeof c||c>0){var e=0,f=b(a);if("undefined"!=typeof f)for(;"undefined"!=typeof f&&("undefined"==typeof c||e<c);)d.push({match:f.match,index:f.start,groups:f.groups}),f=f.next(),e++}return d}}function ca(a,b,c,d){if("undefined"!=typeof a){if(""===b)throw{code:"D3010",stack:(new Error).stack,value:b,index:2};if(d<0)throw{code:"D3011",stack:(new Error).stack,value:d,index:4};var e;e="string"==typeof c?function(a){for(var b="",d=0,e=c.indexOf("$",d);e!==-1&&d<c.length;){b+=c.substring(d,e),d=e+1;var f=c.charAt(d);if("$"===f)b+="$",d++;else if("0"===f)b+=a.match,d++;else{var g;if(g=0===a.groups.length?1:Math.floor(Math.log(a.groups.length)*Math.LOG10E)+1,e=parseInt(c.substring(d,d+g),10),g>1&&e>a.groups.length&&(e=parseInt(c.substring(d,d+g-1),10)),isNaN(e))b+="$";else{if(a.groups.length>0){var h=a.groups[e-1];"undefined"!=typeof h&&(b+=h)}d+=e.toString().length}}e=c.indexOf("$",d)}return b+=c.substring(d)}:c;var f="",g=0;if("undefined"==typeof d||d>0){var h=0;if("string"==typeof b){for(var i=a.indexOf(b,g);i!==-1&&("undefined"==typeof d||h<d);)f+=a.substring(g,i),f+=c,g=i+b.length,h++,i=a.indexOf(b,g);f+=a.substring(g)}else{var j=b(a);if("undefined"!=typeof j){for(;"undefined"!=typeof j&&("undefined"==typeof d||h<d);){f+=a.substring(g,j.start);var k=E(e,[j],null);if("string"!=typeof k)throw{code:"D3012",stack:(new Error).stack,value:k};f+=k,g=j.start+j.match.length,h++,j=j.next()}f+=a.substring(g)}else f=a}}else f=a;return f}}function da(a,b,c){if("undefined"!=typeof a){if(c<0)throw{code:"D3020",stack:(new Error).stack,value:c,index:3};var d=[];if("undefined"==typeof c||c>0)if("string"==typeof b)d=a.split(b,c);else{var e=0,f=b(a);if("undefined"!=typeof f){for(var g=0;"undefined"!=typeof f&&("undefined"==typeof c||e<c);)d.push(a.substring(g,f.start)),g=f.end,f=f.next(),e++;("undefined"==typeof c||e<c)&&d.push(a.substring(g))}else d=[a]}return d}}function ea(a,b){if("undefined"!=typeof a)return"undefined"==typeof b&&(b=""),a.join(b)}function fa(a){var b;if("undefined"!=typeof a){if("number"==typeof a)b=a;else{if("string"!=typeof a||!/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(a)||isNaN(parseFloat(a))||!isFinite(a))throw{code:"D3030",value:a,stack:(new Error).stack,index:1};b=parseFloat(a)}return b}}function ga(a){if("undefined"!=typeof a){var c=!1;if(Array.isArray(a)){if(1===a.length)c=ga(a[0]);else if(a.length>1){var d=a.filter(function(a){return ga(a)});c=d.length>0}}else"string"==typeof a?a.length>0&&(c=!0):b(a)?0!==a&&(c=!0):null!==a&&"object"==typeof a?Object.keys(a).length>0&&(C(a)||a._jsonata_function||(c=!0)):"boolean"==typeof a&&a===!0&&(c=!0);return c}}function ha(a){return!ga(a)}function ia(a,b){var c=arguments,d=[],e=b;e=[];for(var f=1;f<c.length;f++)e.push(c[f]);for(var g=0;g<e[0].length;g++){for(var h=[],i="function"==typeof a?a.length:a._jsonata_function===!0?a.implementation.length:a.arguments.length,j=0;j<i;j++)h.push(e[j][g]);d.push(E(a,h,null))}return d}function ja(a,b,c){var d;if(2!==a.length&&(a._jsonata_function!==!0||2!==a.implementation.length)&&2!==a.arguments.length)throw{stack:(new Error).stack,code:"D3050",index:1};var e;for("undefined"==typeof c&&b.length>0?(d=b[0],e=1):(d=c,e=0);e<b.length;)d=E(a,[d,b[e]],null),e++;return d}function ka(a){var b=[];if(Array.isArray(a)){var c={};a.forEach(function(a){var b=ka(a);Array.isArray(b)&&b.forEach(function(a){c[a]=!0})}),b=ka(c)}else null===a||"object"!=typeof a||C(a)?b=void 0:(b=Object.keys(a),0===b.length&&(b=void 0));return b}function la(a,b){var c=i({value:b},a);return c}function ma(a,b){return"undefined"==typeof a?b:"undefined"==typeof b?a:(Array.isArray(a)||(a=[a]),Array.isArray(b)||(b=[b]),Array.prototype.push.apply(a,b),a)}function na(a){return"undefined"!=typeof a}function oa(a){var b=[];if(Array.isArray(a))a.forEach(function(a){b=ma(b,oa(a))});else if(null===a||"object"!=typeof a||C(a))b=a;else for(var c in a){var d={};d[c]=a[c],b.push(d)}return b}function pa(a){var b={};return{bind:function(a,c){b[a]=c},lookup:function(c){var d;return b.hasOwnProperty(c)?d=b[c]:a&&(d=a.lookup(c)),d}}}function qa(a){var b="Unknown error";"undefined"!=typeof a.message&&(b=a.message);var c=ya[a.code];return"undefined"!=typeof c&&(b=c.replace(/\{\{([^}]+)}}/g,function(){return a[arguments[1]]})),b}function ra(a){var b;try{b=va(a)}catch(a){throw a.message=qa(a),a}var c=pa(wa);return{evaluate:function(a,e){if("undefined"!=typeof e){var f;f=pa(c);for(var g in e)f.bind(g,e[g])}else f=c;f.bind("$",a);var h;try{h=d(b,a,f)}catch(a){throw a.message=qa(a),a}return h},assign:function(a,b){c.bind(a,b)},registerFunction:function(a,b,d){var e=O(b,d);c.bind(a,e)}}}var sa={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":75,"#":70,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"`":80,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},ta={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},ua=function(a){var b=0,c=a.length,d=function(a,c){var d={type:a,value:c,position:b};return d},e=function(){for(var d,e,f=b,g=0;b<c;){var h=a.charAt(b);if("/"===h&&"\\"!==a.charAt(b-1)&&0===g){if(d=a.substring(f,b),""===d)throw{code:"S0301",stack:(new Error).stack,position:b};for(b++,h=a.charAt(b),f=b;"i"===h||"m"===h;)b++,h=a.charAt(b);return e=a.substring(f,b)+"g",new RegExp(d,e)}"("!==h&&"["!==h&&"{"!==h||"\\"===a.charAt(b-1)||g++,")"!==h&&"]"!==h&&"}"!==h||"\\"===a.charAt(b-1)||g--,b++}throw{code:"S0302",stack:(new Error).stack,position:b}},f=function(f){if(b>=c)return null;for(var g=a.charAt(b);b<c&&" \t\n\r\v".indexOf(g)>-1;)b++,g=a.charAt(b);if(f!==!0&&"/"===g)return b++,d("regex",e());if("."===g&&"."===a.charAt(b+1))return b+=2,d("operator","..");if(":"===g&&"="===a.charAt(b+1))return b+=2,d("operator",":=");if("!"===g&&"="===a.charAt(b+1))return b+=2,d("operator","!=");if(">"===g&&"="===a.charAt(b+1))return b+=2,d("operator",">=");if("<"===g&&"="===a.charAt(b+1))return b+=2,d("operator","<=");if("*"===g&&"*"===a.charAt(b+1))return b+=2,d("operator","**");if("~"===g&&">"===a.charAt(b+1))return b+=2,d("operator","~>");if(sa.hasOwnProperty(g))return b++,d("operator",g);if('"'===g||"'"===g){var h=g;b++;for(var i="";b<c;){if(g=a.charAt(b),"\\"===g)if(b++,g=a.charAt(b),ta.hasOwnProperty(g))i+=ta[g];else{if("u"!==g)throw{code:"S0103",stack:(new Error).stack,position:b,token:g};var j=a.substr(b+1,4);if(!/^[0-9a-fA-F]+$/.test(j))throw{code:"S0104",stack:(new Error).stack,position:b};var k=parseInt(j,16);i+=String.fromCharCode(k),b+=4}else{if(g===h)return b++,d("string",i);i+=g}b++}throw{code:"S0101",stack:(new Error).stack,position:b}}var l=/^-?(0|([1-9][0-9]*))(\.[0-9]+)?([Ee][-+]?[0-9]+)?/,m=l.exec(a.substring(b));if(null!==m){var n=parseFloat(m[0]);if(!isNaN(n)&&isFinite(n))return b+=m[0].length,d("number",n);throw{code:"S0102",stack:(new Error).stack,position:b,token:m[0]}}for(var o,p,q=b;;)if(o=a.charAt(q),q===c||" \t\n\r\v".indexOf(o)>-1||sa.hasOwnProperty(o)){if("$"===a.charAt(b))return p=a.substring(b+1,q),b=q,d("variable",p);switch(p=a.substring(b,q),b=q,p){case"or":case"in":case"and":return d("operator",p);case"true":return d("value",!0);case"false":return d("value",!1);case"null":return d("value",null);default:return b===c&&""===p?null:d("name",p)}}else q++};return f},va=function(c){var d,e,f={},g={nud:function(){return this}},h=function(a,b){var c=f[a];return b=b||0,c?b>=c.lbp&&(c.lbp=b):(c=Object.create(g),c.id=c.value=a,c.lbp=b,f[a]=c),c},i=function(a,b){if(a&&d.id!==a){var g;thr