@qooxdoo/framework
Version:
The JS Framework for Coders
2 lines (1 loc) • 15.4 kB
JavaScript
!function(t){function e(n){if(r[n])return r[n].exports;var a=r[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var r={};e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(r,"a",r),r},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e,r){function n(t){return u&&null==s&&i(),"xml"==p?o(t):"json"==p?a(t):"${"+t+"}"}function a(t){variable=t,variable.startsWith("$")||(variable="$."+variable);try{var e=r(1).JSONPath;ret=e({path:variable,json:s})}catch(e){ret="${"+t+"}"}return ret}function o(t){variable=t,variable.startsWith("/")||(variable="/"+variable.replace(/(\.)/g,"/"));try{ret=s.evaluate(variable,s,null,XPathResult.ANY_TYPE,null).iterateNext().childNodes[0].nodeValue}catch(e){ret="${"+t+"}"}return ret}function i(){xhttp=new XMLHttpRequest,xhttp.open("GET",u,!1),xhttp.send(null),str=xhttp.response,s=c(str,p)}function c(t,e){var r=null;return"xml"==e?(t=t.replace(/(<[\s\S]*)xmlns=\"[^"]*\"([^>]*>)/g,"$1$2"),window.DOMParser?(parser=new DOMParser,r=parser.parseFromString(t,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(t))):"json"==e&&(r=JSON.parse(t)),r}function l(t,e){u=e.config.variablesFile,p=e.config.variablesFileType,p||(p=u.split(".").pop()),p||(p="xml"),p=p.toLowerCase(),t.afterEach(function(t,e){e(t.replace(/\${([^\}]*)}/g,function(t,e){return n(e)}))})}var u,p,s=null;window.$docsify||(window.$docsify={}),window.$docsify.plugins=(window.$docsify.plugins||[]).concat(l)},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function u(t,e,r){return u=l()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var a=Function.bind.apply(t,n),o=new a;return r&&c(o,r.prototype),o},u.apply(null,arguments)}function p(t){return-1!==Function.toString.call(t).indexOf("[native code]")}function s(t){var e="function"==typeof Map?new Map:void 0;return(s=function(t){function r(){return u(t,arguments,i(this).constructor)}if(null===t||!p(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)})(t)}function f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function h(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?f(t):e}function y(t,e){return t=t.slice(),t.push(e),t}function v(t,e){return e=e.slice(),e.unshift(t),e}function b(t,e,r,a,o){if(!(this instanceof b))try{return new b(t,e,r,a,o)}catch(t){if(!t.avoidNew)throw t;return t.value}"string"==typeof t&&(o=a,a=r,r=e,e=t,t={}),t=t||{};var i=w.call(t,"json")&&w.call(t,"path");if(this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType&&t.resultType.toLowerCase()||"value",this.flatten=t.flatten||!1,this.wrap=!w.call(t,"wrap")||t.wrap,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||a||null,this.otherTypeCallback=t.otherTypeCallback||o||function(){throw new Error("You must supply an otherTypeCallback callback option with the @other() operator.")},!1!==t.autostart){var c=this.evaluate({path:i?t.path:e,json:i?t.json:r});if(!c||"object"!==n(c))throw new S(c);return c}}r.d(e,"JSONPath",function(){return b});var d=eval,g=void 0!==t&&Boolean(t.exports)&&!("undefined"!=typeof navigator&&"ReactNative"===navigator.product),_=["value","path","pointer","parent","parentProperty","all"],w=Object.prototype.hasOwnProperty,x=function(t,e,r){for(var n=t.length,a=0;a<n;a++){r(t[a])&&e.push(t.splice(a--,1)[0])}},P=g?r(3):{runInNewContext:function(t,e){var r=Object.keys(e),n=[];x(r,n,function(t){return"function"==typeof e[t]});var a=n.reduce(function(t,r){var n=e[r].toString();return/function/.exec(n)||(n="function "+n),"var "+r+"="+n+";"+t},"")+r.reduce(function(t,r){return"var "+r+"="+JSON.stringify(e[r]).replace(/\u2028|\u2029/g,function(t){return"\\u202"+("\u2028"===t?"8":"9")})+";"+t},t);return d(a)}},S=function(t){function e(t){var r;return a(this,e),r=h(this,i(e).call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)')),r.avoidNew=!0,r.value=t,r.name="NewError",r}return o(e,t),e}(s(Error));b.prototype.evaluate=function(t,e,r,a){var o=this,i=this.parent,c=this.parentProperty,l=this.flatten,u=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=a||this.otherTypeCallback,e=e||this.json,(t=t||this.path)&&"object"===n(t)){if(!t.path)throw new Error('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');e=w.call(t,"json")?t.json:e,l=w.call(t,"flatten")?t.flatten:l,this.currResultType=w.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=w.call(t,"sandbox")?t.sandbox:this.currSandbox,u=w.call(t,"wrap")?t.wrap:u,this.currPreventEval=w.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=w.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=w.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,i=w.call(t,"parent")?t.parent:i,c=w.call(t,"parentProperty")?t.parentProperty:c,t=t.path}if(i=i||null,c=c||null,Array.isArray(t)&&(t=b.toPathString(t)),t&&e&&_.includes(this.currResultType)){this._obj=e;var p=b.toPathArray(t);"$"===p[0]&&p.length>1&&p.shift(),this._hasParentSelector=null;var s=this._trace(p,e,["$"],i,c,r).filter(function(t){return t&&!t.isParentSelector});return s.length?1!==s.length||u||Array.isArray(s[0].value)?s.reduce(function(t,e){var r=o._getPreferredOutput(e);return l&&Array.isArray(r)?t=t.concat(r):t.push(r),t},[]):this._getPreferredOutput(s[0]):u?[]:void 0}},b.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){default:throw new TypeError("Unknown result type");case"all":return t.pointer=b.toPointer(t.path),t.path="string"==typeof t.path?t.path:b.toPathString(t.path),t;case"value":case"parent":case"parentProperty":return t[e];case"path":return b.toPathString(t[e]);case"pointer":return b.toPointer(t.path)}},b.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path="string"==typeof t.path?t.path:b.toPathString(t.path),e(n,r,t)}},b.prototype._trace=function(t,e,r,a,o,i,c){function l(t){Array.isArray(t)?t.forEach(function(t){h.push(t)}):h.push(t)}var u,p=this;if(!t.length)return u={path:r,value:e,parent:a,parentProperty:o},this._handleCallback(u,i,"value"),u;var s=t[0],f=t.slice(1),h=[];if(("string"!=typeof s||c)&&e&&w.call(e,s))l(this._trace(f,e[s],y(r,s),e,s,i));else if("*"===s)this._walk(s,f,e,r,a,o,i,function(t,e,r,n,a,o,i,c){l(p._trace(v(t,r),n,a,o,i,c,!0))});else if(".."===s)l(this._trace(f,e,r,a,o,i)),this._walk(s,f,e,r,a,o,i,function(t,e,r,a,o,i,c,u){"object"===n(a[t])&&l(p._trace(v(e,r),a[t],y(o,t),a,t,u))});else{if("^"===s)return this._hasParentSelector=!0,r.length?{path:r.slice(0,-1),expr:f,isParentSelector:!0}:[];if("~"===s)return u={path:y(r,s),value:o,parent:a,parentProperty:null},this._handleCallback(u,i,"property"),u;if("$"===s)l(this._trace(f,e,r,null,null,i));else if(/^(-?\d*):(-?\d*):?(\d*)$/.test(s))l(this._slice(s,f,e,r,a,o,i));else if(0===s.indexOf("?(")){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(s,f,e,r,a,o,i,function(t,e,r,n,a,o,i,c){p._eval(e.replace(/^\?\((.*?)\)$/,"$1"),n[t],t,a,o,i)&&l(p._trace(v(t,r),n,a,o,i,c))})}else if("("===s[0]){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");l(this._trace(v(this._eval(s,e,r[r.length-1],r.slice(0,-1),a,o),f),e,r,a,o,i))}else if("@"===s[0]){var b=!1,d=s.slice(1,-2);switch(d){default:throw new TypeError("Unknown value type "+d);case"scalar":e&&["object","function"].includes(n(e))||(b=!0);break;case"boolean":case"string":case"undefined":case"function":n(e)===d&&(b=!0);break;case"number":n(e)===d&&isFinite(e)&&(b=!0);break;case"nonFinite":"number"!=typeof e||isFinite(e)||(b=!0);break;case"object":e&&n(e)===d&&(b=!0);break;case"array":Array.isArray(e)&&(b=!0);break;case"other":b=this.currOtherTypeCallback(e,r,a,o);break;case"integer":e!==Number(e)||!isFinite(e)||e%1||(b=!0);break;case"null":null===e&&(b=!0)}if(b)return u={path:r,value:e,parent:a,parentProperty:o},this._handleCallback(u,i,"value"),u}else if("`"===s[0]&&e&&w.call(e,s.slice(1))){var g=s.slice(1);l(this._trace(f,e[g],y(r,g),e,g,i,!0))}else if(s.includes(",")){var _=s.split(","),x=!0,P=!1,S=void 0;try{for(var O,j=_[Symbol.iterator]();!(x=(O=j.next()).done);x=!0){var m=O.value;l(this._trace(v(m,f),e,r,a,o,i))}}catch(t){P=!0,S=t}finally{try{x||null==j.return||j.return()}finally{if(P)throw S}}}else!c&&e&&w.call(e,s)&&l(this._trace(f,e[s],y(r,s),e,s,i,!0))}if(this._hasParentSelector)for(var E=0;E<h.length;E++){var k=h[E];if(k.isParentSelector){var $=p._trace(k.expr,e,k.path,a,o,i);if(Array.isArray($)){h[E]=$[0];for(var C=$.length,T=1;T<C;T++)E++,h.splice(E,0,$[T])}else h[E]=$}}return h},b.prototype._walk=function(t,e,r,a,o,i,c,l){if(Array.isArray(r))for(var u=r.length,p=0;p<u;p++)l(p,t,e,r,a,o,i,c);else if("object"===n(r))for(var s in r)w.call(r,s)&&l(s,t,e,r,a,o,i,c)},b.prototype._slice=function(t,e,r,n,a,o,i){if(Array.isArray(r)){var c=r.length,l=t.split(":"),u=l[2]&&parseInt(l[2])||1,p=l[0]&&parseInt(l[0])||0,s=l[1]&&parseInt(l[1])||c;p=p<0?Math.max(0,p+c):Math.min(c,p),s=s<0?Math.max(0,s+c):Math.min(c,s);for(var f=[],h=p;h<s;h+=u){var y=this._trace(v(h,e),r,n,a,o,i);Array.isArray(y)?y.forEach(function(t){f.push(t)}):f.push(y)}return f}},b.prototype._eval=function(t,e,r,n,a,o){if(!this._obj||!e)return!1;t.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=o,t=t.replace(/@parentProperty/g,"_$_parentProperty")),t.includes("@parent")&&(this.currSandbox._$_parent=a,t=t.replace(/@parent/g,"_$_parent")),t.includes("@property")&&(this.currSandbox._$_property=r,t=t.replace(/@property/g,"_$_property")),t.includes("@path")&&(this.currSandbox._$_path=b.toPathString(n.concat([r])),t=t.replace(/@path/g,"_$_path")),t.match(/@([.\s)[])/)&&(this.currSandbox._$_v=e,t=t.replace(/@([.\s)[])/g,"_$_v$1"));try{return P.runInNewContext(t,this.currSandbox)}catch(e){throw console.log(e),new Error("jsonPath: "+e.message+": "+t)}},b.cache={},b.toPathString=function(t){for(var e=t,r=e.length,n="$",a=1;a<r;a++)/^(~|\^|@.*?\(\))$/.test(e[a])||(n+=/^[0-9*]+$/.test(e[a])?"["+e[a]+"]":"['"+e[a]+"']");return n},b.toPointer=function(t){for(var e=t,r=e.length,n="",a=1;a<r;a++)/^(~|\^|@.*?\(\))$/.test(e[a])||(n+="/"+e[a].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n},b.toPathArray=function(t){var e=b.cache;if(e[t])return e[t].concat();var r=[],n=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/[['](\??\(.*?\))[\]']/g,function(t,e){return"[#"+(r.push(e)-1)+"]"}).replace(/\['([^'\]]*)'\]/g,function(t,e){return"['"+e.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/'?\.'?(?![^[]*\])|\['?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(t,e){return";"+e.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),a=n.split(";").map(function(t){var e=t.match(/#(\d+)/);return e&&e[1]?r[e[1]]:t});return e[t]=a,e[t]}}.call(e,r(2)(t))},function(t,e){t.exports=function(t){if(!t.webpackPolyfill){var e=Object.create(t);e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),Object.defineProperty(e,"exports",{enumerable:!0}),e.webpackPolyfill=1}return e}},function(module,exports,__webpack_require__){function Context(){}var indexOf=__webpack_require__(4),Object_keys=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var r in t)e.push(r);return e},forEach=function(t,e){if(t.forEach)return t.forEach(e);for(var r=0;r<t.length;r++)e(t[r],r,t)},defineProp=function(){try{return Object.defineProperty({},"_",{}),function(t,e,r){Object.defineProperty(t,e,{writable:!0,enumerable:!1,configurable:!0,value:r})}}catch(t){return function(t,e,r){t[e]=r}}}(),globals=["Array","Boolean","Date","Error","EvalError","Function","Infinity","JSON","Math","NaN","Number","Object","RangeError","ReferenceError","RegExp","String","SyntaxError","TypeError","URIError","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","eval","isFinite","isNaN","parseFloat","parseInt","undefined","unescape"];Context.prototype={};var Script=exports.Script=function(t){if(!(this instanceof Script))return new Script(t);this.code=t};Script.prototype.runInContext=function(t){if(!(t instanceof Context))throw new TypeError("needs a 'context' argument.");var e=document.createElement("iframe");e.style||(e.style={}),e.style.display="none",document.body.appendChild(e);var r=e.contentWindow,n=r.eval,a=r.execScript;!n&&a&&(a.call(r,"null"),n=r.eval),forEach(Object_keys(t),function(e){r[e]=t[e]}),forEach(globals,function(e){t[e]&&(r[e]=t[e])});var o=Object_keys(r),i=n.call(r,this.code);return forEach(Object_keys(r),function(e){(e in t||-1===indexOf(o,e))&&(t[e]=r[e])}),forEach(globals,function(e){e in t||defineProp(t,e,r[e])}),document.body.removeChild(e),i},Script.prototype.runInThisContext=function(){return eval(this.code)},Script.prototype.runInNewContext=function(t){var e=Script.createContext(t),r=this.runInContext(e);return forEach(Object_keys(e),function(r){t[r]=e[r]}),r},forEach(Object_keys(Script.prototype),function(t){exports[t]=Script[t]=function(e){var r=Script(e);return r[t].apply(r,[].slice.call(arguments,1))}}),exports.createScript=function(t){return exports.Script(t)},exports.createContext=Script.createContext=function(t){var e=new Context;return"object"==typeof t&&forEach(Object_keys(t),function(r){e[r]=t[r]}),e}},function(t,e){var r=[].indexOf;t.exports=function(t,e){if(r)return t.indexOf(e);for(var n=0;n<t.length;++n)if(t[n]===e)return n;return-1}}]);