//>>built require({cache:{"xide/types":function(){define(["dcl/dcl"],function(f){f=new f(null,{declaredClass:"xide/types"});f.test=22;return f})},"dcl/dcl":function(){(function(f){"undefined"!=typeof define?define(["./mini"],f):"undefined"!=typeof module?module.exports=f(require("./mini")):dcl=f(dcl)})(function(f){function n(){}function l(c,b,d){var a=c||n,e=b||n,r=d||n,p=function(){var b,c;a.apply(this,arguments);try{b=r.apply(this,arguments)}catch(h){b=h,c=!0}e.call(this,arguments,b);if(c)throw b;return b}; p.advices={before:c,after:b,around:d};return p}function m(c){return function(b,d){var a=b._meta,e;a&&((e=+a.weaver[d]||0)&&e!=c&&f._error("set chaining",d,b,c,e),a.weaver[d]=c)}}var g=f(f.Super,{constructor:function(){this.before=this.around.before;this.after=this.around.after;this.around=this.around.around}});f.mix(f,{Advice:g,advise:function(c){return f._makeSuper(c,g)},before:function(c){return f.advise({before:c})},after:function(c){return f.advise({after:c})},around:f.superCall,chainBefore:m(1), chainAfter:m(2),isInstanceOf:function(c,b){if(c instanceof b)return!0;c=c.constructor._meta;var d;if(c)for(c=c.bases,d=c.length-1;0<=d;--d)if(c[d]===b)return!0;return!1},_stub:function(c,b,d,a){a=a[d]=f._extractChain(b,d,"around");var e=f._extractChain(b,d,"before").reverse();b=f._extractChain(b,d,"after");a=c?f._stubChainSuper(a,1==c?function(a){return f._stubChain(a.reverse())}:f._stubChain,d):f._stubSuper(a,d);return e.length||b.length?l(f._stubChain(e),f._stubChain(b),a):a||function(){}}});return f})}, "dcl/mini":function(){(function(f){"undefined"!=typeof define?define([],f):"undefined"!=typeof module?module.exports=f():dcl=f()})(function(){function f(c,a){var e=[0],d,p,k,q,h,u,g,t,x=0,w;if(c)if(c instanceof Array){h={};g=c.slice(0).reverse();for(t=g.length-1;0<=t;--t)if(p=g[t],p._uniqueId=p._uniqueId||m++,d=p._meta){u=d.bases;for(x=u.length-1;0=a?c+=String.fromCharCode(a):1114111>=a?(a-=65536,c+=String.fromCharCode(55296|a>>10)+String.fromCharCode(56320|a&1023)):c+="hex2Char error: Code point out of range: "+b(a);return c}function c(a){var c="";65535>=a?c+=String.fromCharCode(a): 1114111>=a?(a-=65536,c+=String.fromCharCode(55296|a>>10)+String.fromCharCode(56320|a&1023)):c+="dec2char error: Code point out of range: "+b(a);return c}function b(a){return(a+0).toString(16).toUpperCase()}function d(a){return A[a>>4&15]+A[a&15]}function a(a){return a=a.replace(/0x([A-Fa-f0-9]{1,4})(\s)?/g,function(a,b){g(b);return g(b)})}function e(a){a=a.replace(/[Uu]\+10([A-Fa-f0-9]{4})/g,function(a,b){return g("10"+b)});return a=a.replace(/[Uu]\+([A-Fa-f0-9]{1,5})/g,function(a,b){return g(b)})} function r(a){return a=a.replace(/&#x([A-Fa-f0-9]{1,6});/g,function(a,b){return g(b)})}function p(a){return a=a.replace(/&#([0-9]{1,7});/g,function(a,b){return c(b)})}function k(a){return a=a.replace(/0x([A-Fa-f0-9]{1,6})/g,function(a,b){return g(b)})}function q(a,b){b?(a=a.replace(/\\([A-Fa-f0-9]{1,6})(\s)?/g,function(a,b){return g(b)}),a=a.replace(/\\/g,"")):a=a.replace(/\\([A-Fa-f0-9]{2,6})(\s)?/g,function(a,b){return g(b)});return a}function h(a,b){a=a.replace(/\\u\{([A-Fa-f0-9]{1,})\}/g,function(a, b){return g(b)});a=a.replace(/\\U([A-Fa-f0-9]{8})/g,function(a,b){return g(b)});a=a.replace(/\\u([A-Fa-f0-9]{4})/g,function(a,b){return g(b)});b&&(a=a.replace(/\\b/g,"\b"),a=a.replace(/\\t/g,"\t"),a=a.replace(/\\n/g,"\n"),a=a.replace(/\\v/g,"\v"),a=a.replace(/\\f/g,"\f"),a=a.replace(/\\r/g,"\r"),a=a.replace(/\\\'/g,"'"),a=a.replace(/\\\"/g,'"'),a=a.replace(/\\\\/g,"\\"));return a}function u(a){return a=a.replace(/((%[A-Fa-f0-9]{2})+)/g,function(a,h){a="";var d=0,e=0;h=h.split("%");for(var k=1;k=q?a+=c(q):192<=q&&223>=q?(d=1,e=q&31):224<=q&&239>=q?(d=2,e=q&15):240<=q&&247>=q?(d=3,e=q&7):a+="convertpEsc2Char: error "+b(q)+"! ";break;case 1:if(128>q||191q||191=q?h+=c(q):192<=q&&223>=q?(d=1,e=q&31):224<=q&&239>=q?(d=2,e=q&15):240<=q&&247>=q?(d=3,e=q&7):h+="convertUTF82Char: error1 "+b(q)+"! ";break;case 1:if(128>q||191q||191q||65535=q){d+=c(65536+(h-55296<<10)+(q-56320));h=0;continue}else d+="Error in convertUTF162Char: low surrogate expected, b\x3d"+b(q)+"!",h=0;55296<=q&&56319>=q?h=q:d+=c(q)}return d}var A="0123456789ABCDEF".split("");f.dec2hex4=function(a){return A[a>>12&15]+A[a>>8&15]+A[a>>4&15]+A[a&15]};f.dec2hex=b;f.dec2char=c;f.dec2hex2=d;f.convertUTF82Char=x;f.convertUTF162Char= w;f.convertUnicode2Char=e;f.convertCharStr2pEsc=function(a){for(var c="",h=0,e="",q=0;qk||65535=k){e+=b(65536+(h-55296<<10)+(k-56320))+" ";h=0;continue}else e+="Error in convertChar2CP: surrogate out of range "+b(h)+"!",h=0;55296<=k&&56319>=k?h=k:e+=b(k)+" "}h=e.substring(0,e.length-1);if(0==a.length)return"";a=h.split(" ");for(h=0;h=e?c+String.fromCharCode(e):97<=e&&122>=e?c+String.fromCharCode(e):48<=e&&57>=e?c+String.fromCharCode(e):45==e||46==e||95==e||126==e?c+String.fromCharCode(e):127>=e?c+("%"+d(e)):2047>=e?c+("%"+d(192|e>>6&31)+"%"+d(128|e&63)):65535>=e?c+("%"+d(224|e>>12&15)+"%"+d(128|e>>6&63)+"%"+d(128|e&63)):1114111>=e?c+("%"+d(240|e>>18&7)+"%"+d(128|e>>12&63)+"%"+d(128|e>>6&63)+"%"+d(128|e&63)):c+("!Error "+b(e)+"!");return c};f.convertAllEscapes=function(b,c){b=e(b);b=a(b);b=k(b);b=r(b); b=p(b);b=h(b,!1);b=q(b,!1);b=u(b);b=v(b);return b=t(b,c)};var B="0123456789abcdef".split("");f.to_hex=function(a){for(var b="",c=!0,h=32;0>h&15;c&&0==d||(c=!1,b+=B[d])}return"0x"+(""==b?"0":b)};f.replaceHex=function(a){return m.isString(a)?a.replace(/x([0-9A-Fa-f]{2})/gmi,function(a,b){return String.fromCharCode(parseInt(b,16))}):a};var y=function(a,b){for(a=a.toString(16).toUpperCase();a.lengthh&&(h=6);for(var d="Offset";d.lengthe;e++)d+=" "+y(e,2);d+="\u001b[0m\n";a.length&&(d+="\n");var q=0,k,p;for(e=0;ep||159>>32-a}function l(b,a,c,r,p,k){return f.addWords(n(f.addWords(f.addWords(a,b),f.addWords(r,k)),p),c)}function m(b,a,c,r,p,k,q){return l(a&c|~a&r,b,a,p,k,q)}function g(b,a,c,r,p,k,q){return l(a&r|c&~r,b,a,p,k,q)}function c(b,a,c,r,p,k,q){return l(c^(a|~r),b,a,p,k,q)}function b(b,a){b[a>>5]|=128<>>9<<4)+14]=a;a=1732584193;for(var e=-271733879,d=-1732584194,p=271733878,k=0;kk;k++)p[k]=d[k]^909522486,a[k]=d[k]^1549556828;c=b(p.concat(f.stringToWord(c)),512+8*c.length);c=b(a.concat(c),640);switch(e){case f.outputTypes.Raw:return c;case f.outputTypes.Hex:return f.wordToHex(c);case f.outputTypes.String:return f.wordToString(c);default:return f.wordToBase64(c)}};return f.MD5})},"xide/encoding/_base":function(){define(["dojo/_base/lang"],function(f){return{outputTypes:{Base64:0,Hex:1,String:2, Raw:3},addWords:function(f,l){var m=(f&65535)+(l&65535);return(f>>16)+(l>>16)+(m>>16)<<16|m&65535},stringToWord:function(f){for(var l=[],m=0,g=8*f.length;m>5]|=(f.charCodeAt(m/8)&255)<>5]>>>m%32&255));return l.join("")},wordToHex:function(f){for(var l=[],m=0,g=4*f.length;m>2]>>m%4*8+4&15)+"0123456789abcdef".charAt(f[m>>2]>>m%4*8&15)); return l.join("")},wordToBase64:function(f){for(var l=[],m=0,g=4*f.length;m>2]>>m%4*8&255)<<16|(f[m+1>>2]>>(m+1)%4*8&255)<<8|f[m+2>>2]>>(m+2)%4*8&255,b=0;4>b;b++)8*m+6*b>32*f.length?l.push("\x3d"):l.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(c>>6*(3-b)&63));return l.join("")},stringToUtf8:function(f){for(var l="",m=-1,g,c;++m=g&&56320<=c&&57343>=c&&(g=65536+((g& 1023)<<10)+(c&1023),m++),127>=g?l+=String.fromCharCode(g):2047>=g?l+=String.fromCharCode(192|g>>>6&31,128|g&63):65535>=g?l+=String.fromCharCode(224|g>>>12&15,128|g>>>6&63,128|g&63):2097151>=g&&(l+=String.fromCharCode(240|g>>>18&7,128|g>>>12&63,128|g>>>6&63,128|g&63));return l}}})},"nxapp/server/FileServer":function(){define("dojo/_base/declare dojo/_base/lang xide/types xide/factory nxapp/server/WebSocket nxapp/utils/_LogMixin dojo/node!http dojo/node!sockjs".split(" "),function(f,n,l,m,g,c,b,d){return f("nxapp.server.WebSocket", [g,c],{onFileChanged:function(a){this.broadCastMessage(l.EVENTS.ON_FILE_CHANGED,{path:a.path,modulePath:a.modulePath,mask:a.mask,type:a.type})},start:function(a,c){this.profile=c;this.options=n.mixin(this.options,a);this.clients=[];var e=this;m.subscribe(l.EVENTS.ON_FILE_CHANGED,this.onFileChanged,this);a=this.options.port;var p=this.options.host;if(a){this.initLogger(c.debug);this.log("File Socket server running in "+a,"socket_server");c={};this.showDebugMsg("socket_server")||(c.log=function(){}); c=d.createServer(c);var k=b.createServer(this._handler);c.installHandlers(k);k.listen(a,p);this._handleSocketEmits(c);m.publish(l.EVENTS.ON_WEBSOCKET_START,{socket_server:{port:a,socket_handler:c}},this);c.on("connection",function(a){var b=e.clients.push(a);a.on("close",function(){delete e.clients[b]})});return!0}console.error("Port must be provided into options");return!1},_handleSocketEmits:function(a){var b=this.options.port,c=this;a.on("connection",function(a){c.socket=a;m.publish(l.EVENTS.ON_WEBSOCKET_CONNECTION, {connection:{port:b,socket_handler:a}},this);a.on("close",function(){})})}})})},"nxappmain/nxAppBase":function(){define("dcl/dcl nxapp/utils/FileUtils dojo/node!commander dojo/node!fs dojo/node!os dojo/node!path dojo/node!util xide/factory/Events dojo/has xide/model/Base xide/utils".split(" "),function(f,n,l,m,g,c,b,d,a,e,r){a.add("windows",function(){return"win32"===g.platform()});a.add("osx",function(){return"darwin"===g.platform()});a.add("linux",function(){return"linux"===g.platform()});a.add("arm", function(){return"arm"===g.arch()});return f(e.dcl,{declaredClass:"nxappmain.nxAppBase",profile:null,commander:null,profilePath:"/nxappmain/profile_device_server.json",getDefaultProfilePath:function(){return dojoConfig.cwd+this.profilePath},getProfile:function(a){var b={};a||(a=this.commander.profile&&0=d&&a=b?"":Array(1+b-a.length>>>0).join(c);return d?a+b:b+a},a=function(a,b,c,e,h,g){var k=e-a.length;0>>=0;e=e&&b&&{2:"0b",8:"0",16:"0x"}[c]||"";b=e+d(b.toString(c),g||0,"0",!1);return a(b,e,q,h,f)};return c[b++].replace(/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g,function(g,p,k,q,h,f,m){var r,u;if("%%"===g)return"%";var l=!1;u="";var v=h=!1;r=" ";for(var n=k.length,y=0;k&&yq&&(q=-q,l=!0);if(!isFinite(q))throw Error("sprintf: (minimum-)width must be finite");f=f?"*"===f?+c[b++]:"*"==f.charAt(0)?+c[f.slice(1,-1)]:+f:-1<"fFeE".indexOf(m)?6:"d"===m?0:void 0;p=p?c[p.slice(0,-1)]:c[b++];switch(m){case "s":return m=String(p),null!=f&&(m=m.slice(0,f)),a(m,"",l,q,h,r);case "c":return m=String.fromCharCode(+p),null!=f&&(m=m.slice(0,f)),a(m,"",l,q,h,void 0); case "b":return e(p,2,v,l,q,f,h);case "o":return e(p,8,v,l,q,f,h);case "x":return e(p,16,v,l,q,f,h);case "X":return e(p,16,v,l,q,f,h).toUpperCase();case "u":return e(p,10,v,l,q,f,h);case "i":case "d":return r=+p||0,r=Math.round(r-r%1),g=0>r?"-":u,p=g+d(String(Math.abs(r)),f,"0",!1),a(p,g,l,q,h);case "e":case "E":case "f":case "F":case "g":case "G":return r=+p,g=0>r?"-":u,u=["toExponential","toFixed","toPrecision"]["efg".indexOf(m.toLowerCase())],m=["toString","toUpperCase"]["eEfFgG".indexOf(m)%2], p=g+Math.abs(r)[u](f),a(p,g,l,q,h)[m]();default:return g}})};f.cleanString=function(c){return c?c=c.replace(/[\r]/g,"").replace(/[\b]/g,"").replace(/[\f]/g,"").replace(/[\n]/g,"").replace(/\\/g,""):null};f.normalizePath=function(c){if(!c)return null;c=f.cleanString(c);c=c.replace("./","");return c=c.replace(/([^:]\/)\/+/g,"$1")};n.PATH_PARTS={DIRNAME:1,BASENAME:2,EXTENSION:4,FILENAME:8,PATHINFO_ALL:0};f.basename=function(c,b){var d=c.charAt(c.length-1);if("/"===d||"\\"===d)c=c.slice(0,-1);c=c.replace(/^.*[\/\\]/g, "");"string"===typeof b&&c.substr(c.length-b.length)==b&&(c=c.substr(0,c.length-b.length));return c};f.pathinfo=function(c,b){var d="",a="",e="",g=0,p={},k=0,q=0,h=k=!1,u=!1;if(!c)return!1;b||(b="PATHINFO_ALL");var m={PATHINFO_DIRNAME:1,PATHINFO_BASENAME:2,PATHINFO_EXTENSION:4,PATHINFO_FILENAME:8,PATHINFO_ALL:0};for(e in m)m.hasOwnProperty(e)&&(m.PATHINFO_ALL|=m[e]);if("number"!==typeof b){b=[].concat(b);for(q=0;q/g)||[]).join("");return c.replace(/\x3c!--[\s\S]*?--\x3e|<\?(?:php)?[\s\S]*?\?>/gi,"").replace(/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,function(c,a){return-1c},gte:function(g,c){return g>=c},match:function(g,c,b){return c.test(g,b)},contains:function(g,c,b,d){var a= this;return n.every(c.data||c,function(c){if("object"===typeof c&&c.type){var e=a._getFilterComparator(c.type);return n.some(g,function(g){return e.call(a,g,c.args[1],b,d)})}return-1f&&null!==f)?-1:1}if(0!==f)return f}return 0});return b}}})})},"dstore/Tree":function(){define(["dojo/_base/declare"],function(f){return f(null,{constructor:function(){this.root=this},mayHaveChildren:function(f){return"hasChildren"in f?f.hasChildren:!0},getRootCollection:function(){return this.root.filter({parent:null})},getChildren:function(f){return this.root.filter({parent:this.getIdentity(f)})}})})},"xide/data/ObservableStore":function(){define(["dojo/_base/declare", "xide/mixins/EventedMixin","xide/lodash"],function(f,n,l){return f("xide/data/Observable",n,{_ignoreChangeEvents:!0,observedProperties:[],putSync:function(f,g){this.silent(!g);var c=this.inherited(arguments),b=this;!1!==g&&this.emit("added",c);c&&!c._store&&Object.defineProperty(c,"_store",{get:function(){return b}});this._observe(c);this.silent(!1);return c},removeSync:function(f,g){this.silent(g);var c=this.getSync(f);c&&c.onRemove&&c.onRemove();c=this.inherited(arguments);this.silent(!1);return c}, _onItemChanged:function(f,g,c,b){this._ignoreChangeEvents||(g={target:f,property:g,value:c,source:b},this.emit("update",g),f.onItemChanged&&f.onItemChanged(g))},_observe:function(f){var g=this,c=this.observedProperties;f.observed&&(c=c.concat(f.observed));c.forEach(function(b){f.property&&f.property(b).observe(function(c){this._onItemChanged(f,b,c,this)}.bind(g))})},setData:function(f){var g=this,c=this.inherited(arguments);this.silent(!0);f&&f.forEach(function(b){return g._observe});this.silent(!1); return c}})})},"dstore/Trackable":function(){define("dojo/_base/lang dojo/_base/declare dojo/aspect dojo/when dojo/promise/all dojo/_base/array dojo/on".split(" "),function(f,n,l,m,g,c,b){function d(a,b,c){for(var d=a.length-1;0<=d;--d){var e=a[d],k=e.start,e=k+e.count;if(b>e){a.splice(d+1,0,{start:b,count:c-b});return}c>=k&&(b=Math.min(b,k),c=Math.max(c,e),a.splice(d,1))}a.unshift({start:b,count:c-b})}var a=0,e={track:function(){function e(){return function(){var a=this,b=this.inherited(arguments); m(b,function(b){b=a._results=b.slice();a._partialResults&&(a._partialResults=null);a._ranges=[];d(a._ranges,0,b.length)});return b}}function g(){return function(a){var b=this,c=a.start,e=a.end,h=this.inherited(arguments);this._results||m(h,function(a){return m(a.totalLength,function(h){var k=b._partialResults||(b._partialResults=[]);e=Math.min(e,c+a.length);k.length=h;h=[c,e-c].concat(a);k.splice.apply(k,h);d(b._ranges,c,e);return a})});return h}}function k(b,d){a++;var e=d.target;d=f.delegate(d, w[b]);m(t._results||t._partialResults,function(a){if(a){var h,k,g,p=t._ranges,f,u="id"in d?d.id:q.getIdentity(e),r=-1,m=-1,l=-1,v=-1;if("delete"===b||"update"===b)for(h=0;-1===r&&h=Math.max(0,f.start-1)&&r<=f.start+f.count?r:q.defaultNewToStart?0:m.length),m.splice(k,0,e),u=c.indexOf(x(m),e),n=f.start+u,0===u&&0!==f.start?g=h-1:u>=m.length-1&&n=k)c.splice(d,1);else{e.start=b;e.count=k-e.start;break a}else if(ah){c.splice(d,1,{start:h,count:a-h},{start:b,count:k-b});break a}else e.count=a-e.start}for(;an.ECIType.END&&(g=n.resolveType(g))&&(f.mixin(b,g),d.push(e))}0arguments.length&&c.callee,e=m.call(this,a?a.ctr:c,a?a.nom:b);if(e)return e.apply(this, a?c||b:d)}function m(c,b){var d=this.constructor._meta,a,e,f;if(!+d.weaver[b]){if(d){if(d.chains.hasOwnProperty(b)){if(a=d.chains[b])for(f=a.length-1;0<=f;--f)if(e=a[f],e.ctr===c)return 0c.length||!this.containsItem(c,this))return!1;b=this.indexOf(c,this);if(0>b+a)return!1;var d=c[b+a];if(!d)return!1;c[b+a]=this;c[b]=d}else this._place(null,a);return!0},_place:function(a,b,c){var d=this._store,h=this;(a=a||h.next(null,b))?(a=e.isString(a)?d.getSync(a):a,h=e.isString(h)?d.getSync(h):h,c=c||d.storage.fullData,b=-1==b?0:1,c.remove(h),-1==b&&(b=0),c.splice(Math.max(p(a,c)+b,0),0,h),d._reindex()):console.error("have no next",this)},index:function(){var a= this.getParent(),b=null,c=this.group,b=this._store;if(a)return b=a[a._getContainer(this)]||[],b=b.filter(function(a){return a.group===c}),!b||2>b.length||!this.containsItem(b,this)?!1:this.indexOf(b,this);b=b.storage.fullData;b=b.filter(function(a){return a.group===c});return this.indexOf(b,this)},numberOfParents:function(){var a=0,b=this.getParent();b&&(a++,a+=b.numberOfParents());return a},getTopRoot:function(){var a=this.getParent();if(a){var b=a.getParent();b&&(a=b)}return a},next:function(a, b){function c(a,b,d,e,h){var g=a.indexOf(b,a),k=b[g+d*e];if(k){if(!k.parentId&&k.group&&k.group===a.group)return h=g+d*e,k;e++;return c(a,b,d,e,h)}return null}a=a||this._store.storage.fullData;return c(this,a,b,1,0)},getParent:function(a){if(this.parentId)return this.scope.getBlockById(this.parentId)},getScope:function(){var a=this.scope;if(this.scopeId&&0b.length|| !this.containsItem(b,this))return null;var c=this.indexOf(b,this);return 0>c+a?!1:(a=b[c+a])?a:null},getPreviousBlock:function(){return this._getBlock(-1)},getNextBlock:function(){return this._getBlock(1)},_getPreviousResult:function(){var a=this.getPreviousBlock()||this.getParent();return a&&null!=a._lastResult?this.isArray(a._lastResult)?a._lastResult:[a._lastResult]:null},getPreviousResult:function(){var a=null;if((a=(a=this.getPreviousBlock())&&a._lastResult&&a.enabled?a:this.getParent())&&!a._lastResult){var b= a.getParent();b&&(a=b)}return a&&null!=a._lastResult?(this.isArray(a._lastResult),a._lastResult):null},_getArg:function(a,b){var c=parseFloat(a);return isNaN(c)?"true"===a||"false"===a?"true"===a:a&&b&&e.isString(a)?"'"+a+"'":a:c},getArgs:function(a){var c=[];a=a||{};var d=a.args||this._get("args");a.override&&a.override.args&&(d=a.override.args);d&&(c=b.getJson(d,null,!1));if(c&&0==c.length&&d&&d.length&&e.isString(d)){if(-1!==d.indexOf(",")){d=d.split(",");for(a=0;ap&&q&&(q(),q=null);p--}function a(){return a}var e=[].slice,r=f(null,{declaredClass:"xide/data/Model",schema:{},additionalProperties:!0,_scenario:"update",constructor:function(a){this.init(a)},refresh:function(a,b){var c=this._store;c&&c.refreshItem(this,a,b)},getStore:function(){return this._store},getParent:function(){return this._store.getSync(this[this._store.parentProperty])}, init:function(a){this._scenario="insert";a=this._setValues(a);for(var b in this.schema){var c=this.schema[b];c&&"object"===typeof c&&"default"in c&&!a.hasOwnProperty(b)&&(c=c["default"],a[b]="function"===typeof c?c.call(this):c)}},_setValues:function(a){return g.mixin(this,a)},_getValues:function(){return this._values||this},save:function(a){var b=this;return m(a&&a.skipValidation?!0:this.validate(),function(a){if(!a)throw b.createValidationError(b.errors);a=b._scenario;b.prepareForSerialization(); return b._store&&m(b._store["insert"===a?"add":"put"](b),function(a){b.set(a);b._scenario="update";return b})})},remove:function(){var a=this._store;return a.remove(a.getIdentity(this))},prepareForSerialization:function(){this._scenario=void 0;this._inherited&&(this._inherited.toJSON=a)},createValidationError:function(a){return Error("Validation error")},property:function(a,b){var d=this.hasOwnProperty("_properties")?this._properties:this._properties=new u,h=d[a];h||(h=c(this,a),h=d[a]=h?g.delegate(h): new v,h.name=a,h._parent=this);return b?h.property.apply(h,e.call(arguments,1)):h},get:function(a){var b,d=this.schema[a];return(d=b||this.schema[a])&&d.valueOf&&(d.valueOf!==t||d.hasCustomGet)?((b=b||this.hasOwnProperty("_properties")&&this._properties[a])||(b=g.delegate(c(this,a),{name:a,_parent:this})),b.valueOf()):this._getValues()[a]},set:function(b,c){if("object"===typeof b){p++;try{for(var e in b)c=b[e],!b.hasOwnProperty(e)||c&&c.toJSON===a||this.set(e,c)}finally{d()}}else{e=this.schema[b]; if(!e&&!this.additionalProperties)return console.warn("Schema does not contain a definition for",b);var h=this.hasOwnProperty("_properties")&&this._properties[b];!h&&(c&&"object"===typeof c||e&&e.put!==x)&&(h=this.property(b));h?h.put(c):(e&&e.coerce&&(c=e.coerce(c)),this._getValues()[b]=c);return c}},observe:function(a,b,c){return this.property(a).observe(b,c)},validate:function(a){},isValid:function(){var a=!0,b;for(b in this.schema){var c=this.hasOwnProperty("_properties")&&this._properties[b]; c&&c.errors&&c.errors.length&&(a=!1)}return a}});r.createSubclass=function(a,b){a=f([this].concat(a),b||{});a.extend=function(a){g.mixin(this.prototype,a);return this};return a};var p=0,k,q;(r.nextTurn=function(a){q=a}).atEnd=!0;var h=f(r,{observe:function(a,b){var c;if("string"===typeof a)return console.error("fff"),this.inherited(arguments);b&&b.onlyFutureUpdates||(c=new h,this._has()&&(c.value=a(this.valueOf())));var d=this._addListener(function(b){b=a(b);c&&c.put(b)});return c?(c.remove=d.remove, c):d},validateOnSet:!1,validators:null,_addListener:function(a){return l.after(this,"onchange",a,!0)},valueOf:function(){return this._get()},_get:function(){return this.value},_has:function(){return this.hasOwnProperty("value")},setValue:function(a){this.value=a},put:function(a){var b=this._get();a=this.coerce(a);this.errors&&this.set("errors",void 0);var c=this;p++;return m(this.setValue(a,this._parent),function(e){void 0!==e&&(a=e);c.onchange&&c._queueChange(c.onchange,b);var h,g=b&&"object"=== typeof b&&!(b instanceof Array),f=a&&"object"===typeof a&&!(a instanceof Array);if(g||f){e={};if(g)for(h in b=b._getValues?b._getValues():b,b)e[h]={old:b[h]};if(f)for(h in a=a._getValues?a._getValues():a,a)(e[h]=e[h]||{}).value=a[h];c._values=f&&a;for(h in e)g=e[h],(f=c._properties&&c._properties[h])&&f.onchange&&f._queueChange(f.onchange,g.old)}c.validateOnSet&&c.validate();d()})},coerce:function(a){var b=this.type;b&&("string"===b?a=""+a:"number"===b?a=+a:"boolean"===b?a="false"===a||"0"===a||a instanceof Array&&!a.length?!1:!!a:"function"!==typeof b||a instanceof b||(a=new b(a)));return a},addError:function(a){this.set("errors",(this.errors||[]).concat([a]))},checkForErrors:function(a){var b=[];this.type&&!("function"===typeof this.type?a instanceof this.type:this.type===typeof a)&&b.push(a+" is not a "+this.type);!this.required||null!=a&&""!==a||b.push("required, and it was not present");return b},validate:function(){var a=this,c=this._parent,d=this.validators,e=this.valueOf(),h=[];return m(b(function(b){function g(a){a&& h.push.apply(h,a)}if(d)for(var f=0;f>18&63,c=g>>12&63,d=g>>6&63,g&=63,m[h++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(b)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(g);while(f>18&63,c=e>>12&63,d=e>>6&63,e&=63,p[f++]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(b)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(c)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(d)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\x3d".charAt(e);while(g>5]|=128<<24-c%32;b[(c+64>>9<<4)+15]=c;c=Array(80);for(var a=1732584193,d=-271733879,g=-1732584194,p=271733878,k=-1009589776,q=0;qw;w++){if(16>w)c[w]=b[q+w];else{var A=c[w-3]^c[w-8]^c[w-14]^c[w-16];c[w]=A<<1|A>>>31}A=f.addWords(f.addWords(a<<5|a>>>27,20>w?d&g|~d&p:40>w?d^g^p:60>w?d&g|d&p|g&p:d^g^p),f.addWords(f.addWords(k, c[w]),20>w?1518500249:40>w?1859775393:60>w?-1894007588:-899497514));k=p;p=g;g=d<<30|d>>>2;d=a;a=A}a=f.addWords(a,h);d=f.addWords(d,m);g=f.addWords(g,l);p=f.addWords(p,n);k=f.addWords(k,x)}return[a,d,g,p,k]}function l(b){for(var c=[],a=0,e=8*b.length;a>5]|=(b.charCodeAt(a/8)&255)<<24-a%32;return c}function m(b){for(var c=[],a=0,e=4*b.length;a>2]>>8*(3-a%4)+4&15),"0123456789abcdef".charAt(b[a>>2]>>8*(3-a%4)&15));return c.join("")}function g(b){for(var c= [],a=0,e=32*b.length;a>5]>>>24-a%32&255));return c.join("")}function c(b){for(var c=[],a=0,e=4*b.length;a>2]>>8*(3-a%4)&255)<<16|(b[a+1>>2]>>8*(3-(a+1)%4)&255)<<8|b[a+2>>2]>>8*(3-(a+2)%4)&255,f=0;4>f;f++)8*a+6*f>32*b.length?c.push("\x3d"):c.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g>>6*(3-f)&63));return c.join("")}f.SHA1=function(b,d){d=d||f.outputTypes.Base64;b=n(l(b),8*b.length);switch(d){case f.outputTypes.Raw:return b; case f.outputTypes.Hex:return m(b);case f.outputTypes.String:return g(b);default:return c(b)}};f.SHA1._hmac=function(b,d,a){a=a||f.outputTypes.Base64;var e=l(d);16p;p++)r[p]=e[p]^909522486,d[p]=e[p]^1549556828;b=n(r.concat(l(b)),512+8*b.length);b=n(d.concat(b),672);switch(a){case f.outputTypes.Raw:return b;case f.outputTypes.Hex:return m(b);case f.outputTypes.String:return g(b);default:return c(b)}};return f.SHA1})},"xide/manager/ManagerBase":function(){define("dcl/dcl xide/mixins/EventedMixin xide/model/Base xide/utils dojo/_base/xhr dojo/_base/kernel".split(" "), function(f,n,l,m,g,c){n=f([l.dcl,n.dcl],{declaredClass:"xide.manager.ManagerBase",ctx:null,init:function(){this.initReload&&this.initReload()},_getText:function(b,c){var a;c=m.mixin({url:b,sync:!0,handleAs:"text",load:function(b){a=b}},c);b=g.get(c);return c.sync?""+a+"":b},getContext:function(){return this.ctx}});f.chainAfter(n,"init");return n})},"xide/data/Reference":function(){define(["dcl/dcl","xide/utils","xide/lodash","xide/mixins/EventedMixin"],function(f,n,l,m){var g={_sources:[],destroyOnRemove:!0, _store:null,removeSource:function(c){},updateSource:function(c){},onSourceUpdate:function(c){},onSourceRemoved:function(c){},onSourceDelete:function(c){},onItemChanged:function(c){},destroy:function(){var c=this;(!this.item||this.item.removeReference)&&this.item&&this.item.removeReference(this);this.inherited&&this.inherited(arguments);this._sources&&(this._sources.forEach(function(b){b.item&&b.item.removeReference&&b.item.removeReference(c)}),this._sources=null)},hasSource:function(c){return l.find(this._sources, {item:c})},addSource:function(c,b){this.hasSource(c)||(this._sources.push({item:c,settings:b}),b&&b.onDelete&&this.addHandle("delete",c._store.on("delete",function(b){b.target==c&&this._store.removeSync(this[this._store.idProperty])}.bind(this))))},updateSources:function(c){this._sources.forEach(function(b){var d=b.item;b=b.settings;c.property&&b.properties&&b.properties[c.property]&&(d._store.silent(!0),d.set(c.property,c.value),d._store.silent(!1),d._store.emit("update",{target:d}))})},constructor:function(c){this._sources= [];n.mixin(this,c)}};f=f([m.dcl],g);f.Implementation=g;return f})},"xcf/manager/DeviceManager":function(){define("dcl/dcl xdojo/declare dojo/_base/lang xide/encoding/MD5 xide/types xide/utils xide/factory xcf/manager/BeanManager xide/mixins/ReloadMixin xide/mixins/EventedMixin ./DeviceManager_Server ./DeviceManager_DeviceServer xide/data/Memory xide/data/TreeMemory dojo/has xide/data/ObservableStore dstore/Trackable xcf/model/Device dojo/Deferred xide/manager/ServerActionBase xide/data/Reference xide/utils/StringUtils xcf/mixins/LogMixin xdojo/has!xcf-ui?./DeviceManager_UI xdojo/has!xexpression?xexpression/Expression dojo/promise/all xide/console xide/lodash".split(" "), function(f,n,l,m,g,c,b,d,a,e,r,p,k,q,h,u,v,t,x,w,A,B,y,H,I,F,z,C,G,E){b=[w,d,r,p,a.dcl,y];var K=h("xcf-ui"),D=g.DEVICE_PROPERTY;h("runDrivers");var J=g.EVENTS;h("xcf-ui")&&b.push(H);return f(b,{declaredClass:"xcf.manager.DeviceManager",beanNamespace:"device",beanName:"Device",beanUrlPattern:"{id}",breanScheme:"device://",beanPriority:1,beanIconClass:"fa-sliders",groupType:g.ITEM_TYPE.DEVICE_GROUP,itemType:g.ITEM_TYPE.DEVICE,itemMetaTitleField:D.CF_DEVICE_TITLE,systemScope:"system_devices",userScope:"user_devices", appScope:"app_devices",defaultScope:"system_devices",serviceClass:"XCF_Device_Service",rawData:null,store:null,treeView:null,deviceServerClient:null,deviceInstances:null,driverScopes:null,autoConnectDevices:!0,consoles:null,lastUpTime:null,reconnectDevice:15E3,reconnectDeviceServer:5E3,onRunClassEvent:function(a){var b=a.args.id||a.id;if(this.running&&this.running[b]){var c=this.running[b].delegate;if(c){a.error&&c.onError&&(c.onError(a.error),delete this.running[b]);a.finish&&c.onFinish&&(c.onFinish(a.finish), delete this.running[b]);if(a.progress&&c.onProgress)c.onProgress(a.progress);if(a.interrupt&&c.onInterrupt)c.onInterrupt(a.interrupt)}}},getInstanceByName:function(a){var b=this.deviceInstances,c;for(c in b){var d=b[c].device;if(d&&this.getMetaValue(d,D.CF_DEVICE_TITLE)===a)return b[c]}},getFile:function(a){var b=new x,c=this.ctx;C.isString(a)&&(a=this.getItemByPath(a+".meta.json")||this.getItemByPath(a)||a);var d=c.getFileManager().getStore(a.scope);if(c=d._getItem(a.path))return b.resolve(c),b; d.initRoot().then(function(){d._loadPath(".",!0).then(function(){d.getItem(a.path,!0).then(function(a){b.resolve(a)})})});return b},getSourceHash:function(){return this.ctx.getUserDirectory()||"no_user_directory"},checkDeviceServerConnection:function(){if(!this.ctx.getNodeServiceManager)return!0;var a=this.getContext(),a=h("xnode")&&a.getNodeServiceManager?this.ctx.getNodeServiceManager():null;if(!this.deviceServerClient&&a){a=a.getStore();if(!a)return!1;this.createDeviceServerClient(a)}else return!1; return!0},addDriverFunctions:function(a,b){for(var c in b)"constructor"!==c&&"inherited"!==c&&"getInherited"!==c&&"isInstanceOf"!==c&&"__inherited"!==c&&"onModuleReloaded"!==c&&"start"!==c&&"publish"!==c&&"subscribe"!==c&&"getInherited"!==c&&"getInherited"!==c&&C.isFunction(b[c])&&!a[c]&&(a[c]=b[c])},addLoggingFunctions:function(a,b){var c=this;b.log=function(a,d,e,h){h=h||{};var f=l.clone(h);h.type=h.type||d||"Driver";b.options&&(h.device=b.options);c.publish(g.EVENTS.ON_SERVER_LOG_MESSAGE,{data:h, level:a||"info",message:e,details:f})}},completeDriverInstance:function(a,b,c){var d=this,e=b.blockScope.blockStore,h=c.path,f=h+"_commands",k=h+"_variables";e.on("delete",function(a){var b=-1!==a.target.declaredClass.indexOf("Variable")?k:f,d=c._store.getSync(b);d&&d.refresh();(a=c._store.getSync(b+"_reference_"+a.target.id))&&a.refresh()});e.on("added",function(b){var d=b.name,e=b.icon||"fa-exclamation",h=-1!==b.declaredClass.indexOf("Variable"),p=h?k:f;-1!=b.declaredClass.indexOf(h?"Variable": "Command")&&(d=new A({enabled:!0,path:p+"_reference_"+b.id,name:d,id:b.id,parentId:p,_mayHaveChildren:!1,virtual:!0,tooltip:!0,icon:e,ref:{driver:a,item:b,device:c},type:g.ITEM_TYPE.BLOCK}),d=c._store.putSync(d),b.addReference(d,{properties:{name:!0,enabled:!0,value:!0},onDelete:!0},!0),d.refresh())});b.setVariable=function(b,c,e,h,f){if(b=this.blockScope.getVariable(b))b.value=c,!1===f&&(b.__ignoreChangeMark=!0),b.set("value",c,e,h,f),!1===f&&(b.__ignoreChangeMark=!1),d.publish(g.EVENTS.ON_DRIVER_VARIABLE_CHANGED, {item:b,scope:this.blockScope,driver:a,owner:d,save:!0===e,publish:h})};b.getVariable=function(a){return(a=this.blockScope.getVariable(a))?a._getArg(a.value,!1):""};b.log=function(a,c,e,h){h=h||{};var f=l.clone(h);h.type=h.type||c||"Driver";b.options&&(h.device=b.options);d.publish(g.EVENTS.ON_SERVER_LOG_MESSAGE,{data:h,level:a||"info",message:e,details:f})};for(var p in a)"constructor"!==p&&"inherited"!==p&&"getInherited"!==p&&"isInstanceOf"!==p&&"__inherited"!==p&&"onModuleReloaded"!==p&&"start"!== p&&"publish"!==p&&"subscribe"!==p&&"getInherited"!==p&&"getInherited"!==p&&l.isFunction(a[p])&&!b[p]&&(b[p]=a[p])},getDevice:function(a){var b=a;if(C.isString(a)){var c=this.getItemById(a);c?b=c:(a=this.getItemByPath(a))&&(b=a)}return b},stopDevice:function(a){var b=this.getDevice(a)||a;if(b){if(this.checkDeviceServerConnection(),b._userStopped=!0,(a=this.toDeviceControlInfo(b))&&(a.serverSide||b.isServer())){var c=a.hash;this.deviceInstances[c]&&(this._removeInstance(this.deviceInstances[c],c,b), delete this.deviceInstances[c],this.sendManagerCommand(g.SOCKET_SERVER_COMMANDS.MANAGER_STOP_DRIVER,a))}}else z.error("cant find device "+a)},getStore:function(a){a=a||"system_devices";var b=this.stores[a];if(b)return b;if(a)return this.ls(a)},getDevices:function(a,b){var d=this.getStore();if(!d)return[];d=c.queryStore(d,{isDir:!1});d._S&&(d=[d]);for(var e=[],g=0;gf-this.fileUpdateTimes[e])this.fileUpdateTimes[e]= f;else if(!1!==d&&this.publish(a.event,a),this.fileUpdateTimes[e]=f,d=c.replaceAll("\\","/",a.data.path),d=c.replaceAll("//","/",a.data.path),d=d.replace(/\\/g,"/"),!d.includes("/build/")&&null!=d&&null!=d.indexOf){if(d.match(/\.css$/))this.onCSSChanged({path:d});if(d.match(/\.js$/)&&(a=a.data.modulePath)){a=a.replace(".js","");try{b(a)}catch(q){}e="data/system/drivers";d.includes(e)&&(a=d.substr(d.indexOf(e)+(e.length+1),d.length),a=a.replace(".js",""),a="system_drivers/"+a);e="user/drivers";d.includes(e)&& (a=d.substr(d.indexOf(e)+(e.length+1),d.length),a=a.replace(".js",""),a="user_drivers/"+a);(e=(e=this.getResourceManager())?e.getVariable("VFS_CONFIG")||{}:null)&&e.user_drivers&&d.includes(e.user_drivers)&&(e=e.user_drivers,e=e.replace(/\/+$/,""),a=d.substr(d.indexOf(e)+(e.length+1),d.length),a=a.replace(".js",""),a="user_drivers/"+a);a=c.replaceAll(".","/",a);a.includes("/build/")}}}},onNodeServiceStoreReady:function(a){},mergeFunctions:function(a,b,c,d){for(var e in b)_.isFunction(b[e])&&b[e]&& a&&(a[e]=b[e])},reloadModules:function(a,c){var e=new n,g=[],f=[],h=this;b({cacheBust:"time\x3d"+(new Date).getTime()});_.each(a,function(a){var d=null,e=new n;!1!==c&&(d=b(a));b.undef(a);b([a],function(a){d&&h.mergeFunctions(d.prototype,a.prototype);f.push(a);e.resolve()});g.push(e)});d(g).then(function(){e.resolve(f);b({cacheBust:null})});return e},_reloadModule:function(a,d){var e=null,f=new n;a=a.replace("0/8","0.8");a=a.replace("/src/","/");var q=this.getModule(a);if(q&&q.prototype&&q.prototype.reloadModule)return q.prototype.reloadModule(); var e=b.on("error",function(a){e.remove();f.reject(a)}),h=this.getModule(a);if(!h&&(h="undefined"!==typeof a?h:null,!h&&"undefined"!==typeof window))if(h=c.getAt(window,c.replaceAll("/",".",a),null))q=h;else try{h=b(c.replaceAll(".","/",a))}catch(v){}h&&(q=h);b.undef(a);var m=this;d?setTimeout(function(){b({cacheBust:"time\x3d"+(new Date).getTime(),waitSeconds:5});try{b([a],function(c){b({cacheBust:null});if(_.isString(c))console.error("module reloaded failed : "+c+" for module : "+a);else{c.modulePath= a;q&&(m.mergeFunctions(q.prototype,c.prototype,q,c),q.prototype&&q.prototype._onReloaded&&q.prototype._onReloaded(c));if(h&&h.onReloaded)h.onReloaded(c,h);m.publish(g.EVENTS.ON_MODULE_RELOADED,{module:a,newModule:c});c.prototype&&c.prototype.declaredClass&&m.publish(g.EVENTS.ON_MODULE_UPDATED,{moduleClass:c.prototype.declaredClass,moduleProto:c.prototype});m.setModule(a,c);f.resolve(c)}})}catch(v){console.error("error reloading module",v),logError(v,"error reloading module"),f.reject(v)}},100):f.resolve(); return f},onCSSChanged:function(a){},onDidChangeFileContent:function(a){if(!a.didProcess&&(a.didProcess=!0,this.vfsMounts&&a.path)){var b=a.path;if(!(b.includes(".css")||b.includes("resources")||b.includes("meta")||b.includes("lib/custom"))&&b.includes(".js")){var b=a.mount.replace("/",""),d=null;if(this.vfsMounts[b]){var d=""+a.path,d=d.replace("./",""),d=d.replace("/","."),d=d.replace(".js",""),d=c.replaceAll(".","/",d),e=this;setTimeout(function(){try{e._reloadModule(d,!0)}catch(q){console.error("error reloading module", q)}},100)}}}},getMount:function(a){var b=this.getResourceManager();return(b=b?b.getVariable("VFS_CONFIG")||{}:null)&&b[a]?b[a]:null},toVFSShort:function(a,b){var d=this.getResourceManager();return(d=d?d.getVariable("VFS_CONFIG")||{}:null)&&d[b]&&(b=d[b],b=c.replaceAll("//","/",b),b=b.replace(/\/+$/,""),a.includes(b))?(b=b.replace(/\/+$/,""),a.substr(a.indexOf(b)+(b.length+1),a.length)):null},findVFSMount:function(a){var b=this.getResourceManager();if(b=b?b.getVariable("VFS_CONFIG")||{}:null)for(var d in b){var e= b[d],e=c.replaceAll("//","/",e),e=e.replace(/\/+$/,"");if(a.includes(e))return d}return null},findVFSMountPath:function(a){var b=this.getResourceManager();if(b=b?b.getVariable("VFS_CONFIG")||{}:null)for(var d in b){var e=b[d],e=c.replaceAll("//","/",e),e=e.replace(/\/+$/,"");if(a.includes(e))return e}return null},getBlockManager:function(){return this.blockManager},getPluginManager:function(){return this.pluginManager},getService:function(){return this.serviceObject},getFileManager:function(){return this.fileManager}, getResourceManager:function(){return this.resourceManager},getMountManager:function(){return this.mountManager},getContextManager:function(){return this.contextManager},getLogManager:function(){return this.logManager},getApplication:function(){return this.application},constructor:function(a,b){this.managers=[];this.config=a;this.args=b;this.language="en";this.subscribe(g.EVENTS.ON_CHANGED_CONTENT,this.onDidChangeFileContent)},prepare:function(){this.config&&this.initWithConfig(this.config)},initWithConfig:function(a){a&& a.mixins&&this.doMixins(a.mixins)},isEditor:function(){return this.args&&this.args.file}});f.chainAfter(l,"constructManagers");f.chainAfter(l,"initManagers");return l})},"xcf/manager/ProtocolManager":function(){define("dcl/dcl dojo/_base/declare xide/manager/ServerActionBase xide/types xide/utils xide/factory xaction/Action xcf/manager/BeanManager".split(" "),function(f,n,l,m,g,c,b,d){return f([l,d],{declaredClass:"xcf.manager.ProtocolManager",beanNamespace:"protocol",beanName:"Protocol",beanIconClass:"fa-code", groupType:m.ITEM_TYPE.PROTOCOL_GROUP,itemType:m.ITEM_TYPE.PROTOCOL,itemMetaPath:"user.meta",itemMetaStorePath:"/meta/inputs",itemMetaTitleField:m.PROTOCOL_PROPERTY.CF_PROTOCOL_TITLE,systemScope:"system_protocols",userScope:"user_protocols",appScope:"app_protocols",defaultScope:"system_protocols",serviceClass:"XCF_Protocol_Service",rawData:null,store:null,treeView:null,protocolScopes:null,getItemActions:function(){var a=[],b=this,c=this.getItem(),d=c?!0===g.toBoolean(c.isDir):!1;a.push({title:"New Group", icon:"el-icon-folder",place:"last",emit:!1,style:"",handler:function(a,c,d){b.newGroup()}});a.push({title:"Reload",icon:"fa-refresh",disabled:!1,command:"Reload",place:"last",emit:!1,style:"",handler:function(){b.reload()}});null!=this.getItem()&&(a.push({title:"Delete",icon:"el-icon-remove-circle",disabled:!1,command:"Delete",place:"last",emit:!1,style:"",handler:function(){b.onDeleteItem(c)}}),d?a.push({title:"New Protocol",icon:"el-icon-file-new",disabled:!1,command:"NewItem",place:"last",emit:!1, style:"",handler:function(){b.newItem(c)}}):a.push({title:"Connect",icon:"el-icon-play-circle",disabled:!1,command:"Start",place:"last",emit:!1,style:"",handler:function(){b.startDevice(c)}}));return a},onItemRemoved:function(a){a==this.currentItem&&(this.currentItem=null);a&&(a=this.getView(a))&&g.destroy(a)},_onDeleteItem:function(a){var b=!0===g.toBoolean(a.isDir),c=g.toString(a.name),d=b?"removeGroup":"removeItem",f=this;(new ActionDialog({title:"Remove Protocol"+(b?" Group":"")+" '"+c+"'",style:"max-width:400px", titleBarClass:"text-danger",delegate:{isRemoving:!1,onOk:function(b){f[d](g.toString(a.scope),g.toString(a.path),function(){f.onItemRemoved(a)})}},inserts:[{query:".dijitDialogPaneContent",insert:'\x3cdiv\x3e\x3cspan class\x3d"fileManagerDialogText"\x3eDo you really want to remove this item?\x3c/span\x3e\x3c/div\x3e',place:"first"}]})).show()},newItem:function(){var a=this.getItem();a||(a={path:""});var b=[g.createCI("In Group",13,g.toString(a.path),{widget:{disabled:!0},group:"Common"}),g.createCI("Title", 13,"",{group:"Common"})],a=new CIActionDialog({title:"New Device",resizable:!0,delegate:{onOk:function(a,c){a=g.createCI("Id",13,g.createUUID(),{visible:!1,group:"Common"});c.push(a);g.toOptions(c);g.getInputCIByName(b,"Title");g.getInputCIByName(b,"Scope");g.getInputCIByName(b,"In Group")}},cis:b});a.show();a.resize()},reload:function(){},onFileChanged:function(a){if(!a._pp2){a._pp2=!0;var b=a.data;this.fileUpdateTimes||(this.fileUpdateTimes={});if(b.event===m.EVENTS.ON_FILE_CHANGED){if(b.data&& b.mask&&-1!==b.mask.indexOf("delete"))return;(new Date).getTime()}var c=g.replaceAll("\\","/",b.path),c=g.replaceAll("//","/",b.path),c=c.replace(/\\/g,"/");-1!=c.indexOf("protocols")&&(c.match(/\.json$/)&&this.ls("system_protocols"),this.onFileChanged2&&this.onFileChanged2(a))}},init:function(){this.subscribe(m.EVENTS.ON_FILE_CHANGED,this.onFileChanged)},_resetItem:function(a){a.commandsItem&&g.removeFromStore(this.getStore(),a.commandsItem,!0,"path","parentId");a.variablesItem&&g.removeFromStore(this.getStore(), a.variablesItem,!0,"path","parentId")},_completeProtocolItem:function(a){if(a&&a.user){var b=g.getInputCIByName(a.user.meta,"content"),c=this,d=this.getStore();if(!b&&(a.mount=""+a.scope,a.getPath=function(){return a.path},a.virtual=!1,a.isDir=!0,a.children=[],b=g.createCI("Content",m.ECIType.FILE_EDITOR,"no value",{group:"Content",editor:"JSON Editor",editorArgs:{subscribers:[{event:"onSave",handler:function(b){(b=g.getJson(b.value))&&b.meta&&(a.user=b,a._completed=!1,c._resetItem(a),c._completeProtocolItem(a), c.publish(m.EVENTS.ON_PROTOCOL_CHANGED,{item:a}))},owner:c}],leftEditorArgs:{subscribers:[{event:"addAction",handler:function(a){console.log("add action",arguments)},owner:c}],hiddenFields:{},readOnlyNodes:{commands:!0,variables:!0,meta:!0},insertTemplates:[{label:"New Command",path:"commands",value:'{title:"No Title",send:""}',newNodeTemplate:"[]",collapse:!0,select:!0},{label:"New Variable",path:"variables",value:'{title:"No Title",value:""}',newNodeTemplate:"[]",collapse:!0,select:!0}],renderTemplates:[{nodeValuePath:"field.innerHTML", match:[/^variables[\s]?\.(\d+)$/,/^commands[\s]?\.(\d+)$/],replaceWith:"{nodeValue} - {title}",variables:null,nodeValueTransform:function(a){return g.capitalize(a)},insertIfMatch:{}}]},rightEditorArgs:{subscribers:[{event:"addAction",handler:function(a){console.log("add action",arguments)},owner:c}]}},editorItem:a,editorOverrides:{},isOwnTab:!0}),a.user.meta.inputs.push(b),!a._completed)){a._completed=!0;var f={path:g.createUUID(),name:"Commands",isDir:!0,type:"leaf",parentId:a.path,virtual:!0,children:[]}; a.commandsItem=f;a.children.push(f);d.putSync(f);for(var q=a.user.commands,b=0;bn)throw new TypeError("Invalid capacity");this._buffer=Array(n);this._capacity=n;this._size=this._first= 0}}f.prototype={size:function(){return this._size},capacity:function(){return this._capacity},enq:function(f){0f)throw new TypeError("Invalid start");if(f>=this._size)throw new RangeError("Index past end of buffer: "+ f);if(void 0==l)return this._buffer[(this._first+f)%this._capacity];if("number"!=typeof l||0!=l%1||0>l)throw new TypeError("Invalid end");if(l>=this._size)throw new RangeError("Index past end of buffer: "+l);this._first+f>=this._capacity&&(f-=this._capacity,l-=this._capacity);return this._first+lf?-1:1,f=Math.abs(e-(f+(1==c?-1:1))),e=0;ef?-1:1;f=Math.abs(e-(f+(1==c?-1:1)));for(e=0;e=m:l<=m)&&(h.push(f[e]),p.push(g.storage.index[f[e].id]))}for(e=0;e