diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..c406fe77 --- /dev/null +++ b/.babelrc @@ -0,0 +1,38 @@ +{ + "presets": [ + "es2015", + "react", + "stage-0" + ], + "plugins": [ + [ + "module-alias", + [ + { + "expose": "components", + "src": "src/core/components" + }, + { + "expose": "core", + "src": "src/core" + }, + { + "expose": "img", + "src": "src/img" + }, + { + "expose": "corePlugins", + "src": "src/core/plugins" + }, + { + "expose": "less", + "src": "src/less" + }, + { + "expose": "base", + "src": "npm:getbase/src/less/base" + } + ] + ] + ] +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e5ab13fd --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules +.idea +.deps_check +.DS_Store +npm-debug.log diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..e69de29b diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..252389a1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright 2017 SmartBear Software + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 00000000..ecac28c4 --- /dev/null +++ b/README.md @@ -0,0 +1,111 @@ +# Swagger UI + +[![NPM version](https://badge.fury.io/js/swagger-ui.svg)](http://badge.fury.io/js/swagger-ui) + +## New! + +This is the new version of swagger-ui, 3.x. + +For the older version of swagger-ui, refer to the [*2.x branch*](https://github.com/swagger-api/swagger-ui/tree/2.x). + +## Compatibility +The OpenAPI Specification has undergone 4 revisions since initial creation in 2010. Compatibility between swagger-ui and the OpenAPI Specification is as follows: + +Swagger UI Version | Release Date | OpenAPI Spec compatibility | Notes | Status +------------------ | ------------ | -------------------------- | ----- | ------ +3.0.0 | 2017-03-17 | 2.0 | [tag v3.0.0](https://github.com/swagger-api/swagger-ui/tree/v3.0.0) | +2.2.10 | 2017-01-04 | 1.1, 1.2, 2.0 | [tag v2.2.10](https://github.com/swagger-api/swagger-ui/tree/v2.2.10) | +2.1.5 | 2016-07-20 | 1.1, 1.2, 2.0 | [tag v2.1.5](https://github.com/swagger-api/swagger-ui/tree/v2.1.5) | +2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) | +1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) | +1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) | + + +### How to run + +##### Prerequisites +- Node 6.x +- NPM 3.x + +If you just want to see your specs, open `public/index.html` in your browser directly from your filesystem. + +If you'd like to make modifications to the codebase, run the dev server with: `npm run dev`. + + +##### Browser support +Swagger UI works in the latest versions of Chrome, Safari, Firefox, Edge and IE11. + +## CORS Support + +CORS is a technique to prevent websites from doing bad things with your personal data. Most browsers + JavaScript toolkits not only support CORS but enforce it, which has implications for your API server which supports Swagger. + +You can read about CORS here: http://www.w3.org/TR/cors. + +There are two cases where no action is needed for CORS support: + +1. swagger-ui is hosted on the same server as the application itself (same host *and* port). +2. The application is located behind a proxy that enables the required CORS headers. This may already be covered within your organization. + +Otherwise, CORS support needs to be enabled for: + +1. Your Swagger docs. For Swagger 2.0 it's the `swagger.json`/`swagger.yaml` and any externally `$ref`ed docs. +2. For the `Try it now` button to work, CORS needs to be enabled on your API endpoints as well. + +### Testing CORS Support + +You can verify CORS support with one of three techniques: + +- Curl your API and inspect the headers. For instance: + +```bash +$ curl -I "http://petstore.swagger.io/v2/swagger.json" +HTTP/1.1 200 OK +Date: Sat, 31 Jan 2015 23:05:44 GMT +Access-Control-Allow-Origin: * +Access-Control-Allow-Methods: GET, POST, DELETE, PUT, PATCH, OPTIONS +Access-Control-Allow-Headers: Content-Type, api_key, Authorization +Content-Type: application/json +Content-Length: 0 +``` + +This tells us that the petstore resource listing supports OPTIONS, and the following headers: `Content-Type`, `api_key`, `Authorization`. + +- Try swagger-ui from your file system and look at the debug console. If CORS is not enabled, you'll see something like this: + +``` +XMLHttpRequest cannot load http://sad.server.com/v2/api-docs. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. +``` + +Swagger-UI cannot easily show this error state. + +- Using the http://www.test-cors.org website. Keep in mind this will show a successful result even if `Access-Control-Allow-Headers` is not available, which is still required for Swagger-UI to function properly. + +### Enabling CORS + +The method of enabling CORS depends on the server and/or framework you use to host your application. http://enable-cors.org provides information on how to enable CORS in some common web servers. + +Other servers/frameworks may provide you information on how to enable it specifically in their use case. + +### CORS and Header Parameters + +Swagger lets you easily send headers as parameters to requests. The name of these headers *MUST* be supported in your CORS configuration as well. From our example above: + +``` +Access-Control-Allow-Headers: Content-Type, api_key, Authorization +``` + +Only headers with these names will be allowed to be sent by Swagger-UI. + +## License + +Copyright 2017 SmartBear Software + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/build-tools/loadersByExtension.js b/build-tools/loadersByExtension.js new file mode 100644 index 00000000..3ae68339 --- /dev/null +++ b/build-tools/loadersByExtension.js @@ -0,0 +1,28 @@ +function extsToRegExp(exts) { + return new RegExp("\\.(" + exts.map(function(ext) { + return ext.replace(/\./g, "\\."); + }).join("|") + ")(\\?.*)?$"); +} + +module.exports = function loadersByExtension(obj) { + var loaders = []; + Object.keys(obj).forEach(function(key) { + var exts = key.split("|"); + var value = obj[key]; + var entry = { + extensions: exts, + test: extsToRegExp(exts) + }; + if(Array.isArray(value)) { + entry.loaders = value; + } else if(typeof value === "string") { + entry.loader = value; + } else { + Object.keys(value).forEach(function(valueKey) { + entry[valueKey] = value[valueKey]; + }); + } + loaders.push(entry); + }); + return loaders; +}; diff --git a/dist/index.html b/dist/index.html new file mode 100644 index 00000000..af85e0c4 --- /dev/null +++ b/dist/index.html @@ -0,0 +1,92 @@ + + + +
+ +>>u&yn;if(_!==h>>>u&yn)break;_&&(l+=(1<o&&(c=c.removeBefore(r,u,a-l)),c&&h
a&&(a=c.size),i(u)||(c=c.map(function(e){return V(e)})),o.push(c)}return a>e.size&&(e=e.setSize(a)),je(e,t,o)}function $e(e){return es)return k();var e=o.next();return r||t===xn?e:t===bn?w(t,u-1,void 0,e):w(t,u-1,e.value[1],e)})},c}function dt(e,t,n){var r=Ot(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate(function(e,o,s){return t.call(n,e,o,s)&&++a&&r(e,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(wn,o),s=!0;return new x(function(){if(!s)return k();var e=a.next();if(e.done)return e;var o=e.value,u=o[0],c=o[1];return t.call(n,c,u,i)?r===wn?e:w(r,u,c,e):(s=!1,k())})},r}function mt(e,t,n,r){var o=Ot(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var s=!0,u=0;return e.__iterate(function(e,i,c){if(!s||!(s=t.call(n,e,i,c)))return u++,o(e,r?i:u-1,a)}),u},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var s=e.__iterator(wn,i),u=!0,c=0;return new x(function(){var e,i,l;do{if(e=s.next(),e.done)return r||o===xn?e:o===bn?w(o,c++,void 0,e):w(o,c++,e.value[1],e);var p=e.value;i=p[0],l=p[1],u&&(u=t.call(n,l,i,a))}while(u);return o===wn?e:w(o,i,l,e)})},o}function yt(e,t){var r=a(e),o=[e].concat(t).map(function(e){return i(e)?r&&(e=n(e)):e=r?z(e):L(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===o.length)return e;if(1===o.length){var u=o[0];if(u===e||r&&a(u)||s(e)&&s(u))return u}var c=new j(o);return r?c=c.toKeyedSeq():s(e)||(c=c.toSetSeq()),c=c.flatten(!0),c.size=o.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),c}function vt(e,t,n){var r=Ot(e);return r.__iterateUncached=function(r,o){function a(e,c){var l=this;e.__iterate(function(e,o){return(!t||c=Vn)return Te(e,f,c,s,d);if(l&&!d&&2===f.length&&Ee(f[1^p]))return f[1^p];if(l&&d&&1===f.length&&Ee(d))return d;var m=e&&e===this.ownerID,y=l?d?c:c^u:c|u,v=l?d?Fe(f,p,d,m):Be(f,p,m):Ne(f,p,d,m);return m?(this.bitmap=y,this.nodes=v,this):new de(e,y,v)},me.prototype.get=function(e,t,n,r){void 0===t&&(t=ie(n));var o=(0===e?t:t>>>e)&yn,i=this.nodes[o];return i?i.get(e+dn,t,n,r):r},me.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=ie(r));var s=(0===t?n:n>>>t)&yn,u=o===vn,c=this.nodes,l=c[s];if(u&&!l)return this;var p=Se(l,e,t+dn,n,r,o,i,a);if(p===l)return this;var f=this.count;if(l){if(!p&&(f--,ft)return e.textContent;var a=function(e){var t,a,s,u,c,l=e.textContent,p=0,f=l[0],h=1,d=e.innerHTML="",m=0,y=/(\d*\, \d*\, \d*)(, ([.\d]*))?/g.exec(n.getComputedStyle(e).color);for("px rgba("+y[1]+",",y[3]||1;a=t,t=m<7&&"\\"==t?1:h;){if(h=f,f=l[++p],u=d.length>1,!h||m>8&&"\n"==h||[/\S/[i](h),1,1,!/[$\w]/[i](h),("/"==t||"\n"==t)&&u,'"'==t&&u,"'"==t&&u,l[p-4]+a+t=="-->",a+t=="*/"][m])for(d&&(e[o](c=r.createElement("span")).setAttribute("style",["color: #555; font-weight: bold;","","","color: #555;",""][m?m<3?2:m>6?4:m>3?3:+/^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/[i](d):0]),c[o](r.createTextNode(d))),s=m&&m<7?m:s,d="",m=11;![1,/[\/{}[(\-+*=<>:;|\\.,?!&@~]/[i](h),/[\])]/[i](h),/[$\w]/[i](h),"/"==h&&s<2&&"<"!=t,'"'==h,"'"==h,h+f+l[p+1]+l[p+2]=="':null;var r=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=r[1]}return(0,U.memoizedCreateXMLExample)(e,n)}return JSON.stringify((0,U.memoizedSampleFromSchema)(e,n),null,2)}},function(e,t,n){"use strict";var r=n(48);e.exports=function(e,t,n,o){var i=n?n.call(o,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var a=r(e),s=r(t),u=a.length;if(u!==s.length)return!1;o=o||null;for(var c=Object.prototype.hasOwnProperty.bind(t),l=0;l-1&&e%1==0&&e","
"],l=[3,"
"],p=[1,'"],f={"*":[1,"?","
"],legend:[1,""],param:[1,""],tr:[2,"","
"],optgroup:u,option:u,caption:c,colgroup:c,tbody:c,tfoot:c,thead:c,td:l,th:l},h=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];h.forEach(function(e){f[e]=p,s[e]=!0}),e.exports=r},function(e,t,n){"use strict";var r=n(401),o=n(360),i={dangerouslyProcessChildrenUpdates:function(e,t){var n=o.getNodeFromInstance(e);r.processUpdates(n,t)}};e.exports=i},function(e,t,n){"use strict";function r(e){if(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" This DOM node was rendered by `"+n+"`."}}return""}function o(e,t){t&&(G[e._tag]&&(null!=t.children||null!=t.dangerouslySetInnerHTML?m("137",e._tag,e._currentElement._owner?" Check the render method of "+e._currentElement._owner.getName()+".":""):void 0),null!=t.dangerouslySetInnerHTML&&(null!=t.children?m("60"):void 0,"object"==typeof t.dangerouslySetInnerHTML&&U in t.dangerouslySetInnerHTML?void 0:m("61")),null!=t.style&&"object"!=typeof t.style?m("62",r(e)):void 0)}function i(e,t,n,r){if(!(r instanceof j)){var o=e._hostContainerInfo,i=o._node&&o._node.nodeType===K,s=i?o._node:o._ownerDocument;B(t,s),r.getReactMountReady().enqueue(a,{inst:e,registrationName:t,listener:n})}}function a(){var e=this;k.putListener(e.inst,e.registrationName,e.listener)}function s(){var e=this;O.postMountWrapper(e)}function u(){var e=this;M.postMountWrapper(e)}function c(){var e=this;T.postMountWrapper(e)}function l(){var e=this;e._rootNodeID?void 0:m("63");var t=N(e);switch(t?void 0:m("64"),e._tag){case"iframe":case"object":e._wrapperState.listeners=[E.trapBubbledEvent("topLoad","load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in V)V.hasOwnProperty(n)&&e._wrapperState.listeners.push(E.trapBubbledEvent(n,V[n],t));break;case"source":e._wrapperState.listeners=[E.trapBubbledEvent("topError","error",t)];break;case"img":e._wrapperState.listeners=[E.trapBubbledEvent("topError","error",t),E.trapBubbledEvent("topLoad","load",t)];break;case"form":e._wrapperState.listeners=[E.trapBubbledEvent("topReset","reset",t),E.trapBubbledEvent("topSubmit","submit",t)];break;case"input":case"select":case"textarea":e._wrapperState.listeners=[E.trapBubbledEvent("topInvalid","invalid",t)]}}function p(){D.postUpdateWrapper(this)}function f(e){$.call(Y,e)||(X.test(e)?void 0:m("65",e),Y[e]=!0)}function h(e,t){return e.indexOf("-")>=0||null!=t.is}function d(e){var t=e.type;f(t),this._currentElement=e,this._tag=t.toLowerCase(),this._namespaceURI=null,this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._hostNode=null,this._hostParent=null,this._rootNodeID=0,this._domID=0,this._hostContainerInfo=null,this._wrapperState=null,this._topLevelWrapper=null,this._flags=0}var m=n(361),y=n(42),v=n(414),g=n(416),_=n(402),b=n(403),x=n(362),w=n(424),k=n(368),S=n(369),E=n(426),C=n(363),A=n(360),O=n(429),T=n(432),D=n(433),M=n(434),P=(n(388),n(435)),j=n(453),I=(n(341),n(407)),R=(n(337),n(391),n(442),n(456),n(340),C),F=k.deleteListener,N=A.getNodeFromInstance,B=E.listenTo,z=S.registrationNameModules,L={string:!0,number:!0},q="style",U="__html",W={children:null,dangerouslySetInnerHTML:null,suppressContentEditableWarning:null},K=11,V={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},H={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},J={listing:!0,pre:!0,textarea:!0},G=y({menuitem:!0},H),X=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,Y={},$={}.hasOwnProperty,Z=1;d.displayName="ReactDOMComponent",d.Mixin={mountComponent:function(e,t,n,r){this._rootNodeID=Z++,this._domID=n._idCounter++,this._hostParent=t,this._hostContainerInfo=n;var i=this._currentElement.props;switch(this._tag){case"audio":case"form":case"iframe":case"img":case"link":case"object":case"source":case"video":this._wrapperState={listeners:null},e.getReactMountReady().enqueue(l,this);break;case"input":O.mountWrapper(this,i,t),i=O.getHostProps(this,i),e.getReactMountReady().enqueue(l,this);break;case"option":T.mountWrapper(this,i,t),i=T.getHostProps(this,i);break;case"select":D.mountWrapper(this,i,t),i=D.getHostProps(this,i),e.getReactMountReady().enqueue(l,this);break;case"textarea":M.mountWrapper(this,i,t),i=M.getHostProps(this,i),e.getReactMountReady().enqueue(l,this)}o(this,i);var a,p;null!=t?(a=t._namespaceURI,p=t._tag):n._tag&&(a=n._namespaceURI,p=n._tag),(null==a||a===b.svg&&"foreignobject"===p)&&(a=b.html),a===b.html&&("svg"===this._tag?a=b.svg:"math"===this._tag&&(a=b.mathml)),this._namespaceURI=a;var f;if(e.useCreateElement){var h,d=n._ownerDocument;if(a===b.html)if("script"===this._tag){var m=d.createElement("div"),y=this._currentElement.type;m.innerHTML="<"+y+">"+y+">",h=m.removeChild(m.firstChild)}else h=i.is?d.createElement(this._currentElement.type,i.is):d.createElement(this._currentElement.type);else h=d.createElementNS(a,this._currentElement.type);A.precacheNode(this,h),this._flags|=R.hasCachedChildNodes,this._hostParent||w.setAttributeForRoot(h),this._updateDOMProperties(null,i,e);var g=_(h);this._createInitialChildren(e,i,r,g),f=g}else{var x=this._createOpenTagMarkupAndPutListeners(e,i),k=this._createContentMarkup(e,i,r);f=!k&&H[this._tag]?x+"/>":x+">"+k+""+this._currentElement.type+">"}switch(this._tag){case"input":e.getReactMountReady().enqueue(s,this),i.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"textarea":e.getReactMountReady().enqueue(u,this),i.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"select":i.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"button":i.autoFocus&&e.getReactMountReady().enqueue(v.focusDOMComponent,this);break;case"option":e.getReactMountReady().enqueue(c,this)}return f},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];if(null!=o)if(z.hasOwnProperty(r))o&&i(this,r,o,e);else{r===q&&(o&&(o=this._previousStyleCopy=y({},t.style)),o=g.createMarkupForStyles(o,this));var a=null;null!=this._tag&&h(this._tag,t)?W.hasOwnProperty(r)||(a=w.createMarkupForCustomAttribute(r,o)):a=w.createMarkupForProperty(r,o),a&&(n+=" "+a)}}return e.renderToStaticMarkup?n:(this._hostParent||(n+=" "+w.createMarkupForRoot()),n+=" "+w.createMarkupForID(this._domID))},_createContentMarkup:function(e,t,n){var r="",o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&(r=o.__html);else{var i=L[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)r=I(i);else if(null!=a){var s=this.mountChildren(a,e,n);r=s.join("")}}return J[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var o=t.dangerouslySetInnerHTML;if(null!=o)null!=o.__html&&_.queueHTML(r,o.__html);else{var i=L[typeof t.children]?t.children:null,a=null!=i?null:t.children;if(null!=i)""!==i&&_.queueText(r,i);else if(null!=a)for(var s=this.mountChildren(a,e,n),u=0;u-1&&(s=i?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),x(a)){if(i&&o.match(/^\d+$/))return s;a=JSON.stringify(""+o),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function h(e,t,n){var r=0,o=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return o>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function d(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function y(e){return null===e}function v(e){return null==e}function g(e){return"number"==typeof e}function _(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function x(e){return void 0===e}function w(e){return k(e)&&"[object RegExp]"===O(e)}function k(e){return"object"==typeof e&&null!==e}function S(e){return k(e)&&"[object Date]"===O(e)}function E(e){return k(e)&&("[object Error]"===O(e)||e instanceof Error)}function C(e){return"function"==typeof e}function A(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function O(e){return Object.prototype.toString.call(e)}function T(e){return e<10?"0"+e.toString(10):e.toString(10)}function D(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),R[e.getMonth()],t].join(" ")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var P=/%[sdj%]/g;t.format=function(e){if(!_(e)){for(var t=[],n=0;nn?p.push([l,s]):o[s]=this.yaml_path_resolvers[l][s]);else for(d=this.yaml_path_resolvers,a=0,c=d.length;a=h){i.push(x[r.op].call(r,l,o,e));break}if(E(l)){if("-"===o)o=l.length;else{if(n&&!p(o))throw new C("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a-1,r.path,r);o=parseInt(o,10)}if(f>=h){if(n&&"add"===r.op&&o>l.length)throw new C("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a-1,r.path,r);i.push(b[r.op].call(r,l,o,e));break}}else if(o&&o.indexOf("~")!=-1&&(o=o.replace(/~1/g,"/").replace(/~0/g,"~")),f>=h){i.push(_[r.op].call(r,l,o,e));break}l=l[o]}}return i}function h(e,t){var n=[];return l(e,t,n,""),n}function d(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function m(e){if(void 0===e)return!0;if("array"==typeof e||"object"==typeof e)for(var t in e)if(m(e[t]))return!0;return!1}function y(t,n,r,o){if("object"!=typeof t||null===t||E(t))throw new C("Operation is not an object","OPERATION_NOT_AN_OBJECT",n,t,r);if(!_[t.op])throw new C("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",n,t,r);if("string"!=typeof t.path)throw new C("Operation `path` property is not a string","OPERATION_PATH_INVALID",n,t,r);if(0!==t.path.indexOf("/")&&t.path.length>0)throw new C('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",n,t,r);if(("move"===t.op||"copy"===t.op)&&"string"!=typeof t.from)throw new C("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",n,t,r);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&void 0===t.value)throw new C("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",n,t,r);if(("add"===t.op||"replace"===t.op||"test"===t.op)&&m(t.value))throw new C("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",n,t,r);if(r)if("add"==t.op){var i=t.path.split("/").length,a=o.split("/").length;if(i!==a+1&&i!==a)throw new C("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",n,t,r)}else if("replace"===t.op||"remove"===t.op||"_get"===t.op){if(t.path!==o)throw new C("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",n,t,r)}else if("move"===t.op||"copy"===t.op){var s={op:"_get",path:t.from,value:void 0},u=e.validate([s],r);if(u&&"OPERATION_PATH_UNRESOLVABLE"===u.name)throw new C("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",n,t,r)}}function v(e,t){try{if(!E(e))throw new C("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)t=JSON.parse(JSON.stringify(t)),f.call(this,t,e,!0);else for(var n=0;n5?c-5:0),p=5;p5?c-5:0),p=5;p=u)return c;var l=n[r];return c*("desc"==l?-1:1)}}return e.index-t.index}var o=n(965);e.exports=r},function(e,t,n){function r(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e===e,a=o(e),s=void 0!==t,u=null===t,c=t===t,l=o(t);if(!u&&!l&&!a&&e>t||a&&s&&c&&!u&&!l||r&&s&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e