orator 3.0.0 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/orator.js +986 -0
- package/dist/orator.min.js +135 -0
- package/dist/orator.min.js.map +1 -0
- package/gulpfile.js +83 -0
- package/package.json +5 -3
- package/source/Orator-Browser-Shim.js +14 -0
- package/source/Orator-Default-ServiceServers-Web.js +21 -0
- package/source/Orator-ServiceServer-IPC.js +7 -5
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Orator=t()}}((function(){return function t(e,r,n){function i(o,a){if(!r[o]){if(!e[o]){var u="function"==typeof require&&require;if(!a&&u)return u(o,!0);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=r[o]={exports:{}};e[o][0].call(c.exports,(function(t){return i(e[o][1][t]||t)}),c,c.exports,t,e,r,n)}return r[o].exports}for(var s="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){(function(r){(function(){"use strict";var n=t("object-assign");
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/function i(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function s(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}var o=t("util/"),a=Object.prototype.hasOwnProperty,u=Array.prototype.slice,l="foo"===function(){}.name;function c(t){return Object.prototype.toString.call(t)}function h(t){return!s(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}var f=e.exports=v,p=/\s*function\s+([^\(\s]*)\s*/;function d(t){if(o.isFunction(t)){if(l)return t.name;var e=t.toString().match(p);return e&&e[1]}}function g(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function y(t){if(l||!o.isFunction(t))return o.inspect(t);var e=d(t);return"[Function"+(e?": "+e:"")+"]"}function m(t,e,r,n,i){throw new f.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function v(t,e){t||m(t,!0,e,"==",f.ok)}function b(t,e,r,n){if(t===e)return!0;if(s(t)&&s(e))return 0===i(t,e);if(o.isDate(t)&&o.isDate(e))return t.getTime()===e.getTime();if(o.isRegExp(t)&&o.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(h(t)&&h(e)&&c(t)===c(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===i(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(s(t)!==s(e))return!1;var a=(n=n||{actual:[],expected:[]}).actual.indexOf(t);return-1!==a&&a===n.expected.indexOf(e)||(n.actual.push(t),n.expected.push(e),function(t,e,r,n){if(null==t||null==e)return!1;if(o.isPrimitive(t)||o.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=S(t),s=S(e);if(i&&!s||!i&&s)return!1;if(i)return b(t=u.call(t),e=u.call(e),r);var a,l,c=P(t),h=P(e);if(c.length!==h.length)return!1;for(c.sort(),h.sort(),l=c.length-1;l>=0;l--)if(c[l]!==h[l])return!1;for(l=c.length-1;l>=0;l--)if(!b(t[a=c[l]],e[a],r,n))return!1;return!0}(t,e,r,n))}return r?t===e:t==e}function S(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function w(t,e){if(!t||!e)return!1;if("[object RegExp]"==Object.prototype.toString.call(e))return e.test(t);try{if(t instanceof e)return!0}catch(t){}return!Error.isPrototypeOf(e)&&!0===e.call({},t)}function x(t,e,r,n){var i;if("function"!=typeof e)throw new TypeError('"block" argument must be a function');"string"==typeof r&&(n=r,r=null),i=function(t){var e;try{t()}catch(t){e=t}return e}(e),n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),t&&!i&&m(i,r,"Missing expected exception"+n);var s="string"==typeof n,a=!t&&i&&!r;if((!t&&o.isError(i)&&s&&w(i,r)||a)&&m(i,r,"Got unwanted exception"+n),t&&i&&r&&!w(i,r)||!t&&i)throw i}f.AssertionError=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,t.message?(this.message=t.message,this.generatedMessage=!1):(this.message=function(t){return g(y(t.actual),128)+" "+t.operator+" "+g(y(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||m;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=d(e),s=n.indexOf("\n"+i);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}},o.inherits(f.AssertionError,Error),f.fail=m,f.ok=v,f.equal=function(t,e,r){t!=e&&m(t,e,r,"==",f.equal)},f.notEqual=function(t,e,r){t==e&&m(t,e,r,"!=",f.notEqual)},f.deepEqual=function(t,e,r){b(t,e,!1)||m(t,e,r,"deepEqual",f.deepEqual)},f.deepStrictEqual=function(t,e,r){b(t,e,!0)||m(t,e,r,"deepStrictEqual",f.deepStrictEqual)},f.notDeepEqual=function(t,e,r){b(t,e,!1)&&m(t,e,r,"notDeepEqual",f.notDeepEqual)},f.notDeepStrictEqual=function t(e,r,n){b(e,r,!0)&&m(e,r,n,"notDeepStrictEqual",t)},f.strictEqual=function(t,e,r){t!==e&&m(t,e,r,"===",f.strictEqual)},f.notStrictEqual=function(t,e,r){t===e&&m(t,e,r,"!==",f.notStrictEqual)},f.throws=function(t,e,r){x(!0,t,e,r)},f.doesNotThrow=function(t,e,r){x(!1,t,e,r)},f.ifError=function(t){if(t)throw t},f.strict=n((function t(e,r){e||m(e,!0,r,"==",t)}),f,{equal:f.strictEqual,deepEqual:f.deepStrictEqual,notEqual:f.notStrictEqual,notDeepEqual:f.notDeepStrictEqual}),f.strict.strict=f.strict;var P=Object.keys||function(t){var e=[];for(var r in t)a.call(t,r)&&e.push(r);return e}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"object-assign":47,"util/":4}],2:[function(t,e,r){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],3:[function(t,e,r){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],4:[function(t,e,r){(function(e,n){(function(){var i=/%[sdj%]/g;r.format=function(t){if(!m(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(a(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,s=n.length,o=String(t).replace(i,(function(t){if("%%"===t)return"%";if(r>=s)return t;switch(t){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return t}})),u=n[r];r<s;u=n[++r])g(u)||!S(u)?o+=" "+u:o+=" "+a(u);return o},r.deprecate=function(t,i){if(v(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(!0===e.noDeprecation)return t;var s=!1;return function(){if(!s){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),s=!0}return t.apply(this,arguments)}};var s,o={};function a(t,e){var n={seen:[],stylize:l};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),d(e)?n.showHidden=e:e&&r._extend(n,e),v(n.showHidden)&&(n.showHidden=!1),v(n.depth)&&(n.depth=2),v(n.colors)&&(n.colors=!1),v(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=u),c(n,t,n.depth)}function u(t,e){var r=a.styles[e];return r?"["+a.colors[r][0]+"m"+t+"["+a.colors[r][1]+"m":t}function l(t,e){return t}function c(t,e,n){if(t.customInspect&&e&&P(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return m(i)||(i=c(t,i,n)),i}var s=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(m(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(y(e))return t.stylize(""+e,"number");if(d(e))return t.stylize(""+e,"boolean");if(g(e))return t.stylize("null","null")}(t,e);if(s)return s;var o=Object.keys(e),a=function(t){var e={};return t.forEach((function(t,r){e[t]=!0})),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),x(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(e);if(0===o.length){if(P(e)){var u=e.name?": "+e.name:"";return t.stylize("[Function"+u+"]","special")}if(b(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(w(e))return t.stylize(Date.prototype.toString.call(e),"date");if(x(e))return h(e)}var l,S="",O=!1,C=["{","}"];(p(e)&&(O=!0,C=["[","]"]),P(e))&&(S=" [Function"+(e.name?": "+e.name:"")+"]");return b(e)&&(S=" "+RegExp.prototype.toString.call(e)),w(e)&&(S=" "+Date.prototype.toUTCString.call(e)),x(e)&&(S=" "+h(e)),0!==o.length||O&&0!=e.length?n<0?b(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),l=O?function(t,e,r,n,i){for(var s=[],o=0,a=e.length;o<a;++o)E(e,String(o))?s.push(f(t,e,r,n,String(o),!0)):s.push("");return i.forEach((function(i){i.match(/^\d+$/)||s.push(f(t,e,r,n,i,!0))})),s}(t,e,n,a,o):o.map((function(r){return f(t,e,n,a,r,O)})),t.seen.pop(),function(t,e,r){var n=t.reduce((function(t,e){return e.indexOf("\n")>=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0);if(n>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(l,S,C)):C[0]+S+C[1]}function h(t){return"["+Error.prototype.toString.call(t)+"]"}function f(t,e,r,n,i,s){var o,a,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?a=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(a=t.stylize("[Setter]","special")),E(n,i)||(o="["+i+"]"),a||(t.seen.indexOf(u.value)<0?(a=g(r)?c(t,u.value,null):c(t,u.value,r-1)).indexOf("\n")>-1&&(a=s?a.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+a.split("\n").map((function(t){return" "+t})).join("\n")):a=t.stylize("[Circular]","special")),v(o)){if(s&&i.match(/^\d+$/))return a;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+a}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function g(t){return null===t}function y(t){return"number"==typeof t}function m(t){return"string"==typeof t}function v(t){return void 0===t}function b(t){return S(t)&&"[object RegExp]"===O(t)}function S(t){return"object"==typeof t&&null!==t}function w(t){return S(t)&&"[object Date]"===O(t)}function x(t){return S(t)&&("[object Error]"===O(t)||t instanceof Error)}function P(t){return"function"==typeof t}function O(t){return Object.prototype.toString.call(t)}function C(t){return t<10?"0"+t.toString(10):t.toString(10)}r.debuglog=function(t){if(v(s)&&(s=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!o[t])if(new RegExp("\\b"+t+"\\b","i").test(s)){var n=e.pid;o[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else o[t]=function(){};return o[t]},r.inspect=a,a.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=d,r.isNull=g,r.isNullOrUndefined=function(t){return null==t},r.isNumber=y,r.isString=m,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=v,r.isRegExp=b,r.isObject=S,r.isDate=w,r.isError=x,r.isFunction=P,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var j=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function E(t,e){return Object.prototype.hasOwnProperty.call(t,e)}r.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[C(t.getHours()),C(t.getMinutes()),C(t.getSeconds())].join(":"),[t.getDate(),j[t.getMonth()],e].join(" ")),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!S(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this)}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":3,_process:52,inherits:2}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,s.isAsync)(t))return function(...e){const r=e.pop();return a(t.apply(this,e),r)};return(0,n.default)((function(e,r){var n;try{n=t.apply(this,e)}catch(t){return r(t)}if(n&&"function"==typeof n.then)return a(n,r);r(null,n)}))};var n=o(t("./internal/initialParams.js")),i=o(t("./internal/setImmediate.js")),s=t("./internal/wrapAsync.js");function o(t){return t&&t.__esModule?t:{default:t}}function a(t,e){return t.then((t=>{u(e,null,t)}),(t=>{u(e,t&&t.message?t:new Error(t))}))}function u(t,e,r){try{t(e,r)}catch(t){(0,i.default)((t=>{throw t}),t)}}e.exports=r.default},{"./internal/initialParams.js":13,"./internal/setImmediate.js":18,"./internal/wrapAsync.js":19}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=o(t("./internal/eachOfLimit.js")),i=o(t("./internal/wrapAsync.js")),s=o(t("./internal/awaitify.js"));function o(t){return t&&t.__esModule?t:{default:t}}r.default=(0,s.default)((function(t,e,r,s){return(0,n.default)(e)(t,(0,i.default)(r),s)}),4),e.exports=r.default},{"./internal/awaitify.js":9,"./internal/eachOfLimit.js":11,"./internal/wrapAsync.js":19}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=s(t("./eachOfLimit.js")),i=s(t("./internal/awaitify.js"));function s(t){return t&&t.__esModule?t:{default:t}}r.default=(0,i.default)((function(t,e,r){return(0,n.default)(t,1,e,r)}),3),e.exports=r.default},{"./eachOfLimit.js":6,"./internal/awaitify.js":9}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e,r,n){let i=!1,o=!1,a=!1,u=0,l=0;function c(){u>=e||a||i||(a=!0,t.next().then((({value:t,done:e})=>{if(!o&&!i){if(a=!1,e)return i=!0,void(u<=0&&n(null));u++,r(t,l,h),l++,c()}})).catch(f))}function h(t,e){if(u-=1,!o)return t?f(t):!1===t?(i=!0,void(o=!0)):e===s.default||i&&u<=0?(i=!0,n(null)):void c()}function f(t){o||(a=!1,i=!0,n(t))}c()};var n,i=t("./breakLoop.js"),s=(n=i)&&n.__esModule?n:{default:n};e.exports=r.default},{"./breakLoop.js":10}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t,e=t.length){if(!e)throw new Error("arity is undefined");return function(...r){return"function"==typeof r[e-1]?t.apply(this,r):new Promise(((n,i)=>{r[e-1]=(t,...e)=>{if(t)return i(t);n(e.length>1?e:e[0])},t.apply(this,r)}))}},e.exports=r.default},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.default={},e.exports=r.default},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=l(t("./once.js")),i=l(t("./iterator.js")),s=l(t("./onlyOnce.js")),o=t("./wrapAsync.js"),a=l(t("./asyncEachOfLimit.js")),u=l(t("./breakLoop.js"));function l(t){return t&&t.__esModule?t:{default:t}}r.default=t=>(e,r,l)=>{if(l=(0,n.default)(l),t<=0)throw new RangeError("concurrency limit cannot be less than 1");if(!e)return l(null);if((0,o.isAsyncGenerator)(e))return(0,a.default)(e,t,r,l);if((0,o.isAsyncIterable)(e))return(0,a.default)(e[Symbol.asyncIterator](),t,r,l);var c=(0,i.default)(e),h=!1,f=!1,p=0,d=!1;function g(t,e){if(!f)if(p-=1,t)h=!0,l(t);else if(!1===t)h=!0,f=!0;else{if(e===u.default||h&&p<=0)return h=!0,l(null);d||y()}}function y(){for(d=!0;p<t&&!h;){var e=c();if(null===e)return h=!0,void(p<=0&&l(null));p+=1,r(e.value,e.key,(0,s.default)(g))}d=!1}y()},e.exports=r.default},{"./asyncEachOfLimit.js":8,"./breakLoop.js":10,"./iterator.js":15,"./once.js":16,"./onlyOnce.js":17,"./wrapAsync.js":19}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t[Symbol.iterator]&&t[Symbol.iterator]()},e.exports=r.default},{}],13:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){var r=e.pop();return t.call(this,e,r)}},e.exports=r.default},{}],14:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return t&&"number"==typeof t.length&&t.length>=0&&t.length%1==0},e.exports=r.default},{}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){if((0,n.default)(t))return function(t){var e=-1,r=t.length;return function(){return++e<r?{value:t[e],key:e}:null}}(t);var e=(0,i.default)(t);return e?function(t){var e=-1;return function(){var r=t.next();return r.done?null:(e++,{value:r.value,key:e})}}(e):(r=t,s=r?Object.keys(r):[],o=-1,a=s.length,function t(){var e=s[++o];return"__proto__"===e?t():o<a?{value:r[e],key:e}:null});var r,s,o,a};var n=s(t("./isArrayLike.js")),i=s(t("./getIterator.js"));function s(t){return t&&t.__esModule?t:{default:t}}e.exports=r.default},{"./getIterator.js":12,"./isArrayLike.js":14}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){function e(...e){if(null!==t){var r=t;t=null,r.apply(this,e)}}return Object.assign(e,t),e},e.exports=r.default},{}],17:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(t){return function(...e){if(null===t)throw new Error("Callback was already called.");var r=t;t=null,r.apply(this,e)}},e.exports=r.default},{}],18:[function(t,e,r){(function(t,e){(function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.fallback=a,r.wrap=u;var n,i=r.hasQueueMicrotask="function"==typeof queueMicrotask&&queueMicrotask,s=r.hasSetImmediate="function"==typeof e&&e,o=r.hasNextTick="object"==typeof t&&"function"==typeof t.nextTick;function a(t){setTimeout(t,0)}function u(t){return(e,...r)=>t((()=>e(...r)))}n=i?queueMicrotask:s?e:o?t.nextTick:a,r.default=u(n)}).call(this)}).call(this,t("_process"),t("timers").setImmediate)},{_process:52,timers:59}],19:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.isAsyncIterable=r.isAsyncGenerator=r.isAsync=void 0;var n,i=t("../asyncify.js"),s=(n=i)&&n.__esModule?n:{default:n};function o(t){return"AsyncFunction"===t[Symbol.toStringTag]}r.default=function(t){if("function"!=typeof t)throw new Error("expected a function");return o(t)?(0,s.default)(t):t},r.isAsync=o,r.isAsyncGenerator=function(t){return"AsyncGenerator"===t[Symbol.toStringTag]},r.isAsyncIterable=function(t){return"function"==typeof t[Symbol.asyncIterator]}},{"../asyncify.js":5}],20:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=a(t("./internal/once.js")),i=a(t("./internal/onlyOnce.js")),s=a(t("./internal/wrapAsync.js")),o=a(t("./internal/awaitify.js"));function a(t){return t&&t.__esModule?t:{default:t}}r.default=(0,o.default)((function(t,e){if(e=(0,n.default)(e),!Array.isArray(t))return e(new Error("First argument to waterfall must be an array of functions"));if(!t.length)return e();var r=0;function o(e){(0,s.default)(t[r++])(...e,(0,i.default)(a))}function a(n,...i){if(!1!==n)return n||r===t.length?e(n,...i):void o(i)}o([])})),e.exports=r.default},{"./internal/awaitify.js":9,"./internal/once.js":16,"./internal/onlyOnce.js":17,"./internal/wrapAsync.js":19}],21:[function(t,e,r){e.exports=
|
|
8
|
+
/**
|
|
9
|
+
* Base Logger Class
|
|
10
|
+
*
|
|
11
|
+
* @license MIT
|
|
12
|
+
*
|
|
13
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
14
|
+
*/
|
|
15
|
+
class{constructor(t,e){this._Settings=t,this.loggerUUID=this.generateInsecureUUID(),this.levels=["trace","debug","info","warn","error","fatal"]}generateInsecureUUID(){let t=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(e=>{let r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)}))}initialize(){}trace(t,e){this.write("trace",t,e)}debug(t,e){this.write("debug",t,e)}info(t,e){this.write("info",t,e)}warn(t,e){this.write("warn",t,e)}error(t,e){this.write("error",t,e)}fatal(t,e){this.write("fatal",t,e)}write(t,e,r){return!0}}},{}],22:[function(t,e,r){
|
|
16
|
+
/**
|
|
17
|
+
* Default Logger Provider Function
|
|
18
|
+
*
|
|
19
|
+
* @license MIT
|
|
20
|
+
*
|
|
21
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
22
|
+
*/
|
|
23
|
+
getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console.js"),e.default=e.console,e},e.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":24}],23:[function(t,e,r){e.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],24:[function(t,e,r){let n=t("./Fable-Log-BaseLogger.js");e.exports=class extends n{constructor(t,e){super(t),this._ShowTimeStamps=!!t.hasOwnProperty("showtimestamps")&&1==t.showtimestamps,this._FormattedTimeStamps=!!t.hasOwnProperty("formattedtimestamps")&&1==t.formattedtimestamps,this._ContextMessage=t.hasOwnProperty("Context")?`(${t.Context})`:e._Settings.hasOwnProperty("Product")?`(${e._Settings.Product})`:"Unnamed_Log_Context",this._OutputLogLinesToConsole=!t.hasOwnProperty("outputloglinestoconsole")||t.outputloglinestoconsole,this._OutputObjectsToConsole=!t.hasOwnProperty("outputobjectstoconsole")||t.outputobjectstoconsole,this.prefixCache={};for(let t=0;t<=this.levels.length;t++)this.prefixCache[this.levels[t]]=`[${this.levels[t]}] ${this._ContextMessage}: `,this._ShowTimeStamps&&(this.prefixCache[this.levels[t]]=" "+this.prefixCache[this.levels[t]])}write(t,e,r){let n="";this._ShowTimeStamps&&this._FormattedTimeStamps?n=(new Date).toISOString():this._ShowTimeStamps&&(n=+new Date);let i=`${n}${this.prefixCache[t]}${e}`;return this._OutputLogLinesToConsole&&console.log(i),this._OutputObjectsToConsole&&void 0!==r&&console.log(JSON.stringify(r,null,2)),i}}},{"./Fable-Log-BaseLogger.js":21}],25:[function(t,e,r){
|
|
24
|
+
/**
|
|
25
|
+
* Fable Logging Add-on
|
|
26
|
+
*
|
|
27
|
+
* @license MIT
|
|
28
|
+
*
|
|
29
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
30
|
+
* @module Fable Logger
|
|
31
|
+
*/
|
|
32
|
+
class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Providers=t("./Fable-Log-DefaultProviders-Node.js"),this._StreamDefinitions=n.hasOwnProperty("LogStreams")?n.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof n.Product?n.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,r)}debug(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,r)}info(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,r)}warn(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,r)}error(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,r)}fatal(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,r)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let r=void 0!==t?t:"Time",n=new Date;this.info(`${r} ${n} (epoch ${+n})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,r){let n=void 0!==e?e:"Time Measurement",i=+new Date;this.info(`${n} logged at (epoch ${+i}) took (${t}ms)`,r)}logTimeDeltaHuman(t,e,r){let n=void 0!==e?e:"Time Measurement",i=+new Date,s=parseInt(t%1e3),o=parseInt(t/1e3%60),a=parseInt(t/6e4%60),u=parseInt(t/36e5);s=s<10?"00"+s:s<100?"0"+s:s,o=o<10?"0"+o:o,a=a<10?"0"+a:a,u=u<10?"0"+u:u,this.info(`${n} logged at (epoch ${+i}) took (${t}ms) or (${u}:${a}:${o}.${s})`,r)}logTimeDeltaRelative(t,e,r){this.logTimeDelta(this.getTimeDelta(t),e,r)}logTimeDeltaRelativeHuman(t,e,r){this.logTimeDeltaHuman(this.getTimeDelta(t),e,r)}}e.exports={new:function(t){return new n(t)},FableLog:n}},{"./Fable-Log-DefaultProviders-Node.js":22,"./Fable-Log-DefaultStreams.json":23}],26:[function(t,e,r){e.exports={Product:"ApplicationNameHere",ProductVersion:"0.0.0",ConfigFile:!1,LogStreams:[{level:"trace"}]}},{}],27:[function(t,e,r){(function(t){(function(){e.exports=
|
|
33
|
+
/**
|
|
34
|
+
* Fable Settings Template Processor
|
|
35
|
+
*
|
|
36
|
+
* This class allows environment variables to come in via templated expressions, and defaults to be set.
|
|
37
|
+
*
|
|
38
|
+
* @license MIT
|
|
39
|
+
*
|
|
40
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
41
|
+
* @module Fable Settings
|
|
42
|
+
*/
|
|
43
|
+
class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcessor.addPattern("${","}",(e=>{let r=e.trim(),n=r.indexOf("|"),i=r.substring(n+1),s=n>-1?r.substring(0,n):r;return t.env.hasOwnProperty(s)?t.env[s]:i}))}parseSetting(t){return this.templateProcessor.parseString(t)}}}).call(this)}).call(this,t("_process"))},{_process:52}],28:[function(t,e,r){
|
|
44
|
+
/**
|
|
45
|
+
* Fable Settings Add-on
|
|
46
|
+
*
|
|
47
|
+
* @license MIT
|
|
48
|
+
*
|
|
49
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
50
|
+
* @module Fable Settings
|
|
51
|
+
*/
|
|
52
|
+
const n=t("precedent"),i=t("./Fable-Settings-TemplateProcessor.js");class s{constructor(e){this.dependencies={precedent:n},this.settingsTemplateProcessor=new i(this.dependencies),this._configureEnvTemplating(e),this.default=this.buildDefaultSettings();let r=this.merge(e,this.buildDefaultSettings());if(this.base=JSON.parse(JSON.stringify(r)),r.DefaultConfigFile)try{r=this.merge(t(r.DefaultConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}if(r.ConfigFile)try{r=this.merge(t(r.ConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}this.settings=r}buildDefaultSettings(){return JSON.parse(JSON.stringify(t("./Fable-Settings-Default")))}_configureEnvTemplating(t){this._PerformEnvTemplating=!t||!0!==t.NoEnvReplacement}_resolveEnv(t){for(const e in t)"object"==typeof t[e]?this._resolveEnv(t[e]):"string"==typeof t[e]&&(t[e]=this.settingsTemplateProcessor.parseSetting(t[e]))}_isObject(t){return"object"==typeof t&&!Array.isArray(t)}_deepMergeObjects(t,e){if(e&&this._isObject(e))return Object.keys(e).forEach((r=>{const n=e[r];if(this._isObject(n)){const e=t[r];if(e&&this._isObject(e))return void this._deepMergeObjects(e,n)}t[r]=n})),t}merge(t,e){let r="object"==typeof t?t:{},n="object"==typeof e?e:this.settings,i=JSON.parse(JSON.stringify(r));return n=this._deepMergeObjects(n,i),this._PerformEnvTemplating&&this._resolveEnv(n),this._configureEnvTemplating(n),n}fill(t){let e="object"==typeof t?t:{},r=JSON.parse(JSON.stringify(e));return this.settings=this._deepMergeObjects(r,this.settings),this.settings}}e.exports={new:function(t){return new s(t)},FableSettings:s}},{"./Fable-Settings-Default":26,"./Fable-Settings-TemplateProcessor.js":27,precedent:49}],29:[function(t,e,r){e.exports=
|
|
53
|
+
/**
|
|
54
|
+
* Random Byte Generator - Browser version
|
|
55
|
+
*
|
|
56
|
+
* @license MIT
|
|
57
|
+
*
|
|
58
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
59
|
+
*/
|
|
60
|
+
class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let t=new Uint8Array(16);return this.getRandomValues(t),t}generateRandomBytes(){let t=new Uint8Array(16);for(let e,r=0;r<16;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=e>>>((3&r)<<3)&255;return t}generate(){return this.getRandomValues?this.generateWhatWGBytes():this.generateRandomBytes()}}},{}],30:[function(t,e,r){
|
|
61
|
+
/**
|
|
62
|
+
* Fable UUID Generator
|
|
63
|
+
*
|
|
64
|
+
* @license MIT
|
|
65
|
+
*
|
|
66
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
67
|
+
* @module Fable UUID
|
|
68
|
+
*/
|
|
69
|
+
var n=t("./Fable-UUID-Random.js");class i{constructor(t){this._UUIDModeRandom=!("object"!=typeof t||!t.hasOwnProperty("UUIDModeRandom"))&&1==t.UUIDModeRandom,this._UUIDLength="object"==typeof t&&t.hasOwnProperty("UUIDLength")?t.UUIDLength+0:8,this._UUIDRandomDictionary="object"==typeof t&&t.hasOwnProperty("UUIDDictionary")?t.UUIDDictionary+0:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.randomByteGenerator=new n,this._HexLookup=[];for(let t=0;t<256;++t)this._HexLookup[t]=(t+256).toString(16).substr(1)}bytesToUUID(t){let e=0;return[this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]]].join("")}generateUUIDv4(){new Array(16);var t=this.randomByteGenerator.generate();return t[6]=15&t[6]|64,t[8]=63&t[8]|128,this.bytesToUUID(t)}generateRandom(){let t="";for(let e=0;e<this._UUIDLength;e++)t+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));return t}getUUID(){return this._UUIDModeRandom?this.generateRandom():this.generateUUIDv4()}}e.exports={new:function(t){return new i(t)},FableUUID:i}},{"./Fable-UUID-Random.js":29}],31:[function(t,e,r){
|
|
70
|
+
/**
|
|
71
|
+
* @license MIT
|
|
72
|
+
* @author <steven@velozo.com>
|
|
73
|
+
*/
|
|
74
|
+
const n=t("fable-settings").FableSettings,i=t("fable-uuid").FableUUID,s=t("fable-log").FableLog;class o{constructor(t){let e=new n(t);this.settingsManager=e,this.libUUID=new i(this.settingsManager.settings),this.log=new s(this.settingsManager.settings),this.log.initialize()}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}}e.exports=o},{"fable-log":25,"fable-settings":28,"fable-uuid":30}],32:[function(t,e,r){"use strict";var n=12,i=0,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,7,7,7,7,7,7,7,7,7,7,7,7,8,7,7,10,9,9,9,11,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,0,24,36,48,60,72,84,96,0,12,12,12,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,0,0,0,0,0,0,24,24,24,0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,48,48,48,0,0,0,0,0,0,0,0,0,0,48,48,0,0,0,0,0,0,0,0,0,48,0,0,0,0,0,0,0,0,0,0,127,63,63,63,0,31,15,15,15,7,7,7];var o={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};function a(t,e){var r=o[t];return void 0===r?255:r<<e}e.exports=function(t){var e=t.indexOf("%");if(-1===e)return t;for(var r=t.length,o="",u=0,l=0,c=e,h=n;e>-1&&e<r;){var f=a(t[e+1],4)|a(t[e+2],0),p=s[f];if(h=s[256+h+p],l=l<<6|f&s[364+p],h!==n){if(h===i)return null;if((e+=3)<r&&37===t.charCodeAt(e))continue;return null}o+=t.slice(u,c),o+=l<=65535?String.fromCharCode(l):String.fromCharCode(55232+(l>>10),56320+(1023&l)),l=0,u=e+3,e=c=t.indexOf("%",u)}return o+t.slice(u)}},{}],33:[function(t,e,r){"use strict";e.exports=function t(e,r){if(e===r)return!0;if(e&&r&&"object"==typeof e&&"object"==typeof r){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if((n=e.length)!=r.length)return!1;for(i=n;0!=i--;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if((n=(s=Object.keys(e)).length)!==Object.keys(r).length)return!1;for(i=n;0!=i--;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;0!=i--;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!=e&&r!=r}},{}],34:[function(t,e,r){"use strict";const n=t("./parse"),i=t("./stringify"),s={parse:n,stringify:i};e.exports=s,e.exports.default=s,e.exports.parse=n,e.exports.stringify=i},{"./parse":36,"./stringify":37}],35:[function(t,e,r){const n=Array.from({length:256},((t,e)=>"%"+((e<16?"0":"")+e.toString(16)).toUpperCase())),i=new Int8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,0]);e.exports={encodeString:function(t){const e=t.length;if(0===e)return"";let r="",s=0,o=0;t:for(;o<e;o++){let a=t.charCodeAt(o);for(;a<128;){if(1!==i[a]&&(s<o&&(r+=t.slice(s,o)),s=o+1,r+=n[a]),++o===e)break t;a=t.charCodeAt(o)}if(s<o&&(r+=t.slice(s,o)),a<2048){s=o+1,r+=n[192|a>>6]+n[128|63&a];continue}if(a<55296||a>=57344){s=o+1,r+=n[224|a>>12]+n[128|a>>6&63]+n[128|63&a];continue}if(++o,o>=e)throw new Error("URI malformed");s=o+1,a=65536+((1023&a)<<10|1023&t.charCodeAt(o)),r+=n[240|a>>18]+n[128|a>>12&63]+n[128|a>>6&63]+n[128|63&a]}return 0===s?t:s<e?r+t.slice(s):r}}},{}],36:[function(t,e,r){"use strict";const n=t("fast-decode-uri-component"),i=/\+/g,s=function(){};s.prototype=Object.create(null),e.exports=function(t){const e=new s;if("string"!=typeof t)return e;let r=t.length,o="",a="",u=-1,l=-1,c=!1,h=!1,f=!1,p=!1,d=!1,g=0;for(let s=0;s<r+1;s++)if(g=s!==r?t.charCodeAt(s):38,38===g){if(d=l>u,d||(l=s),o=t.slice(u+1,l),d||o.length>0){f&&(o=o.replace(i," ")),c&&(o=n(o)||o),d&&(a=t.slice(l+1,s),p&&(a=a.replace(i," ")),h&&(a=n(a)||a));const r=e[o];void 0===r?e[o]=a:r.pop?r.push(a):e[o]=[r,a]}a="",u=s,l=s,c=!1,h=!1,f=!1,p=!1}else 61===g?l<=u?l=s:h=!0:43===g?l>u?p=!0:f=!0:37===g&&(l>u?h=!0:c=!0);return e}},{"fast-decode-uri-component":32}],37:[function(t,e,r){"use strict";const{encodeString:n}=t("./internals/querystring");function i(t){const e=typeof t;return"string"===e?n(t):"bigint"===e?t.toString():"boolean"===e?t?"true":"false":"number"===e&&Number.isFinite(t)?t<1e21?""+t:n(""+t):""}e.exports=function(t){let e="";if(null===t||"object"!=typeof t)return e;const r=Object.keys(t),s=r.length;let o=0;for(let a=0;a<s;a++){const s=r[a],u=t[s],l=n(s)+"=";if(a&&(e+="&"),Array.isArray(u)){o=u.length;for(let t=0;t<o;t++)t&&(e+="&"),e+=l,e+=i(u[t])}else e+=l,e+=i(u)}return e}},{"./internals/querystring":35}],38:[function(t,e,r){"use strict";const n=t("./handler_storage"),i={STATIC:0,PARAMETRIC:1,WILDCARD:2};class s{constructor(){this.handlerStorage=new n}}class o extends s{constructor(){super(),this.staticChildren={}}findStaticMatchingChild(t,e){const r=this.staticChildren[t.charAt(e)];return void 0!==r&&r.matchPrefix(t,e)?r:null}createStaticChild(t){if(0===t.length)return this;let e=this.staticChildren[t.charAt(0)];if(e){let r=1;for(;r<e.prefix.length;r++)if(t.charCodeAt(r)!==e.prefix.charCodeAt(r)){e=e.split(this,r);break}return e.createStaticChild(t.slice(r))}const r=t.charAt(0);return this.staticChildren[r]=new a(t),this.staticChildren[r]}}class a extends o{constructor(t){super(),this.prefix=t,this.wildcardChild=null,this.parametricChildren=[],this.kind=i.STATIC,this._compilePrefixMatch()}createParametricChild(t,e){const r=t&&t.source;let n=this.parametricChildren.find((t=>(t.regex&&t.regex.source)===r));return n||(n=new u(t,e),this.parametricChildren.push(n),this.parametricChildren.sort(((t,e)=>t.isRegex?e.isRegex?null===t.staticSuffix?1:null===e.staticSuffix?-1:e.staticSuffix.endsWith(t.staticSuffix)?1:t.staticSuffix.endsWith(e.staticSuffix)?-1:0:-1:1)),n)}createWildcardChild(){return this.wildcardChild||(this.wildcardChild=new l),this.wildcardChild}split(t,e){const r=this.prefix.slice(0,e),n=this.prefix.slice(e);this.prefix=n,this._compilePrefixMatch();const i=new a(r);return i.staticChildren[n.charAt(0)]=this,t.staticChildren[r.charAt(0)]=i,i}getNextNode(t,e,r,n){let i=this.findStaticMatchingChild(t,e),s=0;if(null===i){if(0===this.parametricChildren.length)return this.wildcardChild;i=this.parametricChildren[0],s=1}null!==this.wildcardChild&&r.push({paramsCount:n,brotherPathIndex:e,brotherNode:this.wildcardChild});for(let t=this.parametricChildren.length-1;t>=s;t--)r.push({paramsCount:n,brotherPathIndex:e,brotherNode:this.parametricChildren[t]});return i}_compilePrefixMatch(){if(1===this.prefix.length)return void(this.matchPrefix=()=>!0);const t=[];for(let e=1;e<this.prefix.length;e++){const r=this.prefix.charCodeAt(e);t.push(`path.charCodeAt(i + ${e}) === ${r}`)}this.matchPrefix=new Function("path","i",`return ${t.join(" && ")}`)}}class u extends o{constructor(t,e){super(),this.isRegex=!!t,this.regex=t||null,this.staticSuffix=e||null,this.kind=i.PARAMETRIC}getNextNode(t,e){return this.findStaticMatchingChild(t,e)}}class l extends s{constructor(){super(),this.kind=i.WILDCARD}getNextNode(){return null}}e.exports={StaticNode:a,ParametricNode:u,WildcardNode:l,NODE_TYPES:i}},{"./handler_storage":39}],39:[function(t,e,r){"use strict";e.exports=class{constructor(){this.unconstrainedHandler=null,this.constraints=[],this.handlers=[],this.constrainedHandlerStores=null}getMatchingHandler(t){return void 0===t?this.unconstrainedHandler:this._getHandlerMatchingConstraints(t)}addHandler(t,e,r,n,i){const s={handler:t,params:e,constraints:i,store:r||null,_createParamsObject:this._compileCreateParamsObject(e)};0===Object.keys(i).length&&(this.unconstrainedHandler=s);for(const t of Object.keys(i))this.constraints.includes(t)||("version"===t?this.constraints.unshift(t):this.constraints.push(t));if(this.handlers.length>=32)throw new Error("find-my-way supports a maximum of 32 route handlers per node when there are constraints, limit reached");this.handlers.push(s),this.handlers.sort(((t,e)=>Object.keys(t.constraints).length-Object.keys(e.constraints).length)),this._compileGetHandlerMatchingConstraints(n,i)}_compileCreateParamsObject(t){const e=[];for(let r=0;r<t.length;r++)e.push(`'${t[r]}': paramsArray[${r}]`);return new Function("paramsArray",`return {${e.join(",")}}`)}_getHandlerMatchingConstraints(){return null}_buildConstraintStore(t,e){for(let r=0;r<this.handlers.length;r++){const n=this.handlers[r].constraints[e];if(void 0!==n){let e=t.get(n)||0;e|=1<<r,t.set(n,e)}}}_constrainedIndexBitmask(t){let e=0;for(let r=0;r<this.handlers.length;r++){void 0!==this.handlers[r].constraints[t]&&(e|=1<<r)}return~e}_compileGetHandlerMatchingConstraints(t){this.constrainedHandlerStores={};for(const e of this.constraints){const r=t.newStoreForConstraint(e);this.constrainedHandlerStores[e]=r,this._buildConstraintStore(r,e)}const e=[];e.push(`\n let candidates = ${(1<<this.handlers.length)-1}\n let mask, matches\n `);for(const r of this.constraints){e.push(`\n mask = ${this._constrainedIndexBitmask(r)}\n value = derivedConstraints.${r}\n `);const n=t.strategies[r].mustMatchWhenDerived?"matches":"(matches | mask)";e.push(`\n if (value === undefined) {\n candidates &= mask\n } else {\n matches = this.constrainedHandlerStores.${r}.get(value) || 0\n candidates &= ${n}\n }\n if (candidates === 0) return null;\n `)}for(const r in t.strategies){t.strategies[r].mustMatchWhenDerived&&!this.constraints.includes(r)&&e.push(`if (derivedConstraints.${r} !== undefined) return null`)}e.push("return this.handlers[Math.floor(Math.log2(candidates))]"),this._getHandlerMatchingConstraints=new Function("derivedConstraints",e.join("\n"))}}},{}],40:[function(t,e,r){"use strict";const n=t("assert"),i=t("fast-querystring"),s=t("safe-regex2"),o=t("fast-deep-equal"),{flattenNode:a,compressFlattenedNode:u,prettyPrintFlattenedNode:l,prettyPrintRoutesArray:c}=t("./lib/pretty-print"),{StaticNode:h,NODE_TYPES:f}=t("./custom_node"),p=t("./lib/constrainer"),d=t("./lib/http-methods"),{safeDecodeURI:g,safeDecodeURIComponent:y}=t("./lib/url-sanitizer"),m=/^https?:\/\/.*?\//,v=/(\/:[^/()]*?)\?(\/?)/;if(!s(m))throw new Error("the FULL_PATH_REGEXP is not safe, update this module");if(!s(v))throw new Error("the OPTIONAL_PARAM_REGEXP is not safe, update this module");function b(t){if(!(this instanceof b))return new b(t);(t=t||{}).defaultRoute?(n("function"==typeof t.defaultRoute,"The default route must be a function"),this.defaultRoute=t.defaultRoute):this.defaultRoute=null,t.onBadUrl?(n("function"==typeof t.onBadUrl,"The bad url handler must be a function"),this.onBadUrl=t.onBadUrl):this.onBadUrl=null,t.buildPrettyMeta?(n("function"==typeof t.buildPrettyMeta,"buildPrettyMeta must be a function"),this.buildPrettyMeta=t.buildPrettyMeta):this.buildPrettyMeta=C,t.querystringParser?(n("function"==typeof t.querystringParser,"querystringParser must be a function"),this.querystringParser=t.querystringParser):this.querystringParser=t=>""===t?{}:i.parse(t),this.caseSensitive=void 0===t.caseSensitive||t.caseSensitive,this.ignoreTrailingSlash=t.ignoreTrailingSlash||!1,this.ignoreDuplicateSlashes=t.ignoreDuplicateSlashes||!1,this.maxParamLength=t.maxParamLength||100,this.allowUnsafeRegex=t.allowUnsafeRegex||!1,this.routes=[],this.trees={},this.constrainer=new p(t.constraints),this._routesPatterns={}}for(var S in b.prototype.on=function(t,e,r,i,s){"function"==typeof r&&(void 0!==i&&(s=i),i=r,r={}),n("string"==typeof e,"Path should be a string"),n(e.length>0,"The path could not be empty"),n("/"===e[0]||"*"===e[0],"The first character of a path should be `/` or `*`"),n("function"==typeof i,"Handler should be a function");const o=e.match(v);if(o){n(e.length===o.index+o[0].length,"Optional Parameter needs to be the last parameter of the path");const a=e.replace(v,"$1$2"),u=e.replace(v,"$2");return this.on(t,a,r,i,s),void this.on(t,u,r,i,s)}const a=e;this.ignoreDuplicateSlashes&&(e=w(e)),this.ignoreTrailingSlash&&(e=x(e));const u=Array.isArray(t)?t:[t];for(const t of u)this._on(t,e,r,i,s,a),this.routes.push({method:t,path:e,opts:r,handler:i,store:s})},b.prototype._on=function(t,e,r,i,a){n("string"==typeof t,"Method should be a string"),n(d.includes(t),`Method '${t}' is not an http method.`);let u={};if(void 0!==r.constraints&&(n("object"==typeof r.constraints&&null!==r.constraints,"Constraints should be an object"),0!==Object.keys(r.constraints).length&&(u=r.constraints)),this.constrainer.validateConstraints(u),this.constrainer.noteUsage(u),void 0===this.trees[t]&&(this.trees[t]=new h("/"),this._routesPatterns[t]=[]),"*"===e&&0!==this.trees[t].prefix.length){const e=this.trees[t];this.trees[t]=new h(""),this.trees[t].staticChildren["/"]=e}let l=this.trees[t],c=l.prefix.length;const f=[];for(let t=0;t<=e.length;t++){if(58===e.charCodeAt(t)&&58===e.charCodeAt(t+1)){t++;continue}const r=58===e.charCodeAt(t)&&58!==e.charCodeAt(t+1),i=42===e.charCodeAt(t);if(r||i||t===e.length&&t!==c){let r=e.slice(c,t);this.caseSensitive||(r=r.toLowerCase()),r=r.split("::").join(":"),r=r.split("%").join("%25"),l=l.createStaticChild(r)}if(r){let r=!1;const i=[];let o=t+1;for(let a=o;;a++){const u=e.charCodeAt(a),h=40===u,p=45===u||46===u,d=47===u||a===e.length;if(h||p||d){const u=e.slice(o,a);if(f.push(u),r=r||h||p,h){const t=O(e,a),r=e.slice(a,t+1);this.allowUnsafeRegex||n(s(new RegExp(r)),`The regex '${r}' is not safe!`),i.push(P(r)),a=t+1}else i.push("(.*?)");const g=a;for(;a<e.length;a++){const t=e.charCodeAt(a);if(47===t)break;if(58===t){if(58!==e.charCodeAt(a+1))break;a++}}let y=e.slice(g,a);if(y&&(y=y.split("::").join(":"),y=y.split("%").join("%25"),i.push(y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"))),o=a+1,d||47===e.charCodeAt(a)||a===e.length){const n=r?"()"+y:y;e=e.slice(0,t+1)+n+e.slice(a),t+=n.length;const s=r?new RegExp("^"+i.join("")+"$"):null;l=l.createParametricChild(s,y||null),c=t+1;break}}}}else if(i&&(f.push("*"),l=l.createWildcardChild(),c=t+1,t!==e.length-1))throw new Error("Wildcard must be the last character in the route")}this.caseSensitive||(e=e.toLowerCase()),"*"===e&&(e="/*");for(const r of this._routesPatterns[t])if(r.path===e&&o(r.constraints,u))throw new Error(`Method '${t}' already declared for route '${e}' with constraints '${JSON.stringify(u)}'`);this._routesPatterns[t].push({path:e,params:f,constraints:u}),l.handlerStorage.addHandler(i,f,a,this.constrainer,u)},b.prototype.hasConstraintStrategy=function(t){return this.constrainer.hasConstraintStrategy(t)},b.prototype.addConstraintStrategy=function(t){this.constrainer.addConstraintStrategy(t),this._rebuild(this.routes)},b.prototype.reset=function(){this.trees={},this.routes=[],this._routesPatterns={}},b.prototype.off=function(t,e,r){n("string"==typeof e,"Path should be a string"),n(e.length>0,"The path could not be empty"),n("/"===e[0]||"*"===e[0],"The first character of a path should be `/` or `*`"),n(void 0===r||"object"==typeof r&&!Array.isArray(r)&&null!==r,"Constraints should be an object or undefined.");const i=e.match(v);if(i){n(e.length===i.index+i[0].length,"Optional Parameter needs to be the last parameter of the path");const s=e.replace(v,"$1$2"),o=e.replace(v,"$2");return this.off(t,s,r),void this.off(t,o,r)}this.ignoreDuplicateSlashes&&(e=w(e)),this.ignoreTrailingSlash&&(e=x(e));const s=Array.isArray(t)?t:[t];for(const t of s)this._off(t,e,r)},b.prototype._off=function(t,e,r){function i(r){return t!==r.method||e!==r.path}n("string"==typeof t,"Method should be a string"),n(d.includes(t),`Method '${t}' is not an http method.`);const s=r?function(t){return i(t)||!o(r,t.opts.constraints||{})}:i,a=this.routes.filter(s);this._rebuild(a)},b.prototype.lookup=function(t,e,r,n){if("function"==typeof r&&(n=r,r=void 0),void 0===n){const n=this.constrainer.deriveConstraints(t,r),i=this.find(t.method,t.url,n);return this.callHandler(i,t,e,r)}this.constrainer.deriveConstraints(t,r,((i,s)=>{if(null===i)try{const i=this.find(t.method,t.url,s),o=this.callHandler(i,t,e,r);n(null,o)}catch(i){n(i)}else n(i)}))},b.prototype.callHandler=function(t,e,r,n){return null===t?this._defaultRoute(e,r,n):void 0===n?t.handler(e,r,t.params,t.store,t.searchParams):t.handler.call(n,e,r,t.params,t.store,t.searchParams)},b.prototype.find=function(t,e,r){let n,i,s,o=this.trees[t];if(void 0===o)return null;47!==e.charCodeAt(0)&&(e=e.replace(m,"/")),this.ignoreDuplicateSlashes&&(e=w(e));try{n=g(e),e=n.path,i=n.querystring,s=n.shouldDecodeParam}catch(t){return this._onBadUrl(e)}this.ignoreTrailingSlash&&(e=x(e));const a=e;!1===this.caseSensitive&&(e=e.toLowerCase());const u=this.maxParamLength;let l=o.prefix.length;const c=[],h=e.length,p=[];for(;;){if(l===h){const t=o.handlerStorage.getMatchingHandler(r);if(null!==t)return{handler:t.handler,store:t.store,params:t._createParamsObject(c),searchParams:this.querystringParser(i)}}let t=o.getNextNode(e,l,p,c.length);if(null===t){if(0===p.length)return null;const e=p.pop();l=e.brotherPathIndex,c.splice(e.paramsCount),t=e.brotherNode}if(o=t,o.kind!==f.STATIC)if(o.kind!==f.WILDCARD){if(o.kind===f.PARAMETRIC){let t=a.indexOf("/",l);-1===t&&(t=h);let e=a.slice(l,t);if(s&&(e=y(e)),o.isRegex){const t=o.regex.exec(e);if(null===t)continue;for(let e=1;e<t.length;e++){const r=t[e];if(r.length>u)return null;c.push(r)}}else{if(e.length>u)return null;c.push(e)}l=t}}else{let t=a.slice(l);s&&(t=y(t)),c.push(t),l=h}else l+=o.prefix.length}},b.prototype._rebuild=function(t){this.reset();for(const e of t){const{method:t,path:r,opts:n,handler:i,store:s}=e;this._on(t,r,n,i,s),this.routes.push({method:t,path:r,opts:n,handler:i,store:s})}},b.prototype._defaultRoute=function(t,e,r){if(null!==this.defaultRoute)return void 0===r?this.defaultRoute(t,e):this.defaultRoute.call(r,t,e);e.statusCode=404,e.end()},b.prototype._onBadUrl=function(t){if(null===this.onBadUrl)return null;const e=this.onBadUrl;return{handler:(r,n,i)=>e(t,r,n),params:{},store:null}},b.prototype.prettyPrint=function(t={}){if(t.commonPrefix=void 0===t.commonPrefix||t.commonPrefix,!t.commonPrefix)return c.call(this,this.routes,t);const e={prefix:"/",nodes:[],children:{}};for(const t in this.trees){const r=this.trees[t];r&&a(e,r,t)}return u(e),l.call(this,e,"",!0,t)},d){if(!d.hasOwnProperty(S))continue;const t=d[S],e=t.toLowerCase();if(b.prototype[e])throw new Error("Method already exists: "+e);b.prototype[e]=function(e,r,n){return this.on(t,e,r,n)}}function w(t){return t.replace(/\/\/+/g,"/")}function x(t){return t.length>1&&47===t.charCodeAt(t.length-1)?t.slice(0,-1):t}function P(t){return 94===t.charCodeAt(1)&&(t=t.slice(0,1)+t.slice(2)),36===t.charCodeAt(t.length-2)&&(t=t.slice(0,t.length-2)+t.slice(t.length-1)),t}function O(t,e){for(var r=1;e<t.length;)if("\\"!==t[++e]){if(")"===t[e]?r--:"("===t[e]&&r++,!r)return e}else e++;throw new TypeError('Invalid regexp expression in "'+t+'"')}function C(t){return t&&t.store?Object.assign({},t.store):{}}b.prototype.all=function(t,e,r){this.on(d,t,e,r)},e.exports=b},{"./custom_node":38,"./lib/constrainer":41,"./lib/http-methods":42,"./lib/pretty-print":43,"./lib/url-sanitizer":46,assert:1,"fast-deep-equal":33,"fast-querystring":34,"safe-regex2":53}],41:[function(t,e,r){"use strict";const n=t("./strategies/accept-version"),i=t("./strategies/accept-host"),s=t("assert");e.exports=class{constructor(t){if(this.strategies={version:n,host:i},this.strategiesInUse=new Set,this.asyncStrategiesInUse=new Set,t)for(const e of Object.values(t))this.addConstraintStrategy(e)}isStrategyUsed(t){return this.strategiesInUse.has(t)||this.asyncStrategiesInUse.has(t)}hasConstraintStrategy(t){const e=this.strategies[t];return void 0!==e&&(e.isCustom||this.isStrategyUsed(t))}addConstraintStrategy(t){if(s("string"==typeof t.name&&""!==t.name,"strategy.name is required."),s(t.storage&&"function"==typeof t.storage,"strategy.storage function is required."),s(t.deriveConstraint&&"function"==typeof t.deriveConstraint,"strategy.deriveConstraint function is required."),this.strategies[t.name]&&this.strategies[t.name].isCustom)throw new Error(`There already exists a custom constraint with the name ${t.name}.`);if(this.isStrategyUsed(t.name))throw new Error(`There already exists a route with ${t.name} constraint.`);t.isCustom=!0,t.isAsync=3===t.deriveConstraint.length,this.strategies[t.name]=t,t.mustMatchWhenDerived&&this.noteUsage({[t.name]:t})}deriveConstraints(t,e,r){const n=this.deriveSyncConstraints(t,e);if(void 0===r)return n;this.deriveAsyncConstraints(n,t,e,r)}deriveSyncConstraints(t,e){}noteUsage(t){if(t){const e=this.strategiesInUse.size;for(const e in t){this.strategies[e].isAsync?this.asyncStrategiesInUse.add(e):this.strategiesInUse.add(e)}e!==this.strategiesInUse.size&&this._buildDeriveConstraints()}}newStoreForConstraint(t){if(!this.strategies[t])throw new Error(`No strategy registered for constraint key ${t}`);return this.strategies[t].storage()}validateConstraints(t){for(const e in t){const r=t[e];if(void 0===r)throw new Error("Can't pass an undefined constraint value, must pass null or no key at all");const n=this.strategies[e];if(!n)throw new Error(`No strategy registered for constraint key ${e}`);n.validate&&n.validate(r)}}deriveAsyncConstraints(t,e,r,n){let i=this.asyncStrategiesInUse.size;if(0!==i){t=t||{};for(const s of this.asyncStrategiesInUse){this.strategies[s].deriveConstraint(e,r,((e,r)=>{null===e?(t[s]=r,0==--i&&n(null,t)):n(e)}))}}else n(null,t)}_buildDeriveConstraints(){if(0===this.strategiesInUse.size)return;const t=["return {"];for(const e of this.strategiesInUse){const r=this.strategies[e];if(r.isCustom)t.push(` ${r.name}: this.strategies.${e}.deriveConstraint(req, ctx),`);else if("version"===e)t.push(" version: req.headers['accept-version'],");else{if("host"!==e)throw new Error("unknown non-custom strategy for compiling constraint derivation function");t.push(" host: req.headers.host || req.headers[':authority'],")}}t.push("}"),this.deriveSyncConstraints=new Function("req","ctx",t.join("\n")).bind(this)}}},{"./strategies/accept-host":44,"./strategies/accept-version":45,assert:1}],42:[function(t,e,r){"use strict";e.exports=["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"]},{}],43:[function(t,e,r){"use strict";const n=" ",i="│ ",s="├── ",o="└── ",a="*",u="/",l=/(?=\/)/;function c(t){return Array.isArray(t)?t.map((t=>c(t))):"symbol"==typeof t?t.toString():"function"==typeof t?function(t){let e=t.name||"";return e=e.replace("bound","").trim(),e=(e||"anonymous")+"()",e}(t):t}function h(t,e){const r={},n=this.buildPrettyMeta(t);return Array.isArray(e)||(e=n?Reflect.ownKeys(n):[]),e.forEach((t=>{const e="symbol"==typeof t?t.toString():t;n&&n[t]&&(r[e]=c(n[t]))})),r}function f(t,e,r,a,u){let l="";if(a||u||(l+="\n"),a||(l+=`${e||""}${r?o:s}`),l+=`${t.path}`,t.handlers){const s=t.handlers.reduce(((t,e)=>{const r=t.findIndex((t=>JSON.stringify(t.opts)===JSON.stringify(e.opts)));return-1!==r?t[r].method=[t[r].method,e.method].join(", "):t.push(e),t}),[]);s.forEach(((o,u)=>{u>0&&(l+=`${a?"":e||""}${r?n:i}${t.path}`),l+=` (${o.method||"-"})`,o.opts&&"{}"!==JSON.stringify(o.opts)&&(l+=` ${JSON.stringify(o.opts)}`),o.meta&&Reflect.ownKeys(o.meta).forEach(((t,s)=>{l+=`\n${a?"":e||""}${r?n:i}`,l+=`• (${t}) ${JSON.stringify(o.meta[t])}`})),s.length>1&&u!==s.length-1&&(l+="\n")}))}else t.children.length>1&&(l+=" (-)");return a||(e=`${e||""}${r?n:i}`),t.children.forEach(((r,n)=>{const i=n===t.children.length-1,s=!t.handlers&&1===t.children.length;l+=f(r,e,i,s)})),l}e.exports={flattenNode:function t(e,r,n){if(0!==r.handlerStorage.handlers.length&&e.nodes.push({method:n,node:r}),r.parametricChildren&&r.parametricChildren[0]&&(e.children[":"]||(e.children[":"]={prefix:":",nodes:[],children:{}}),t(e.children[":"],r.parametricChildren[0],n)),r.wildcardChild&&(e.children["*"]||(e.children["*"]={prefix:"*",nodes:[],children:{}}),t(e.children["*"],r.wildcardChild,n)),r.staticChildren)for(const i of Object.values(r.staticChildren)){const r=i.prefix.split(l);let s,o=e;for(const t of r)s=o,o=o.children[t],o||(o={prefix:t,nodes:[],children:{}},s.children[t]=o);t(o,i,n)}},compressFlattenedNode:function t(e){const r=Object.keys(e.children);if(0===e.nodes.length&&1===r.length){const n=e.children[r[0]];if(n.nodes.length<=1)return t(n),e.nodes=n.nodes,e.prefix+=n.prefix,e.children=n.children,e}for(const r of Object.keys(e.children))t(e.children[r]);return e},prettyPrintFlattenedNode:function t(e,r,a,u){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");u.includeMeta=u.includeMeta||null;let l="";const c=[];for(const{node:t,method:r}of e.nodes)for(const e of t.handlerStorage.handlers)c.push({method:r,...e});c.length?c.forEach(((t,s)=>{let o=`(${t.method||"-"})`;Object.keys(t.constraints).length>0&&(o+=" "+JSON.stringify(t.constraints));let c="";const f=e.prefix.split("").map(((t,e)=>":"===t?e:null)).filter((t=>null!==t));if(f.length){let r=0;f.forEach(((n,i)=>{c+=e.prefix.slice(r,n+1),c+=t.params[t.params.length-f.length+i],i===f.length-1&&(c+=e.prefix.slice(n+1)),r=n+1}))}else c=e.prefix;if(l+=0===s?`${c} ${o}`:`\n${r}${a?n:i}${c} ${o}`,u.includeMeta){const e=h.call(this,t,u.includeMeta);Object.keys(e).forEach(((t,s)=>{l+=`\n${r||""}${a?n:i}`,l+=`• (${t}) ${JSON.stringify(e[t])}`}))}})):l=e.prefix;let f=`${r}${a?o:s}${l}\n`;r=`${r}${a?n:i}`;const p=Object.keys(e.children);for(let n=0;n<p.length;n++){const i=e.children[p[n]];f+=t.call(this,i,r,n===p.length-1,u)}return f},prettyPrintRoutesArray:function(t,e={}){if(!this.buildPrettyMeta)throw new Error("buildPrettyMeta not defined");e.includeMeta=e.includeMeta||null;const r=[];let n="";t.sort(((t,e)=>t.path&&e.path?t.path.localeCompare(e.path):0));for(let n=0;n<t.length;n++){const i=t[n],s=r.find((t=>i.path===t.path));if(s){s.handlers.push({method:i.method,opts:i.opts.constraints||void 0,meta:e.includeMeta?h.call(this,i,e.includeMeta):null});continue}const o={method:i.method,opts:i.opts.constraints||void 0,meta:e.includeMeta?h.call(this,i,e.includeMeta):null};r.push({path:i.path,methods:[i.method],opts:[i.opts],handlers:[o]})}if(!r.filter((t=>t.path===u)).length){const t={path:u,truncatedPath:"",methods:[],opts:[],handlers:[{}]};r.filter((t=>t.path===a)).length?r.splice(1,0,t):r.unshift(t)}const i=function(t){const e=[],r={result:e};return t.forEach(((t,e)=>{let n=t.path.split(l);n[0]!==u&&n[0]!==a&&(n=[u,n[0].slice(1),...n.slice(1)]),n.reduce(((e,r,i)=>{if(!e[r]){e[r]={result:[]};const s={path:r,children:e[r].result};i===n.length-1&&(s.handlers=t.handlers),e.result.push(s)}return e[r]}),r)})),e}(r);return i.forEach(((t,e)=>{n+=f(t,null,e===i.length-1,!1,!0),n+="\n"})),n}}},{}],44:[function(t,e,r){"use strict";const n=t("assert");e.exports={name:"host",mustMatchWhenDerived:!1,storage:function(){const t={},e=[];return{get:r=>{const n=t[r];if(n)return n;for(const t of e)if(t.host.test(r))return t.value},set:(r,n)=>{r instanceof RegExp?e.push({host:r,value:n}):t[r]=n}}},validate(t){n("string"==typeof t||"[object RegExp]"===Object.prototype.toString.call(t),"Host should be a string or a RegExp")}}},{assert:1}],45:[function(t,e,r){"use strict";const n=t("assert");function i(){if(!(this instanceof i))return new i;this.store={},this.maxMajor=0,this.maxMinors={},this.maxPatches={}}i.prototype.set=function(t,e){if("string"!=typeof t)throw new TypeError("Version should be a string");let[r,n,i]=t.split(".");return r=Number(r)||0,n=Number(n)||0,i=Number(i)||0,r>=this.maxMajor&&(this.maxMajor=r,this.store.x=e,this.store["*"]=e,this.store["x.x"]=e,this.store["x.x.x"]=e),n>=(this.maxMinors[r]||0)&&(this.maxMinors[r]=n,this.store[`${r}.x`]=e,this.store[`${r}.x.x`]=e),i>=(this.store[`${r}.${n}`]||0)&&(this.maxPatches[`${r}.${n}`]=i,this.store[`${r}.${n}.x`]=e),this.store[`${r}.${n}.${i}`]=e,this},i.prototype.get=function(t){return this.store[t]},e.exports={name:"version",mustMatchWhenDerived:!0,storage:i,validate(t){n("string"==typeof t,"Version should be a string")}}},{assert:1}],46:[function(t,e,r){"use strict";function n(t,e){return 50===t?53===e?"%":51===e?"#":52===e?"$":54===e?"&":66===e||98===e?"+":67===e||99===e?",":70===e||102===e?"/":null:51===t?65===e||97===e?":":66===e||98===e?";":68===e||100===e?"=":70===e||102===e?"?":null:52===t&&48===e?"@":null}e.exports={safeDecodeURI:function(t){let e=!1,r=!1,i="";for(let s=1;s<t.length;s++){const o=t.charCodeAt(s);if(37===o){const i=t.charCodeAt(s+1),o=t.charCodeAt(s+2);null===n(i,o)?e=!0:(r=!0,50===i&&53===o&&(e=!0,t=t.slice(0,s+1)+"25"+t.slice(s+1),s+=2),s+=2)}else if(63===o||59===o||35===o){i=t.slice(s+1),t=t.slice(0,s);break}}return{path:e?decodeURI(t):t,querystring:i,shouldDecodeParam:r}},safeDecodeURIComponent:function(t){const e=t.indexOf("%");if(-1===e)return t;let r="",i=e;for(let s=e;s<t.length;s++)if(37===t.charCodeAt(s)){const e=n(t.charCodeAt(s+1),t.charCodeAt(s+2));r+=t.slice(i,s)+e,i=s+3}return t.slice(0,e)+r+t.slice(i)}}},{}],47:[function(t,e,r){
|
|
75
|
+
/*
|
|
76
|
+
object-assign
|
|
77
|
+
(c) Sindre Sorhus
|
|
78
|
+
@license MIT
|
|
79
|
+
*/
|
|
80
|
+
"use strict";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},r=0;r<10;r++)e["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(e).map((function(t){return e[t]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(t){n[t]=t})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var r,o,a=function(t){if(null==t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),u=1;u<arguments.length;u++){for(var l in r=Object(arguments[u]))i.call(r,l)&&(a[l]=r[l]);if(n){o=n(r);for(var c=0;c<o.length;c++)s.call(r,o[c])&&(a[o[c]]=r[o[c]])}}return a}},{}],48:[function(t,e,r){e.exports=class{constructor(t){this.orator=t,this.log=t.log,this.Name=this.orator.settings.Product,this.URL="BASE_SERVICE_SERVER",this.Port=this.orator.settings.ServicePort,this.Active=!1}listen(t,e){return this.Active=!0,e()}close(t){return this.Active=!1,t()}get(t,...e){return"string"==typeof t||(this.log.error(`Orator GET Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}put(t,...e){return"string"==typeof t||(this.log.error(`Orator PUT Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}post(t,...e){return"string"==typeof t||(this.log.error(`Orator POST Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}del(t,...e){return"string"==typeof t||(this.log.error(`Orator DEL Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}patch(t,...e){return"string"==typeof t||(this.log.error(`Orator PATCH Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}opts(t,...e){return"string"==typeof t||(this.log.error(`Orator OPTS Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}head(t,...e){return"string"==typeof t||(this.log.error(`Orator HEAD Route mapping failed -- route parameter was ${typeof t} instead of a string.`),!1)}invoke(t,e,r,n){return this.log.debug(`Orator invoke called for route [${e}] and landed on the base class; the service provider likely does not implement programmatic invoke capabilities.`,r),!1}}},{}],49:[function(t,e,r){
|
|
81
|
+
/**
|
|
82
|
+
* Precedent Meta-Templating
|
|
83
|
+
*
|
|
84
|
+
* @license MIT
|
|
85
|
+
*
|
|
86
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
87
|
+
*
|
|
88
|
+
* @description Process text streams, parsing out meta-template expressions.
|
|
89
|
+
*/
|
|
90
|
+
var n=t("./WordTree.js"),i=t("./StringParser.js");e.exports=class{constructor(){this.WordTree=new n,this.StringParser=new i,this.ParseTree=this.WordTree.ParseTree}addPattern(t,e,r){return this.WordTree.addPattern(t,e,r)}parseString(t){return this.StringParser.parseString(t,this.ParseTree)}}},{"./StringParser.js":50,"./WordTree.js":51}],50:[function(t,e,r){e.exports=
|
|
91
|
+
/**
|
|
92
|
+
* String Parser
|
|
93
|
+
*
|
|
94
|
+
* @license MIT
|
|
95
|
+
*
|
|
96
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
97
|
+
*
|
|
98
|
+
* @description Parse a string, properly processing each matched token in the word tree.
|
|
99
|
+
*/
|
|
100
|
+
class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer:"",Pattern:!1,PatternMatch:!1,PatternMatchOutputBuffer:""}}assignNode(t,e){e.PatternMatch=t,e.PatternMatch.hasOwnProperty("PatternEnd")&&(e.Pattern=e.PatternMatch)}appendOutputBuffer(t,e){e.OutputBuffer+=t}flushOutputBuffer(t){t.Output+=t.OutputBuffer,t.OutputBuffer=""}checkPatternEnd(t){t.OutputBuffer.length>=t.Pattern.PatternEnd.length+t.Pattern.PatternStart.length&&t.OutputBuffer.substr(-t.Pattern.PatternEnd.length)===t.Pattern.PatternEnd&&(t.OutputBuffer=t.Pattern.Parse(t.OutputBuffer.substr(t.Pattern.PatternStart.length,t.OutputBuffer.length-(t.Pattern.PatternStart.length+t.Pattern.PatternEnd.length))),this.flushOutputBuffer(t),t.Pattern=!1,t.PatternMatch=!1)}parseCharacter(t,e){!e.PatternMatch&&e.ParseTree.hasOwnProperty(t)?(this.assignNode(e.ParseTree[t],e),this.appendOutputBuffer(t,e)):e.PatternMatch?(e.PatternMatch.hasOwnProperty(t)&&this.assignNode(e.PatternMatch[t],e),this.appendOutputBuffer(t,e),e.Pattern&&this.checkPatternEnd(e)):e.Output+=t}parseString(t,e){let r=this.newParserState(e);for(var n=0;n<t.length;n++)this.parseCharacter(t[n],r);return this.flushOutputBuffer(r),r.Output}}},{}],51:[function(t,e,r){e.exports=
|
|
101
|
+
/**
|
|
102
|
+
* Word Tree
|
|
103
|
+
*
|
|
104
|
+
* @license MIT
|
|
105
|
+
*
|
|
106
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
107
|
+
*
|
|
108
|
+
* @description Create a tree (directed graph) of Javascript objects, one character per object.
|
|
109
|
+
*/
|
|
110
|
+
class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var i=0;i<t.length;i++)n=this.addChild(n,t,i);return n.PatternStart=t,n.PatternEnd="string"==typeof e&&e.length>0?e:t,n.Parse="function"==typeof r?r:"string"==typeof r?()=>r:t=>t,!0}}},{}],52:[function(t,e,r){var n,i,s=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var l,c=[],h=!1,f=-1;function p(){h&&l&&(h=!1,l.length?c=l.concat(c):f=-1,c.length&&d())}function d(){if(!h){var t=u(p);h=!0;for(var e=c.length;e;){for(l=c,c=[];++f<e;)l&&l[f].run();f=-1,e=c.length}l=null,h=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function y(){}s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];c.push(new g(t,e)),1!==c.length||h||u(d)},g.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=y,s.addListener=y,s.once=y,s.off=y,s.removeListener=y,s.removeAllListeners=y,s.emit=y,s.prependListener=y,s.prependOnceListener=y,s.listeners=function(t){return[]},s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],53:[function(t,e,r){"use strict";var n=t("ret"),i=n.types;e.exports=function(t,e){e||(e={});var r,s=void 0===e.limit?25:e.limit;r=t,"[object RegExp]"==={}.toString.call(r)?t=t.source:"string"!=typeof t&&(t=String(t));try{t=n(t)}catch(t){return!1}var o=0;return function t(e,r){var n,a;if(e.type===i.REPETITION){if(r++,o++,r>1)return!1;if(o>s)return!1}if(e.options)for(n=0,a=e.options.length;n<a;n++)if(!t({stack:e.options[n]},r))return!1;var u=e.stack||e.value&&e.value.stack;if(!u)return!0;for(n=0;n<u.length;n++)if(!t(u[n],r))return!1;return!0}(t,0)}},{ret:54}],54:[function(t,e,r){const n=t("./util"),i=t("./types"),s=t("./sets"),o=t("./positions");e.exports=t=>{var e,r,a=0,u={type:i.ROOT,stack:[]},l=u,c=u.stack,h=[],f=e=>{n.error(t,"Nothing to repeat at column "+(e-1))},p=n.strToChars(t);for(e=p.length;a<e;)switch(r=p[a++]){case"\\":switch(r=p[a++]){case"b":c.push(o.wordBoundary());break;case"B":c.push(o.nonWordBoundary());break;case"w":c.push(s.words());break;case"W":c.push(s.notWords());break;case"d":c.push(s.ints());break;case"D":c.push(s.notInts());break;case"s":c.push(s.whitespace());break;case"S":c.push(s.notWhitespace());break;default:/\d/.test(r)?c.push({type:i.REFERENCE,value:parseInt(r,10)}):c.push({type:i.CHAR,value:r.charCodeAt(0)})}break;case"^":c.push(o.begin());break;case"$":c.push(o.end());break;case"[":var d;"^"===p[a]?(d=!0,a++):d=!1;var g=n.tokenizeClass(p.slice(a),t);a+=g[1],c.push({type:i.SET,set:g[0],not:d});break;case".":c.push(s.anyChar());break;case"(":var y={type:i.GROUP,stack:[],remember:!0};"?"===(r=p[a])&&(r=p[a+1],a+=2,"="===r?y.followedBy=!0:"!"===r?y.notFollowedBy=!0:":"!==r&&n.error(t,`Invalid group, character '${r}' after '?' at column `+(a-1)),y.remember=!1),c.push(y),h.push(l),l=y,c=y.stack;break;case")":0===h.length&&n.error(t,"Unmatched ) at column "+(a-1)),c=(l=h.pop()).options?l.options[l.options.length-1]:l.stack;break;case"|":l.options||(l.options=[l.stack],delete l.stack);var m=[];l.options.push(m),c=m;break;case"{":var v,b,S=/^(\d+)(,(\d+)?)?\}/.exec(p.slice(a));null!==S?(0===c.length&&f(a),v=parseInt(S[1],10),b=S[2]?S[3]?parseInt(S[3],10):1/0:v,a+=S[0].length,c.push({type:i.REPETITION,min:v,max:b,value:c.pop()})):c.push({type:i.CHAR,value:123});break;case"?":0===c.length&&f(a),c.push({type:i.REPETITION,min:0,max:1,value:c.pop()});break;case"+":0===c.length&&f(a),c.push({type:i.REPETITION,min:1,max:1/0,value:c.pop()});break;case"*":0===c.length&&f(a),c.push({type:i.REPETITION,min:0,max:1/0,value:c.pop()});break;default:c.push({type:i.CHAR,value:r.charCodeAt(0)})}return 0!==h.length&&n.error(t,"Unterminated group"),u},e.exports.types=i},{"./positions":55,"./sets":56,"./types":57,"./util":58}],55:[function(t,e,r){const n=t("./types");r.wordBoundary=()=>({type:n.POSITION,value:"b"}),r.nonWordBoundary=()=>({type:n.POSITION,value:"B"}),r.begin=()=>({type:n.POSITION,value:"^"}),r.end=()=>({type:n.POSITION,value:"$"})},{"./types":57}],56:[function(t,e,r){const n=t("./types"),i=()=>[{type:n.RANGE,from:48,to:57}],s=()=>[{type:n.CHAR,value:95},{type:n.RANGE,from:97,to:122},{type:n.RANGE,from:65,to:90}].concat(i()),o=()=>[{type:n.CHAR,value:9},{type:n.CHAR,value:10},{type:n.CHAR,value:11},{type:n.CHAR,value:12},{type:n.CHAR,value:13},{type:n.CHAR,value:32},{type:n.CHAR,value:160},{type:n.CHAR,value:5760},{type:n.RANGE,from:8192,to:8202},{type:n.CHAR,value:8232},{type:n.CHAR,value:8233},{type:n.CHAR,value:8239},{type:n.CHAR,value:8287},{type:n.CHAR,value:12288},{type:n.CHAR,value:65279}];r.words=()=>({type:n.SET,set:s(),not:!1}),r.notWords=()=>({type:n.SET,set:s(),not:!0}),r.ints=()=>({type:n.SET,set:i(),not:!1}),r.notInts=()=>({type:n.SET,set:i(),not:!0}),r.whitespace=()=>({type:n.SET,set:o(),not:!1}),r.notWhitespace=()=>({type:n.SET,set:o(),not:!0}),r.anyChar=()=>({type:n.SET,set:[{type:n.CHAR,value:10},{type:n.CHAR,value:13},{type:n.CHAR,value:8232},{type:n.CHAR,value:8233}],not:!0})},{"./types":57}],57:[function(t,e,r){e.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}},{}],58:[function(t,e,r){const n=t("./types"),i=t("./sets"),s={0:0,t:9,n:10,v:11,f:12,r:13};r.strToChars=function(t){return t=t.replace(/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g,(function(t,e,r,n,i,o,a,u){if(r)return t;var l=e?8:n?parseInt(n,16):i?parseInt(i,16):o?parseInt(o,8):a?"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?".indexOf(a):s[u],c=String.fromCharCode(l);return/[[\]{}^$.|?*+()]/.test(c)&&(c="\\"+c),c}))},r.tokenizeClass=(t,e)=>{for(var s,o,a=[],u=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g;null!=(s=u.exec(t));)if(s[1])a.push(i.words());else if(s[2])a.push(i.ints());else if(s[3])a.push(i.whitespace());else if(s[4])a.push(i.notWords());else if(s[5])a.push(i.notInts());else if(s[6])a.push(i.notWhitespace());else if(s[7])a.push({type:n.RANGE,from:(s[8]||s[9]).charCodeAt(0),to:s[10].charCodeAt(0)});else{if(!(o=s[12]))return[a,u.lastIndex];a.push({type:n.CHAR,value:o.charCodeAt(0)})}r.error(e,"Unterminated character class")},r.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}},{"./sets":56,"./types":57}],59:[function(t,e,r){(function(e,n){(function(){var i=t("process/browser.js").nextTick,s=Function.prototype.apply,o=Array.prototype.slice,a={},u=0;function l(t,e){this._id=t,this._clearFn=e}r.setTimeout=function(){return new l(s.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new l(s.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},r.setImmediate="function"==typeof e?e:function(t){var e=u++,n=!(arguments.length<2)&&o.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))})),e},r.clearImmediate="function"==typeof n?n:function(t){delete a[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":52,timers:59}],60:[function(t,e,r){
|
|
111
|
+
/**
|
|
112
|
+
* Simple browser shim loader - assign the npm module to a window global automatically
|
|
113
|
+
*
|
|
114
|
+
* @license MIT
|
|
115
|
+
* @author <steven@velozo.com>
|
|
116
|
+
*/
|
|
117
|
+
var n=t("./Orator.js");"object"!=typeof window||window.hasOwnProperty("Orator")||(window.Orator=n),e.exports=n},{"./Orator.js":66}],61:[function(t,e,r){e.exports={Product:"Unnamed_Service",ProductVersion:"0.0.1",ServicePort:8080}},{}],62:[function(t,e,r){
|
|
118
|
+
/**
|
|
119
|
+
* Default Service Server Function
|
|
120
|
+
*
|
|
121
|
+
* @license MIT
|
|
122
|
+
*
|
|
123
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
124
|
+
*/
|
|
125
|
+
getDefaultServiceServers=()=>{let e={};return e.ipc=t("./Orator-ServiceServer-IPC.js"),e.default=e.ipc,e},e.exports=getDefaultServiceServers()},{"./Orator-ServiceServer-IPC.js":65}],63:[function(t,e,r){"use strict";e.exports={name:"ipc",isAsync:!0,storage:()=>{let t={};return{get:e=>t[e]||null,set:(e,r)=>{t[e]=r}}},deriveConstraint:(t,e,r)=>r(null,"IPC"),mustMatchWhenDerived:!0}},{}],64:[function(t,e,r){e.exports=class{constructor(t,e){this.log=t,this.requestGUID=e,this.responseData=null,this.responseStatus=-1}send(t){return"string"==typeof t?null===this.responseData?(this.responseData=t,!0):"string"==typeof this.responseData?(this.responseData=this.responseData+t,!0):(this.log(`Request ${this.requestGUID} has tried to send() a string value after send()ing data type ${typeof this.responseData}.`,t),!1):"object"==typeof t?null===this.responseData?(this.responseData=JSON.stringify(t),!0):"string"==typeof this.responseData?(this.responseData+=this.responseData+JSON.stringify(t),!0):(this.log(`Request ${this.requestGUID} has tried to send() an object value to be auto stringified after send()ing data type ${typeof this.responseData}.`,t),!1):void 0}}},{}],65:[function(t,e,r){const n=t("orator-serviceserver"),i=t("./Orator-ServiceServer-IPC-SynthesizedResponse.js"),s=t("./Orator-ServiceServer-IPC-RouterConstrainer.js"),o=t("find-my-way"),a=t("async/waterfall"),u=t("async/eachofseries");e.exports=class extends n{constructor(t){super(t),this.routerOptions=this.orator.settings.hasOwnProperty("router_options")&&"object"==typeof this.orator.settings.router_options?this.orator.settings.router_options:{},this.router=o(this.routerOptions),this.router.addConstraintStrategy(s),this.URL="IPC",this.preBehaviorFunctions=[],this.behaviorMap={},this.postBehaviorFunctions=[]}executePreBehaviorFunctions(t,e,r){u(this.preBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider preBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}executePostBehaviorFunctions(t,e,r){u(this.postBehaviorFunctions,((r,n,i)=>r(t,e,i)),(t=>(t&&this.log.error(`IPC Provider postBehaviorFunction ${pFunctionIndex} failed with error: ${t}`,t),r(t))))}addRouteProcessor(t,e,r){return this.router.on(t,e,{constraints:{ipc:"IPC"}},((t,e,n)=>{a([e=>(t.params=n,e()),r=>this.executePreBehaviorFunctions(t,e,r),n=>{u(r,((r,n,i)=>r(t,e,i)),(t=>{if(t)return this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${t}`,t),fNext(pError)}))},r=>this.executePostBehaviorFunctions(t,e,r)],(t=>{t&&this.log.error(`IPC Provider behavior function ${pFunctionIndex} failed with error: ${pBehaviorFunctionError}`,pBehaviorFunctionError)}))})),!0}get(t,...e){return super.get(t,...e)?this.addRouteProcessor("GET",t,Array.from(e)):(this.log.error(`IPC provider failed to map GET route [${t}]!`),!1)}put(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map PUT route [${t}]!`),!1)}post(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map POST route [${t}]!`),!1)}del(t,...e){return!!super.get(t,...e)||(this.log.error(`IPC provider failed to map DEL route [${t}]!`),!1)}invoke(t,e,r,n){let s="function"==typeof n?n:"function"==typeof r?r:()=>{},o={method:t,url:e,guid:this.orator.fable.getUUID()},a=new i(this.log,o.guid);return this.router.lookup(o,a,((t,n)=>(t&&this.log.error(`IPC Request Error Request GUID [${o.guid}] handling route [${e}]: ${t}`,{Error:t,Route:e,Data:r}),s(t,a.responseData,a,n))))}}},{"./Orator-ServiceServer-IPC-RouterConstrainer.js":63,"./Orator-ServiceServer-IPC-SynthesizedResponse.js":64,"async/eachofseries":7,"async/waterfall":20,"find-my-way":40,"orator-serviceserver":48}],66:[function(t,e,r){
|
|
126
|
+
/**
|
|
127
|
+
* Orator Service Abstraction
|
|
128
|
+
*
|
|
129
|
+
* @license MIT
|
|
130
|
+
*
|
|
131
|
+
* @author Steven Velozo <steven@velozo.com>
|
|
132
|
+
* @module Orator Service
|
|
133
|
+
*/
|
|
134
|
+
const n=t("fable"),i=t("./Orator-Default-Configuration.js"),s=t("./Orator-Default-ServiceServers-Node.js");e.exports=class{constructor(t,e){this.fable="object"==typeof t&&t instanceof n?t:new n("object"==typeof t?t:i),this.settings=this.fable.settings,this.log=this.fable.log,this.serviceServer=!1,this.serviceServerProvider=!1,void 0!==e&&(this.serviceServerProvider=e),this.settings.hasOwnProperty("ServicePort")||(this.settings.hasOwnProperty("APIServerPort")?this.settings.ServicePort=this.fable.settings.APIServerPort:this.settings.ServicePort=i.ServicePort),this.settings.hasOwnProperty("Product")||(this.settings.Product=i.Product)}initializeServiceServer(t){this.serviceServer?this.log.warn("Orator attempting to initialize a service server after initialization has already completed."):(this.serviceServerProvider||(this.serviceServerProvider=s.default),this.serviceServer=new this.serviceServerProvider(this),this.webServer=this.serviceServer)}_startServiceListener(t){return this.serviceServer.listen(this.settings.ServicePort,(e=>(this.log.info(`${this.serviceServer.Name} listening at ${this.serviceServer.URL} port ${this.serviceServer.Port}`),t(e))))}startService(t){var e="function"==typeof t?t:()=>{};return this.serviceServer||this.initializeServiceServer(),this._startServiceListener(e)}stopService(t){var e="function"==typeof t?t:()=>{};if(!this.serviceServer){let t="Orator attempting to stop a service server but the service server has not been intialized yet.";return this.log.warn(t),e(t)}if(!this.serviceServer.Active){let t="Orator attempting to stop a service server but the service server is not actively running.";return this.log.warn(t),e(t)}return this.serviceServer.close(e)}invoke(t,e,r,n){return this.serviceServer.invoke(t,e,r,n)}startWebServer(t){return this.startService(t)}stopWebServer(t){return this.stopService(t)}getWebServer(){return this.serviceServer||this.initializeServiceServer(),this.serviceServer}}},{"./Orator-Default-Configuration.js":61,"./Orator-Default-ServiceServers-Node.js":62,fable:31}]},{},[60])(60)}));
|
|
135
|
+
//# sourceMappingURL=orator.min.js.map
|