@redocly/reference-docs 2.45.7 → 2.45.8

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.
Files changed (27) hide show
  1. package/bin/cli/commands/redocly-docs-cli.min.js +2004 -2004
  2. package/bin/cli/commands/redocly-docs-cli.min.js.LICENSE.txt +27 -50
  3. package/dist/console.redocly-reference-docs.min.js +271 -187
  4. package/dist/oauth2-redirect.js +3 -3
  5. package/dist/redocly-reference-docs.min.js +2637 -2628
  6. package/lib/components/console/Console.js +1 -1
  7. package/lib/components/console/utils.d.ts +1 -1
  8. package/lib/components/console/utils.js +1 -1
  9. package/lib/redoc-lib/src/services/SearchStore.js +1 -1
  10. package/lib/services/code-samples/httpsnippet/targets/go/native.js +1 -1
  11. package/lib/services/code-samples/httpsnippet/targets/r/httr.js +1 -1
  12. package/lib/services/code-samples/httpsnippet/targets/ruby/native.js +1 -1
  13. package/lib/utils.js +1 -1
  14. package/lib-browser/components/console/Console.js +1 -1
  15. package/lib-browser/components/console/utils.d.ts +1 -1
  16. package/lib-browser/components/console/utils.js +1 -1
  17. package/lib-browser/redoc-lib/src/components/Markdown/AdvancedMarkdown.js +1 -1
  18. package/lib-browser/redoc-lib/src/services/SearchStore.js +1 -1
  19. package/lib-browser/redoc-lib/src/utils/loadAndBundleSpec.js +1 -1
  20. package/lib-browser/services/code-samples/httpsnippet/helpers/lodash-int.js +1 -1
  21. package/lib-esm/components/console/Console.js +1 -1
  22. package/lib-esm/components/console/utils.d.ts +1 -1
  23. package/lib-esm/components/console/utils.js +1 -1
  24. package/lib-esm/redoc-lib/src/components/Markdown/AdvancedMarkdown.js +1 -1
  25. package/lib-esm/redoc-lib/src/services/SearchStore.js +1 -1
  26. package/lib-esm/services/code-samples/httpsnippet/helpers/lodash-int.js +1 -1
  27. package/package.json +1 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Console=void 0;var tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),informed_1=require("informed"),mobx_react_1=require("mobx-react"),swagger_client_1=(0,tslib_1.__importDefault)(require("swagger-client")),react_1=require("react"),utils_1=require("../../utils"),redoc_lib_1=require("../../redoc-lib"),RenderHook_1=require("../../redoc-lib/src/components/RenderHook"),Labels_1=require("../../redoc-lib/src/services/Labels"),Panel_1=require("../Panel"),OAuth2_1=require("../../services/OAuth2"),helper_1=require("../common/FileUpload/helper"),OperationParameters_1=require("../OperationParameters"),hooks_1=require("../../hooks"),events_1=require("../../events"),utils_2=require("../../services/utils"),utils_3=require("./utils"),AuthPanel_1=require("./AuthPanel"),ConsoleBadges_1=require("./ConsoleBadges"),RequestBody_1=require("./RequestBody"),ResponsePanel_1=require("./ResponsePanel"),ActionPanel_1=require("./ActionPanel"),ServersDropdown_1=require("./ServersDropdown"),TryItPanel_1=require("./TryItPanel"),styled_1=require("./styled");function normalizeUrlProtocol(e){return e.startsWith("//")?"https:"+e:e}var flexColumn={flex:1,display:"flex",flexDirection:"column"},Console=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"formApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"setFormApi",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.formApi=e;var t=e.getState(),s=t.values,i=(0,tslib_1.__rest)(t,["values"]);setTimeout((function(){var e=(0,tslib_1.__assign)((0,tslib_1.__assign)({},i),{values:(0,tslib_1.__assign)((0,tslib_1.__assign)({},s),{query:(0,utils_3.unescapeQueryParams)(s.query||{}),path:(0,utils_3.unescapeQueryParams)(s.path||{})})});r.setState({form:e})}),0)}}),Object.defineProperty(r,"handleValueChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{query:(0,utils_3.unescapeQueryParams)(e.query||{}),path:(0,utils_3.unescapeQueryParams)(e.path||{})});r.setState((function(e){return{form:(0,tslib_1.__assign)((0,tslib_1.__assign)({},e.form),{values:t})}}),(function(){(0,utils_3.updateStorage)(r.state.form),r.props.operation.setRequestValues(e)}))}}),Object.defineProperty(r,"handleTabChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.setState({activeTab:e})}}),Object.defineProperty(r,"handleServerChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.setState({server:e}),r.props.operation.setActiveServer(e)}}),Object.defineProperty(r,"handleExecute",{enumerable:!0,configurable:!0,writable:!0,value:function(){return(0,tslib_1.__awaiter)(r,void 0,void 0,(function(){var e,t,r,s,i,o,n,a,l,u,_,d,c,p,h,v,m,b,y,g,f,x,j,P,q,S,A,C,k,w,I,O,T,R,B,H,F,V,D,E,U,N,L,W=this;return(0,tslib_1.__generator)(this,(function(z){switch(z.label){case 0:if(e=this.props,t=e.store,r=e.operation,s=e.onResponse,null===(R=this.formApi)||void 0===R||R.submitForm(),((null===(B=this.formApi)||void 0===B?void 0:B.getState())||this.state.form).invalid)return this.setState({shaking:!0}),setTimeout((function(){return W.setState({shaking:!1})}),1e3),null===(F=null===(H=null==t?void 0:t.options.events)||void 0===H?void 0:H.tryItSent)||void 0===F||F.call(H,{eventType:events_1.AnalyticsEventType.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description}),[2];if(i=((null===(V=this.formApi)||void 0===V?void 0:V.getState())||this.state.form).values,o=this.props.operation,n=o.servers,a=o.requestBody,l=a&&a.content&&a.content.active&&a.content.active.name||"",u=i.body,/json/.test(l))try{u=JSON.parse(u)}catch(e){console.error(e)}if(this.setState({loading:!0}),_=this.state.resolvedRawSpec,d=(r.httpVerb||"").toLowerCase(),!n)throw console.error("Servers are not specified in your OpenAPI file. You can't use Try It Out console without specifying servers. If you use OpenAPI 2, make sure you configured host and basepath"),new Error("Servers are not specified");c=n.find((function(e){return W.state.server.url.endsWith(e.url.endsWith("/")?e.url.substring(0,e.url.length-1):e.url)})),p=Date.now(),v=i.auth,!(0,utils_2.isEmptyObject)(i.auth)&&i.auth?(m=Object.keys(i.auth)[0],b=(0,utils_1.unescapeFormId)(m),h=(0,tslib_1.__assign)((0,tslib_1.__assign)({},_),{components:(0,tslib_1.__assign)((0,tslib_1.__assign)({},null==_?void 0:_.components),{securitySchemes:(0,tslib_1.__assign)((0,tslib_1.__assign)({},null==_?void 0:_.components.securitySchemes),(w={},w[b]=(0,tslib_1.__assign)((0,tslib_1.__assign)({},null==_?void 0:_.components.securitySchemes[b]),{type:"openIdConnect"===(null==_?void 0:_.components.securitySchemes[b].type)?"oauth2":null==_?void 0:_.components.securitySchemes[b].type}),w))})}),y="cookie"===(null==_?void 0:_.components.securitySchemes[b].in)?"Cookie":b,g="cookie"===(null==_?void 0:_.components.securitySchemes[b].in)?(null==_?void 0:_.components.securitySchemes[b].name)+"="+v[m]:v[m],v=(0,tslib_1.__assign)((0,tslib_1.__assign)({},v),((I={})[y]=g,I))):h=(0,tslib_1.__assign)({},_),h.servers=n,(f=t.options.corsProxyUrl)&&n.length&&(h.servers=n.map((function(e){return(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{url:f+normalizeUrlProtocol(e.url)})})),h.paths=(0,tslib_1.__assign)((0,tslib_1.__assign)({},h.paths),((O={})[r.path]=(0,tslib_1.__assign)((0,tslib_1.__assign)({},h.paths[r.path]),((T={})[d]=(0,tslib_1.__assign)((0,tslib_1.__assign)({},h.paths[r.path][d]),{servers:void 0}),T.servers=void 0,T)),O))),(x=(null===(E=null===(D=null==a?void 0:a.content)||void 0===D?void 0:D.active)||void 0===E?void 0:E.name)||null)&&u&&(0,helper_1.isFileUploadMime)(x)&&(j=Object.values(u),u=j.length>1?j:j[0]),P={server:f?f+normalizeUrlProtocol(c.url):c.url,serverVariables:this.state.server.variables,spec:h,pathName:r.path,method:r.httpVerb,parameters:(0,tslib_1.__assign)((0,tslib_1.__assign)((0,tslib_1.__assign)((0,tslib_1.__assign)({},i.path),i.query),i.header),i.cookie),securities:{authorized:v},requestBody:u,requestContentType:x,responseContentType:(null===(U=i.header)||void 0===U?void 0:U.Accept)||null,requestInterceptor:(0,utils_3.makeRequestInterceptor)(t.options,r,v)},z.label=1;case 1:return z.trys.push([1,5,8,9]),[4,swagger_client_1.default.execute(P)];case 2:return q=z.sent(),(S=null==q?void 0:q.data)instanceof Blob?((0,helper_1.isFileUploadMime)(S.type)&&(q.fileInfo={rawData:S,fileName:(0,utils_3.getFileNameFromHeaders)(q.headers)}),A=q,[4,S.text()]):[3,4];case 3:A.data=z.sent(),z.label=4;case 4:return null==s||s({request:P,response:q}),this.setState({response:q,error:void 0}),[3,9];case 5:return(C=z.sent())&&C.response&&C.response.data instanceof Blob?(k=C.response,[4,C.response.data.text()]):[3,7];case 6:k.data=z.sent(),null==s||s({request:P,response:C.response}),z.label=7;case 7:return this.setState({response:void 0,error:C}),[3,9];case 8:return this.setState({loading:!1,activeTab:1,time:Date.now()-p}),null===(L=null===(N=null==t?void 0:t.options.events)||void 0===N?void 0:N.tryItSent)||void 0===L||L.call(N,{eventType:events_1.AnalyticsEventType.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description}),[7];case 9:return[2]}}))}))}}),r.state={form:{values:{path:(0,utils_3.getParameters)(t.operation.parameters,"path"),cookie:(0,utils_3.getParameters)(t.operation.parameters,"cookie"),header:(0,utils_3.getParameters)(t.operation.parameters,"header"),query:(0,utils_3.getParameters)(t.operation.parameters,"query")}},shaking:!1,loading:!1,activeTab:0,server:{}},r}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,r,s,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return t=this.props,r=t.store,s=t.operation,[4,r.dereferenceSpecForTryIt(s)];case 1:return i=o.sent(),this.setState({resolvedRawSpec:i}),null===(e=this.formApi)||void 0===e||e.setValues({}),[2]}}))}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.operation!==this.props.operation&&this.setState({response:void 0,error:void 0,activeTab:0})}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.props,t=e.operation,r=e.className,s=e.rootElement,i=this.state,o=i.shaking,n=i.activeTab,a=i.form,l=i.response,u=i.loading,_=i.error,d=!(!l&&!_);return(0,jsx_runtime_1.jsxs)(ConsoleWrapHook,(0,tslib_1.__assign)({shaking:o,className:r,rootElement:s},{children:[(0,jsx_runtime_1.jsxs)(Panel_1.CodeHeader,{children:[(0,jsx_runtime_1.jsx)(ConsoleBadges_1.ConsoleBadges,{active:n,hasResponse:d,onChange:this.handleTabChange},void 0),this.props.onClose&&(0,jsx_runtime_1.jsx)(styled_1.CloseButton,(0,tslib_1.__assign)({onClick:this.props.onClose},{children:" ✕ "}),void 0)]},void 0),(0,jsx_runtime_1.jsx)(styled_1.ConsoleBody,(0,tslib_1.__assign)({hidden:0!==n,"data-cy":"console-request-body"},{children:this.renderRequest()}),void 0),(0,jsx_runtime_1.jsx)(styled_1.ConsoleBody,(0,tslib_1.__assign)({hidden:1!==n,"data-cy":"console-response-body"},{children:this.renderResponse()}),void 0),(0,jsx_runtime_1.jsx)(ActionPanel_1.ActionPanel,{hasResponse:d,params:a.values,operation:t,loading:u,execute:this.handleExecute},void 0)]}),void 0)}}),Object.defineProperty(t.prototype,"renderRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=this.props,r=t.operation,s=t.store,i=t.properties,o=t.securityDefaults,n=this.state,a=n.form,l=n.resolvedRawSpec,u=n.server,_=a.errors||{},d=_.path||_.cookie||_.header||_.query,c=l&&redoc_lib_1.JsonPointer.get(l,r.pointer),p=a.values&&a.values.auth&&Object.keys(a.values.auth)[0];p&&a.values.auth[p]||(p=void 0),!p||void 0===a.values.auth[p].token&&void 0===a.values.auth[p].client_id&&void 0===a.values.auth[p].client_secret||a.values.auth[p].token&&a.values.auth[p].token.access_token||(p=void 0),p&&null!=a.values.auth[p].username&&(a.values.auth[p].username&&a.values.auth[p].password||(p=void 0));var h=r.parameters||[],v=null===(e=null==s?void 0:s.options.hooks)||void 0===e?void 0:e.ReplaceTryItSecurityPanel;return!l&&(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:"Loading..."},void 0)||(0,jsx_runtime_1.jsxs)(informed_1.Form,(0,tslib_1.__assign)({onValueChange:this.handleValueChange,getApi:this.setFormApi,style:(0,tslib_1.__assign)((0,tslib_1.__assign)({},flexColumn),{margin:0})},{children:[(0,jsx_runtime_1.jsx)(ServersDropdown_1.ServersDropdown,{operation:r,onChange:this.handleServerChange},void 0),(0,jsx_runtime_1.jsxs)(Panel_1.Accordion,(0,tslib_1.__assign)({initialActiveIdx:r.security.length&&p?1:0},{children:[r.security.length&&this.formApi&&(0,jsx_runtime_1.jsx)(TryItPanel_1.TryItPanel,(0,tslib_1.__assign)({header:(0,Labels_1.l)("tryItAuth"),"data-cy":"security-trigger",renderChildrenHidden:!0,error:!p&&!!_.auth,success:!!p},{children:v?(0,jsx_runtime_1.jsx)(AuthPanelHook,(0,tslib_1.__assign)({field:"auth",validate:AuthPanel_1.requiredValidator},{children:function(e){return(0,jsx_runtime_1.jsx)(RenderHook_1.RenderHook,{Hook:v,props:{server:u,operation:r,onChange:e,OAuth2:OAuth2_1.OAuth2}},void 0)}}),void 0):(0,jsx_runtime_1.jsx)(AuthPanel_1.AuthPanel,{formApi:this.formApi,form:a,operation:r,activeServer:u.url,authCorsProxyUrl:s.options.authCorsProxyUrl,securityDefaults:o},void 0)}),void 0)||null,r.requestBody&&this.formApi&&(0,jsx_runtime_1.jsx)(TryItPanel_1.TryItPanel,(0,tslib_1.__assign)({header:(0,Labels_1.l)("tryItBody"),"data-cy":"body-trigger",renderChildrenHidden:!0,error:!!_.body},{children:(0,jsx_runtime_1.jsx)(RequestBody_1.RequestBody,{validate:allowBodyErrors,formApi:this.formApi,body:r.requestBody,id:r.id,resolvedBody:null==c?void 0:c.requestBody,properties:i},void 0)}),void 0)||null,h.length&&(0,jsx_runtime_1.jsx)(TryItPanel_1.TryItPanel,(0,tslib_1.__assign)({header:(0,Labels_1.l)("tryItParameters"),"data-cy":"parameters-trigger",error:d,renderChildrenHidden:!0},{children:(0,jsx_runtime_1.jsx)(OperationParameters_1.OperationParameters,{operation:r,values:a.values,errors:a.errors||{}},void 0)}),void 0)||null]}),void 0)]}),void 0)}}),Object.defineProperty(t.prototype,"renderResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.state,t=e.response,r=e.error,s=e.time;return(0,jsx_runtime_1.jsx)(ResponsePanel_1.ResponsePanel,{response:t,error:r,time:s},void 0)}}),t=(0,tslib_1.__decorate)([mobx_react_1.observer],t)}(react_1.Component);function allowBodyErrors(){}function ConsoleWrapHook(e){var t=e.shaking,r=e.className,s=e.children,i=e.rootElement,o=(0,hooks_1.useDimensions)(i)[0];return(0,jsx_runtime_1.jsx)(styled_1.ConsoleWrap,(0,tslib_1.__assign)({shaking:t,className:r,"data-cy":"console",fullWidth:null==o?void 0:o.width},{children:s}),void 0)}function AuthPanelHook(e){var t=(0,informed_1.useField)((0,tslib_1.__assign)({},e)),r=t.fieldApi,s=t.render,i=t.userProps,o=r.setValue,n=i.children;return s((0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:n(o)},void 0))}exports.Console=Console;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Console=void 0;var tslib_1=require("tslib"),jsx_runtime_1=require("react/jsx-runtime"),informed_1=require("informed"),mobx_react_1=require("mobx-react"),swagger_client_1=(0,tslib_1.__importDefault)(require("swagger-client")),react_1=require("react"),utils_1=require("../../utils"),redoc_lib_1=require("../../redoc-lib"),RenderHook_1=require("../../redoc-lib/src/components/RenderHook"),Labels_1=require("../../redoc-lib/src/services/Labels"),Panel_1=require("../Panel"),OAuth2_1=require("../../services/OAuth2"),helper_1=require("../common/FileUpload/helper"),OperationParameters_1=require("../OperationParameters"),hooks_1=require("../../hooks"),events_1=require("../../events"),utils_2=require("../../services/utils"),utils_3=require("./utils"),AuthPanel_1=require("./AuthPanel"),ConsoleBadges_1=require("./ConsoleBadges"),RequestBody_1=require("./RequestBody"),ResponsePanel_1=require("./ResponsePanel"),ActionPanel_1=require("./ActionPanel"),ServersDropdown_1=require("./ServersDropdown"),TryItPanel_1=require("./TryItPanel"),styled_1=require("./styled");function normalizeUrlProtocol(e){return e.startsWith("//")?"https:"+e:e}var flexColumn={flex:1,display:"flex",flexDirection:"column"},Console=function(e){function t(t){var r=e.call(this,t)||this;return Object.defineProperty(r,"formApi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(r,"setFormApi",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.formApi=e;var t=e.getState(),s=t.values,i=(0,tslib_1.__rest)(t,["values"]);setTimeout((function(){var e=(0,tslib_1.__assign)((0,tslib_1.__assign)({},i),{values:(0,tslib_1.__assign)((0,tslib_1.__assign)({},s),{query:(0,utils_3.unescapeQueryParams)(s.query||{}),path:(0,utils_3.unescapeQueryParams)(s.path||{})})});r.setState({form:e})}),0)}}),Object.defineProperty(r,"handleValueChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){var t=(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{query:(0,utils_3.unescapeQueryParams)(e.query||{}),path:(0,utils_3.unescapeQueryParams)(e.path||{})});r.setState((function(e){return{form:(0,tslib_1.__assign)((0,tslib_1.__assign)({},e.form),{values:t})}}),(function(){(0,utils_3.updateStorage)(r.state.form),r.props.operation.setRequestValues(e)}))}}),Object.defineProperty(r,"handleTabChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.setState({activeTab:e})}}),Object.defineProperty(r,"handleServerChange",{enumerable:!0,configurable:!0,writable:!0,value:function(e){r.setState({server:e}),r.props.operation.setActiveServer(e)}}),Object.defineProperty(r,"handleExecute",{enumerable:!0,configurable:!0,writable:!0,value:function(){return(0,tslib_1.__awaiter)(r,void 0,void 0,(function(){var e,t,r,s,i,o,n,a,l,u,_,d,c,p,h,v,m,b,y,g,f,x,j,P,q,S,A,C,k,w,I,O,T,R,B,H,F,V,D,E,U,N,L,W=this;return(0,tslib_1.__generator)(this,(function(z){switch(z.label){case 0:if(e=this.props,t=e.store,r=e.operation,s=e.onResponse,null===(R=this.formApi)||void 0===R||R.submitForm(),((null===(B=this.formApi)||void 0===B?void 0:B.getState())||this.state.form).invalid)return this.setState({shaking:!0}),setTimeout((function(){return W.setState({shaking:!1})}),1e3),null===(F=null===(H=null==t?void 0:t.options.events)||void 0===H?void 0:H.tryItSent)||void 0===F||F.call(H,{eventType:events_1.AnalyticsEventType.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description}),[2];if(i=((null===(V=this.formApi)||void 0===V?void 0:V.getState())||this.state.form).values,o=this.props.operation,n=o.servers,a=o.requestBody,l=a&&a.content&&a.content.active&&a.content.active.name||"",u=i.body,/json/.test(l))try{u=JSON.parse(u)}catch(e){console.error(e)}if(this.setState({loading:!0}),_=this.state.resolvedRawSpec,d=(r.httpVerb||"").toLowerCase(),!n)throw console.error("Servers are not specified in your OpenAPI file. You can't use Try It Out console without specifying servers. If you use OpenAPI 2, make sure you configured host and basepath"),new Error("Servers are not specified");c=n.find((function(e){return W.state.server.url.endsWith(e.url.endsWith("/")?e.url.substring(0,e.url.length-1):e.url)})),p=Date.now(),v=i.auth,!(0,utils_2.isEmptyObject)(i.auth)&&i.auth?(m=Object.keys(i.auth)[0],b=(0,utils_1.unescapeFormId)(m),h=(0,tslib_1.__assign)((0,tslib_1.__assign)({},_),{components:(0,tslib_1.__assign)((0,tslib_1.__assign)({},null==_?void 0:_.components),{securitySchemes:(0,tslib_1.__assign)((0,tslib_1.__assign)({},null==_?void 0:_.components.securitySchemes),(w={},w[b]=(0,tslib_1.__assign)((0,tslib_1.__assign)({},null==_?void 0:_.components.securitySchemes[b]),{type:"openIdConnect"===(null==_?void 0:_.components.securitySchemes[b].type)?"oauth2":null==_?void 0:_.components.securitySchemes[b].type}),w))})}),y="cookie"===(null==_?void 0:_.components.securitySchemes[b].in)?"Cookie":b,g="cookie"===(null==_?void 0:_.components.securitySchemes[b].in)?(null==_?void 0:_.components.securitySchemes[b].name)+"="+v[m]:v[m],v=(0,tslib_1.__assign)((0,tslib_1.__assign)({},v),((I={})[y]=g,I))):h=(0,tslib_1.__assign)({},_),h.servers=n,(f=t.options.corsProxyUrl)&&n.length&&(h.servers=n.map((function(e){return(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{url:f+normalizeUrlProtocol(e.url)})})),h.paths=(0,tslib_1.__assign)((0,tslib_1.__assign)({},h.paths),((O={})[r.path]=(0,tslib_1.__assign)((0,tslib_1.__assign)({},h.paths[r.path]),((T={})[d]=(0,tslib_1.__assign)((0,tslib_1.__assign)({},h.paths[r.path][d]),{servers:void 0}),T.servers=void 0,T)),O))),(x=(null===(E=null===(D=null==a?void 0:a.content)||void 0===D?void 0:D.active)||void 0===E?void 0:E.name)||null)&&u&&(0,helper_1.isFileUploadMime)(x)&&(j=Object.values(u),u=j.length>1?j:j[0]),P={server:f?f+normalizeUrlProtocol(c.url):c.url,serverVariables:this.state.server.variables,spec:h,pathName:r.path,method:r.httpVerb,parameters:(0,tslib_1.__assign)((0,tslib_1.__assign)((0,tslib_1.__assign)((0,tslib_1.__assign)({},i.path),i.query),i.header),i.cookie),securities:{authorized:v},requestBody:u,requestContentType:x,responseContentType:(null===(U=i.header)||void 0===U?void 0:U.Accept)||null,requestInterceptor:(0,utils_3.makeRequestInterceptor)(t.options,r,v,i)},z.label=1;case 1:return z.trys.push([1,5,8,9]),[4,swagger_client_1.default.execute(P)];case 2:return q=z.sent(),(S=null==q?void 0:q.data)instanceof Blob?((0,helper_1.isFileUploadMime)(S.type)&&(q.fileInfo={rawData:S,fileName:(0,utils_3.getFileNameFromHeaders)(q.headers)}),A=q,[4,S.text()]):[3,4];case 3:A.data=z.sent(),z.label=4;case 4:return null==s||s({request:P,response:q}),this.setState({response:q,error:void 0}),[3,9];case 5:return(C=z.sent())&&C.response&&C.response.data instanceof Blob?(k=C.response,[4,C.response.data.text()]):[3,7];case 6:k.data=z.sent(),null==s||s({request:P,response:C.response}),z.label=7;case 7:return this.setState({response:void 0,error:C}),[3,9];case 8:return this.setState({loading:!1,activeTab:1,time:Date.now()-p}),null===(L=null===(N=null==t?void 0:t.options.events)||void 0===N?void 0:N.tryItSent)||void 0===L||L.call(N,{eventType:events_1.AnalyticsEventType.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description}),[7];case 9:return[2]}}))}))}}),r.state={form:{values:{path:(0,utils_3.getParameters)(t.operation.parameters,"path"),cookie:(0,utils_3.getParameters)(t.operation.parameters,"cookie"),header:(0,utils_3.getParameters)(t.operation.parameters,"header"),query:(0,utils_3.getParameters)(t.operation.parameters,"query")}},shaking:!1,loading:!1,activeTab:0,server:{}},r}return(0,tslib_1.__extends)(t,e),Object.defineProperty(t.prototype,"componentDidMount",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e;return(0,tslib_1.__awaiter)(this,void 0,void 0,(function(){var t,r,s,i;return(0,tslib_1.__generator)(this,(function(o){switch(o.label){case 0:return t=this.props,r=t.store,s=t.operation,[4,r.dereferenceSpecForTryIt(s)];case 1:return i=o.sent(),this.setState({resolvedRawSpec:i}),null===(e=this.formApi)||void 0===e||e.setValues({}),[2]}}))}))}}),Object.defineProperty(t.prototype,"componentDidUpdate",{enumerable:!1,configurable:!0,writable:!0,value:function(e){e.operation!==this.props.operation&&this.setState({response:void 0,error:void 0,activeTab:0})}}),Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.props,t=e.operation,r=e.className,s=e.rootElement,i=this.state,o=i.shaking,n=i.activeTab,a=i.form,l=i.response,u=i.loading,_=i.error,d=!(!l&&!_);return(0,jsx_runtime_1.jsxs)(ConsoleWrapHook,(0,tslib_1.__assign)({shaking:o,className:r,rootElement:s},{children:[(0,jsx_runtime_1.jsxs)(Panel_1.CodeHeader,{children:[(0,jsx_runtime_1.jsx)(ConsoleBadges_1.ConsoleBadges,{active:n,hasResponse:d,onChange:this.handleTabChange},void 0),this.props.onClose&&(0,jsx_runtime_1.jsx)(styled_1.CloseButton,(0,tslib_1.__assign)({onClick:this.props.onClose},{children:" ✕ "}),void 0)]},void 0),(0,jsx_runtime_1.jsx)(styled_1.ConsoleBody,(0,tslib_1.__assign)({hidden:0!==n,"data-cy":"console-request-body"},{children:this.renderRequest()}),void 0),(0,jsx_runtime_1.jsx)(styled_1.ConsoleBody,(0,tslib_1.__assign)({hidden:1!==n,"data-cy":"console-response-body"},{children:this.renderResponse()}),void 0),(0,jsx_runtime_1.jsx)(ActionPanel_1.ActionPanel,{hasResponse:d,params:a.values,operation:t,loading:u,execute:this.handleExecute},void 0)]}),void 0)}}),Object.defineProperty(t.prototype,"renderRequest",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e,t=this.props,r=t.operation,s=t.store,i=t.properties,o=t.securityDefaults,n=this.state,a=n.form,l=n.resolvedRawSpec,u=n.server,_=a.errors||{},d=_.path||_.cookie||_.header||_.query,c=l&&redoc_lib_1.JsonPointer.get(l,r.pointer),p=a.values&&a.values.auth&&Object.keys(a.values.auth)[0];p&&a.values.auth[p]||(p=void 0),!p||void 0===a.values.auth[p].token&&void 0===a.values.auth[p].client_id&&void 0===a.values.auth[p].client_secret||a.values.auth[p].token&&a.values.auth[p].token.access_token||(p=void 0),p&&null!=a.values.auth[p].username&&(a.values.auth[p].username&&a.values.auth[p].password||(p=void 0));var h=r.parameters||[],v=null===(e=null==s?void 0:s.options.hooks)||void 0===e?void 0:e.ReplaceTryItSecurityPanel;return!l&&(0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:"Loading..."},void 0)||(0,jsx_runtime_1.jsxs)(informed_1.Form,(0,tslib_1.__assign)({onValueChange:this.handleValueChange,getApi:this.setFormApi,style:(0,tslib_1.__assign)((0,tslib_1.__assign)({},flexColumn),{margin:0})},{children:[(0,jsx_runtime_1.jsx)(ServersDropdown_1.ServersDropdown,{operation:r,onChange:this.handleServerChange},void 0),(0,jsx_runtime_1.jsxs)(Panel_1.Accordion,(0,tslib_1.__assign)({initialActiveIdx:r.security.length&&p?1:0},{children:[r.security.length&&this.formApi&&(0,jsx_runtime_1.jsx)(TryItPanel_1.TryItPanel,(0,tslib_1.__assign)({header:(0,Labels_1.l)("tryItAuth"),"data-cy":"security-trigger",renderChildrenHidden:!0,error:!p&&!!_.auth,success:!!p},{children:v?(0,jsx_runtime_1.jsx)(AuthPanelHook,(0,tslib_1.__assign)({field:"auth",validate:AuthPanel_1.requiredValidator},{children:function(e){return(0,jsx_runtime_1.jsx)(RenderHook_1.RenderHook,{Hook:v,props:{server:u,operation:r,onChange:e,OAuth2:OAuth2_1.OAuth2}},void 0)}}),void 0):(0,jsx_runtime_1.jsx)(AuthPanel_1.AuthPanel,{formApi:this.formApi,form:a,operation:r,activeServer:u.url,authCorsProxyUrl:s.options.authCorsProxyUrl,securityDefaults:o},void 0)}),void 0)||null,r.requestBody&&this.formApi&&(0,jsx_runtime_1.jsx)(TryItPanel_1.TryItPanel,(0,tslib_1.__assign)({header:(0,Labels_1.l)("tryItBody"),"data-cy":"body-trigger",renderChildrenHidden:!0,error:!!_.body},{children:(0,jsx_runtime_1.jsx)(RequestBody_1.RequestBody,{validate:allowBodyErrors,formApi:this.formApi,body:r.requestBody,id:r.id,resolvedBody:null==c?void 0:c.requestBody,properties:i},void 0)}),void 0)||null,h.length&&(0,jsx_runtime_1.jsx)(TryItPanel_1.TryItPanel,(0,tslib_1.__assign)({header:(0,Labels_1.l)("tryItParameters"),"data-cy":"parameters-trigger",error:d,renderChildrenHidden:!0},{children:(0,jsx_runtime_1.jsx)(OperationParameters_1.OperationParameters,{operation:r,values:a.values,errors:a.errors||{}},void 0)}),void 0)||null]}),void 0)]}),void 0)}}),Object.defineProperty(t.prototype,"renderResponse",{enumerable:!1,configurable:!0,writable:!0,value:function(){var e=this.state,t=e.response,r=e.error,s=e.time;return(0,jsx_runtime_1.jsx)(ResponsePanel_1.ResponsePanel,{response:t,error:r,time:s},void 0)}}),t=(0,tslib_1.__decorate)([mobx_react_1.observer],t)}(react_1.Component);function allowBodyErrors(){}function ConsoleWrapHook(e){var t=e.shaking,r=e.className,s=e.children,i=e.rootElement,o=(0,hooks_1.useDimensions)(i)[0];return(0,jsx_runtime_1.jsx)(styled_1.ConsoleWrap,(0,tslib_1.__assign)({shaking:t,className:r,"data-cy":"console",fullWidth:null==o?void 0:o.width},{children:s}),void 0)}function AuthPanelHook(e){var t=(0,informed_1.useField)((0,tslib_1.__assign)({},e)),r=t.fieldApi,s=t.render,i=t.userProps,o=r.setValue,n=i.children;return s((0,jsx_runtime_1.jsx)(jsx_runtime_1.Fragment,{children:n(o)},void 0))}exports.Console=Console;
2
2
  //# sourceMappingURL=Console.js.map
@@ -13,7 +13,7 @@ export declare function getDefaultOrStoredVariables(server?: OpenAPIServer): Ser
13
13
  export declare function updateVariablesStorage(name: string, value: string): void;
14
14
  export declare function unescapeQueryParams(params: GenericObject): GenericObject;
15
15
  export declare function getFileNameFromHeaders(headers: Record<string, string>): string;
16
- export declare const makeRequestInterceptor: ({ requestInterceptor, sendXUserAgentInTryIt, disableTryItRequestUrlEncoding, }: Pick<RedocProNormalizedOptions, 'requestInterceptor' | 'sendXUserAgentInTryIt' | 'disableTryItRequestUrlEncoding'>, operation: OperationModel, auth?: RequestAuth | undefined) => (req: Request) => void | Request;
16
+ export declare const makeRequestInterceptor: ({ requestInterceptor, sendXUserAgentInTryIt, disableTryItRequestUrlEncoding, }: Pick<RedocProNormalizedOptions, 'requestInterceptor' | 'sendXUserAgentInTryIt' | 'disableTryItRequestUrlEncoding'>, operation: OperationModel, auth?: RequestAuth | undefined, values?: GenericObject | undefined) => (req: Request) => void | Request;
17
17
  export declare const validateTokenEndpointMethod: (token: string[] | string | undefined) => boolean;
18
18
  export declare const getOAuth2TokenEndpointAuthHeader: ({ authMethod, clientId, clientSecret, }: {
19
19
  authMethod?: string | string[] | undefined;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStorageExampleKey=exports.encodeSample=exports.getOAuth2TokenEndpointAuthHeader=exports.validateTokenEndpointMethod=exports.makeRequestInterceptor=exports.getFileNameFromHeaders=exports.unescapeQueryParams=exports.updateVariablesStorage=exports.getDefaultOrStoredVariables=exports.expandDefaultServerVariables=exports.expandVariables=exports.getInitialServerWithVariables=exports.getServerWithVariables=exports.getParameters=exports.updateStorage=exports.normalizeUrlProtocol=void 0;var tslib_1=require("tslib"),deepmerge_1=(0,tslib_1.__importDefault)(require("deepmerge")),types_1=require("../../types"),utils_1=require("../../services/utils"),utils_2=require("../../utils");function normalizeUrlProtocol(e){return e.startsWith("//")?"https:"+e:e}function updateStorage(e){if(e.values.auth)for(var r=0,t=Object.keys(e.values.auth);r<t.length;r++){var a=t[r],i=e.values.auth[a];(0,utils_2.setSecurityDetails)(a,i)}updateParameterStorage(e)}function updateParameterStorage(e){for(var r,t=0,a=["path","query","header","cookie"];t<a.length;t++){var i=a[t];if(null===(r=e.values)||void 0===r?void 0:r[i])for(var o=0,n=Object.keys(e.values[i]);o<n.length;o++){var s=n[o];(0,utils_2.setParameterValue)(i,s,e.values[i][s])}}}exports.normalizeUrlProtocol=normalizeUrlProtocol,exports.updateStorage=updateStorage;var getParameters=function(e,r){return e.filter((function(e){return e.in===r})).reduce((function(e,r){var t=r.in,a=r.name;return e[a]=(0,utils_2.getParameterValue)(t||"",a),e}),{})};exports.getParameters=getParameters;var pathTemplateRegExp=/(?:{)(.*?)(?:})/g;function getServerWithVariables(e,r){void 0===r&&(r=0);var t=e[r],a=getDefaultOrStoredVariables(t);return(0,tslib_1.__assign)((0,tslib_1.__assign)({},t),{variables:a})}function getInitialServerWithVariables(e){var r=(0,utils_2.fromSessionStorage)("serverUrl"),t=e.find((function(e){return e.url===r}))||e[0],a=getDefaultOrStoredVariables(t);return(0,tslib_1.__assign)((0,tslib_1.__assign)({},t),{variables:a})}function expandVariables(e,r){return void 0===r&&(r={}),e.replace(pathTemplateRegExp,(function(e,t){return r[t]||e}))}function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(pathTemplateRegExp,(function(e,t){return r[t]&&r[t].default||e}))}function getDefaultOrStoredVariables(e){if(!(null==e?void 0:e.variables))return{};var r=(0,utils_2.fromSessionStorage)("variables"),t=r&&JSON.parse(r)||{},a={};return Object.entries(e.variables||{}).forEach((function(e){var r=e[0],i=e[1];a[r]=t[r]||i.default||""})),a}function updateVariablesStorage(e,r){var t,a=(0,utils_2.fromSessionStorage)("variables"),i=a&&JSON.parse(a)||{};(0,utils_2.toSessionStorage)("variables",JSON.stringify((0,tslib_1.__assign)((0,tslib_1.__assign)({},i),((t={})[e]=r,t))))}function unescapeQueryParams(e){return Object.entries(e).reduce((function(e,r){var t=r[0],a=r[1];return e[(0,utils_2.unescapeFormId)(t)]=a,e}),{})}function getFileNameFromHeaders(e){for(var r="filename=",t=0,a=Object.entries(e);t<a.length;t++){var i=a[t],o=i[0],n=i[1];if("content-disposition"===o.toLowerCase()){var s=n.split(";").find((function(e){return e.trim().startsWith(r)}));if(s)return s.split(r)[1]}}return""}exports.getServerWithVariables=getServerWithVariables,exports.getInitialServerWithVariables=getInitialServerWithVariables,exports.expandVariables=expandVariables,exports.expandDefaultServerVariables=expandDefaultServerVariables,exports.getDefaultOrStoredVariables=getDefaultOrStoredVariables,exports.updateVariablesStorage=updateVariablesStorage,exports.unescapeQueryParams=unescapeQueryParams,exports.getFileNameFromHeaders=getFileNameFromHeaders;var makeRequestInterceptor=function(e,r,t){var a=e.requestInterceptor,i=e.sendXUserAgentInTryIt,o=e.disableTryItRequestUrlEncoding;return function(e){var n,s,l,u;o&&(e=(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{url:decodeURIComponent(e.url)})),i&&(e.headers["X-User-Agent"]="Redocly Try it API console");var d=(null===(s=null===(n=null==r?void 0:r.requestValues)||void 0===n?void 0:n.header)||void 0===s?void 0:s.authorization)||(null===(u=null===(l=null==r?void 0:r.requestValues)||void 0===l?void 0:l.header)||void 0===u?void 0:u.Authorization);return!(null==t?void 0:t.Authorization)&&d&&(e.headers.Authorization=d),(null==t?void 0:t.Cookie)&&(e.headers["X-Redocly-Cookie"]=t.Cookie),a?a(e,r):e}};exports.makeRequestInterceptor=makeRequestInterceptor;var validateTokenEndpointMethod=function(e){if(!e)return!0;var r=Array.isArray(e)?e:[e];return!(r.length&&!r.includes("none")&&!r.includes("client_secret_basic"))};exports.validateTokenEndpointMethod=validateTokenEndpointMethod;var getOAuth2TokenEndpointAuthHeader=function(e){var r=e.authMethod,t=e.clientId,a=e.clientSecret;return"client_secret_basic"===r||Array.isArray(r)&&r.includes("client_secret_basic")?{Authorization:"Basic "+btoa(t+":"+a)}:{}};function encodeSample(e,r){if(!e)return"";if(e.mime===types_1.MediaTypes.URL_ENCODED)return e.value;var t=e.value,a=r?(0,deepmerge_1.default)(t,r,{arrayMerge:utils_1.arrayMergeStrategy}):t;return JSON.stringify(a,null,2)}exports.getOAuth2TokenEndpointAuthHeader=getOAuth2TokenEndpointAuthHeader,exports.encodeSample=encodeSample;var getStorageExampleKey=function(e,r,t,a){var i=e+"_"+r;return t&&a&&Object.keys(a).includes(t)&&(i+="_"+t),i};exports.getStorageExampleKey=getStorageExampleKey;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStorageExampleKey=exports.encodeSample=exports.getOAuth2TokenEndpointAuthHeader=exports.validateTokenEndpointMethod=exports.makeRequestInterceptor=exports.getFileNameFromHeaders=exports.unescapeQueryParams=exports.updateVariablesStorage=exports.getDefaultOrStoredVariables=exports.expandDefaultServerVariables=exports.expandVariables=exports.getInitialServerWithVariables=exports.getServerWithVariables=exports.getParameters=exports.updateStorage=exports.normalizeUrlProtocol=void 0;var tslib_1=require("tslib"),deepmerge_1=(0,tslib_1.__importDefault)(require("deepmerge")),types_1=require("../../types"),utils_1=require("../../services/utils"),utils_2=require("../../utils");function normalizeUrlProtocol(e){return e.startsWith("//")?"https:"+e:e}function updateStorage(e){if(e.values.auth)for(var r=0,t=Object.keys(e.values.auth);r<t.length;r++){var a=t[r],i=e.values.auth[a];(0,utils_2.setSecurityDetails)(a,i)}updateParameterStorage(e)}function updateParameterStorage(e){for(var r,t=0,a=["path","query","header","cookie"];t<a.length;t++){var i=a[t];if(null===(r=e.values)||void 0===r?void 0:r[i])for(var o=0,n=Object.keys(e.values[i]);o<n.length;o++){var s=n[o];(0,utils_2.setParameterValue)(i,s,e.values[i][s])}}}exports.normalizeUrlProtocol=normalizeUrlProtocol,exports.updateStorage=updateStorage;var getParameters=function(e,r){return e.filter((function(e){return e.in===r})).reduce((function(e,r){var t=r.in,a=r.name;return e[a]=(0,utils_2.getParameterValue)(t||"",a),e}),{})};exports.getParameters=getParameters;var pathTemplateRegExp=/(?:{)(.*?)(?:})/g;function getServerWithVariables(e,r){void 0===r&&(r=0);var t=e[r],a=getDefaultOrStoredVariables(t);return(0,tslib_1.__assign)((0,tslib_1.__assign)({},t),{variables:a})}function getInitialServerWithVariables(e){var r=(0,utils_2.fromSessionStorage)("serverUrl"),t=e.find((function(e){return e.url===r}))||e[0],a=getDefaultOrStoredVariables(t);return(0,tslib_1.__assign)((0,tslib_1.__assign)({},t),{variables:a})}function expandVariables(e,r){return void 0===r&&(r={}),e.replace(pathTemplateRegExp,(function(e,t){return r[t]||e}))}function expandDefaultServerVariables(e,r){return void 0===r&&(r={}),e.replace(pathTemplateRegExp,(function(e,t){return r[t]&&r[t].default||e}))}function getDefaultOrStoredVariables(e){if(!(null==e?void 0:e.variables))return{};var r=(0,utils_2.fromSessionStorage)("variables"),t=r&&JSON.parse(r)||{},a={};return Object.entries(e.variables||{}).forEach((function(e){var r=e[0],i=e[1];a[r]=t[r]||i.default||""})),a}function updateVariablesStorage(e,r){var t,a=(0,utils_2.fromSessionStorage)("variables"),i=a&&JSON.parse(a)||{};(0,utils_2.toSessionStorage)("variables",JSON.stringify((0,tslib_1.__assign)((0,tslib_1.__assign)({},i),((t={})[e]=r,t))))}function unescapeQueryParams(e){return Object.entries(e).reduce((function(e,r){var t=r[0],a=r[1];return e[(0,utils_2.unescapeFormId)(t)]=a,e}),{})}function getFileNameFromHeaders(e){for(var r="filename=",t=0,a=Object.entries(e);t<a.length;t++){var i=a[t],o=i[0],n=i[1];if("content-disposition"===o.toLowerCase()){var s=n.split(";").find((function(e){return e.trim().startsWith(r)}));if(s)return s.split(r)[1]}}return""}exports.getServerWithVariables=getServerWithVariables,exports.getInitialServerWithVariables=getInitialServerWithVariables,exports.expandVariables=expandVariables,exports.expandDefaultServerVariables=expandDefaultServerVariables,exports.getDefaultOrStoredVariables=getDefaultOrStoredVariables,exports.updateVariablesStorage=updateVariablesStorage,exports.unescapeQueryParams=unescapeQueryParams,exports.getFileNameFromHeaders=getFileNameFromHeaders;var makeRequestInterceptor=function(e,r,t,a){var i=e.requestInterceptor,o=e.sendXUserAgentInTryIt,n=e.disableTryItRequestUrlEncoding;return function(e){var s,l,u,d,p,v;n&&(e=(0,tslib_1.__assign)((0,tslib_1.__assign)({},e),{url:decodeURIComponent(e.url)})),o&&(e.headers["X-User-Agent"]="Redocly Try it API console");var c=(null===(l=null===(s=null==r?void 0:r.requestValues)||void 0===s?void 0:s.header)||void 0===l?void 0:l.authorization)||(null===(d=null===(u=null==r?void 0:r.requestValues)||void 0===u?void 0:u.header)||void 0===d?void 0:d.Authorization)||(null===(p=null==a?void 0:a.header)||void 0===p?void 0:p.Authorization)||(null===(v=null==a?void 0:a.header)||void 0===v?void 0:v.authorization);return!(null==t?void 0:t.Authorization)&&c&&(e.headers.Authorization=c),(null==t?void 0:t.Cookie)&&(e.headers["X-Redocly-Cookie"]=t.Cookie),i?i(e,r):e}};exports.makeRequestInterceptor=makeRequestInterceptor;var validateTokenEndpointMethod=function(e){if(!e)return!0;var r=Array.isArray(e)?e:[e];return!(r.length&&!r.includes("none")&&!r.includes("client_secret_basic"))};exports.validateTokenEndpointMethod=validateTokenEndpointMethod;var getOAuth2TokenEndpointAuthHeader=function(e){var r=e.authMethod,t=e.clientId,a=e.clientSecret;return"client_secret_basic"===r||Array.isArray(r)&&r.includes("client_secret_basic")?{Authorization:"Basic "+btoa(t+":"+a)}:{}};function encodeSample(e,r){if(!e)return"";if(e.mime===types_1.MediaTypes.URL_ENCODED)return e.value;var t=e.value,a=r?(0,deepmerge_1.default)(t,r,{arrayMerge:utils_1.arrayMergeStrategy}):t;return JSON.stringify(a,null,2)}exports.getOAuth2TokenEndpointAuthHeader=getOAuth2TokenEndpointAuthHeader,exports.encodeSample=encodeSample;var getStorageExampleKey=function(e,r,t,a){var i=e+"_"+r;return t&&a&&Object.keys(a).includes(t)&&(i+="_"+t),i};exports.getStorageExampleKey=getStorageExampleKey;
2
2
  //# sourceMappingURL=utils.js.map
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see SearchStore.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SearchStore=t():e.SearchStore=t()}(this,(function(){return(()=>{var e={27:(e,t,r)=>{"use strict";r.d(t,{ZP:()=>a});var i=r(336),n=Object.defineProperty,s=(e,t,r)=>(((e,t,r)=>{t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),o=(e,t,r)=>new Promise(((i,n)=>{var s=e=>{try{a(r.next(e))}catch(e){n(e)}},o=e=>{try{a(r.throw(e))}catch(e){n(e)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())}));class a{constructor(){s(this,"add",f),s(this,"done",p),s(this,"search",R),s(this,"toJS",y),s(this,"load",g),s(this,"dispose",x),s(this,"fromExternalJS",m)}}let u,l,c,h=[];function d(){u=new i.Builder,u.field("title"),u.field("description"),u.ref("ref"),u.pipeline.add(i.trimmer,i.stopWordFilter,i.stemmer),c=new Promise((e=>{l=e}))}function f(e,t,r){const i=h.push(r)-1,n={title:e.toLowerCase(),description:t.toLowerCase(),ref:i};u.add(n)}function p(){return o(this,null,(function*(){l(u.build())}))}function y(){return o(this,null,(function*(){return{store:h,index:(yield c).toJSON()}}))}function m(e,t){return o(this,null,(function*(){try{if(importScripts(e),!self[t])throw new Error("Broken index file format");yield g(self[t])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function g(e){return o(this,null,(function*(){h=e.store,l(i.Index.load(e.index))}))}function x(){return o(this,null,(function*(){h=[],d()}))}function R(e,t=0){return o(this,null,(function*(){if(0===e.trim().length)return[];let r=(yield c).query((t=>{e.trim().toLowerCase().split(/\s+/).forEach((e=>{if(1===e.length)return;const r=(e=>"*"+i.stemmer(new i.Token(e,{}))+"*")(e);t.term(r,{})}))}));return t>0&&(r=r.slice(0,t)),r.map((e=>({meta:h[e.ref],score:e.score})))}))}i.tokenizer.separator=/\s+/,d()},336:(e,t,r)=>{var i,n;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,R,v,w,Q,k,S,E,b,L,P,T,O,I=function(e){var t=new I.Builder;return t.pipeline.add(I.trimmer,I.stopWordFilter,I.stemmer),t.searchPipeline.add(I.stemmer),e.call(t,t),t.build()};I.version="2.3.9",I.utils={},I.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),I.utils.asString=function(e){return null==e?"":e.toString()},I.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},I.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},I.FieldRef.joiner="/",I.FieldRef.fromString=function(e){var t=e.indexOf(I.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new I.FieldRef(i,r,e)},I.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+I.FieldRef.joiner+this.docRef),this._stringValue},I.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},I.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},I.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},I.Set.prototype.contains=function(e){return!!this.elements[e]},I.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===I.Set.complete)return this;if(e===I.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new I.Set(n)},I.Set.prototype.union=function(e){return e===I.Set.complete?I.Set.complete:e===I.Set.empty?this:new I.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},I.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},I.Token=function(e,t){this.str=e||"",this.metadata=t||{}},I.Token.prototype.toString=function(){return this.str},I.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},I.Token.prototype.clone=function(e){return e=e||function(e){return e},new I.Token(e(this.str,this.metadata),this.metadata)},I.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new I.Token(I.utils.asString(e).toLowerCase(),I.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(I.tokenizer.separator)||s==i){if(a>0){var u=I.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new I.Token(r.slice(o,s),u))}o=s+1}}return n},I.tokenizer.separator=/[\s\-]+/,I.Pipeline=function(){this._stack=[]},I.Pipeline.registeredFunctions=Object.create(null),I.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&I.utils.warn("Overwriting existing registered function: "+t),e.label=t,I.Pipeline.registeredFunctions[e.label]=e},I.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||I.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},I.Pipeline.load=function(e){var t=new I.Pipeline;return e.forEach((function(e){var r=I.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},I.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){I.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},I.Pipeline.prototype.after=function(e,t){I.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},I.Pipeline.prototype.before=function(e,t){I.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},I.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},I.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},I.Pipeline.prototype.runString=function(e,t){var r=new I.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},I.Pipeline.prototype.reset=function(){this._stack=[]},I.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return I.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},I.Vector=function(e){this._magnitude=0,this.elements=e||[]},I.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},I.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},I.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},I.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},I.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},I.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},I.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},I.Vector.prototype.toJSON=function(){return this.elements},I.stemmer=(o={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},u="[aeiouy]",l="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,x=/.$/,R=/(at|bl|iz)$/,v=new RegExp("([^aeiouylsz])\\1$"),w=new RegExp("^"+l+u+"[^aeiouwxy]$"),Q=/^(.+?[^aeiou])y$/,k=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,S=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,E=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,b=/^(.+?)(s|t)(ion)$/,L=/^(.+?)e$/,P=/ll$/,T=new RegExp("^"+l+u+"[^aeiouwxy]$"),O=function(e){var t,r,i,n,s,u,l;if(e.length<3)return e;if("y"==(i=e.substr(0,1))&&(e=i.toUpperCase()+e.substr(1)),s=y,(n=p).test(e)?e=e.replace(n,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=g,(n=m).test(e)){var O=n.exec(e);(n=c).test(O[1])&&(n=x,e=e.replace(n,""))}else s.test(e)&&(t=(O=s.exec(e))[1],(s=f).test(t)&&(u=v,l=w,(s=R).test(e=t)?e+="e":u.test(e)?(n=x,e=e.replace(n,"")):l.test(e)&&(e+="e")));return(n=Q).test(e)&&(e=(t=(O=n.exec(e))[1])+"i"),(n=k).test(e)&&(t=(O=n.exec(e))[1],r=O[2],(n=c).test(t)&&(e=t+o[r])),(n=S).test(e)&&(t=(O=n.exec(e))[1],r=O[2],(n=c).test(t)&&(e=t+a[r])),s=b,(n=E).test(e)?(t=(O=n.exec(e))[1],(n=h).test(t)&&(e=t)):s.test(e)&&(t=(O=s.exec(e))[1]+O[2],(s=h).test(t)&&(e=t)),(n=L).test(e)&&(t=(O=n.exec(e))[1],s=d,u=T,((n=h).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=h,(n=P).test(e)&&s.test(e)&&(n=x,e=e.replace(n,"")),"y"==i&&(e=i.toLowerCase()+e.substr(1)),e},function(e){return e.update(O)}),I.Pipeline.registerFunction(I.stemmer,"stemmer"),I.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},I.stopWordFilter=I.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),I.Pipeline.registerFunction(I.stopWordFilter,"stopWordFilter"),I.trimmer=function(e){return e.update((function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")}))},I.Pipeline.registerFunction(I.trimmer,"trimmer"),I.TokenSet=function(){this.final=!1,this.edges={},this.id=I.TokenSet._nextId,I.TokenSet._nextId+=1},I.TokenSet._nextId=1,I.TokenSet.fromArray=function(e){for(var t=new I.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},I.TokenSet.fromClause=function(e){return"editDistance"in e?I.TokenSet.fromFuzzyString(e.term,e.editDistance):I.TokenSet.fromString(e.term)},I.TokenSet.fromFuzzyString=function(e,t){for(var r=new I.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new I.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else a=new I.TokenSet,n.node.edges["*"]=a;if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else u=new I.TokenSet,n.node.edges["*"]=u;1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new I.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},I.TokenSet.fromString=function(e){for(var t=new I.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new I.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},I.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},I.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},I.TokenSet.prototype.intersect=function(e){for(var t=new I.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new I.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},I.TokenSet.Builder=function(){this.previousWord="",this.root=new I.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},I.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,i=r;i<e.length;i++){var n=new I.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},I.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},I.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},I.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},I.Index.prototype.search=function(e){return this.query((function(t){new I.QueryParser(e,t).parse()}))},I.Index.prototype.query=function(e){for(var t=new I.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new I.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=I.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=I.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===I.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[F=l.fields[y]]=I.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],R=x._index;for(y=0;y<l.fields.length;y++){var v=x[F=l.fields[y]],w=Object.keys(v),Q=g+"/"+F,k=new I.Set(w);if(l.presence==I.Query.presence.REQUIRED&&(c=c.union(k),void 0===s[F]&&(s[F]=I.Set.complete)),l.presence!=I.Query.presence.PROHIBITED){if(i[F].upsert(R,l.boost,(function(e,t){return e+t})),!n[Q]){for(var S=0;S<w.length;S++){var E,b=w[S],L=new I.FieldRef(b,F),P=v[b];void 0===(E=r[L])?r[L]=new I.MatchData(g,F,P):E.add(g,F,P)}n[Q]=!0}}else void 0===o[F]&&(o[F]=I.Set.empty),o[F]=o[F].union(k)}}}if(l.presence===I.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[F=l.fields[y]]=s[F].intersect(c)}var T=I.Set.complete,O=I.Set.empty;for(a=0;a<this.fields.length;a++){var F;s[F=this.fields[a]]&&(T=T.intersect(s[F])),o[F]&&(O=O.union(o[F]))}var C=Object.keys(r),j=[],N=Object.create(null);if(t.isNegated())for(C=Object.keys(this.fieldVectors),a=0;a<C.length;a++){L=C[a];var _=I.FieldRef.fromString(L);r[L]=new I.MatchData}for(a=0;a<C.length;a++){var D=(_=I.FieldRef.fromString(C[a])).docRef;if(T.contains(D)&&!O.contains(D)){var A,B=this.fieldVectors[_],V=i[_.fieldName].similarity(B);if(void 0!==(A=N[D]))A.score+=V,A.matchData.combine(r[_]);else{var z={ref:D,score:V,matchData:r[_]};N[D]=z,j.push(z)}}}return j.sort((function(e,t){return t.score-e.score}))},I.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:I.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},I.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new I.TokenSet.Builder,a=I.Pipeline.load(e.pipeline);e.version!=I.version&&I.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+I.version+"' does not match serialized index '"+e.version+"'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new I.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new I.Index(t)},I.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=I.tokenizer,this.pipeline=new I.Pipeline,this.searchPipeline=new I.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},I.Builder.prototype.ref=function(e){this._ref=e},I.Builder.prototype.field=function(e,t){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},I.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},I.Builder.prototype.k1=function(e){this._k1=e},I.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new I.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},I.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=I.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},I.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=I.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new I.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],R=l[x],v=this.invertedIndex[x]._index;void 0===i[x]?(y=I.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*R)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+R),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(v,g)}e[s]=u}this.fieldVectors=e},I.Builder.prototype.createTokenSet=function(){this.tokenSet=I.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},I.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new I.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},I.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},I.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},I.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},I.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},I.Query=function(e){this.clauses=[],this.allFields=e},I.Query.wildcard=new String("*"),I.Query.wildcard.NONE=0,I.Query.wildcard.LEADING=1,I.Query.wildcard.TRAILING=2,I.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},I.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=I.Query.wildcard.NONE),e.wildcard&I.Query.wildcard.LEADING&&e.term.charAt(0)!=I.Query.wildcard&&(e.term="*"+e.term),e.wildcard&I.Query.wildcard.TRAILING&&e.term.slice(-1)!=I.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=I.Query.presence.OPTIONAL),this.clauses.push(e),this},I.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=I.Query.presence.PROHIBITED)return!1;return!0},I.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,I.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},I.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},I.QueryParseError.prototype=new Error,I.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},I.QueryLexer.prototype.run=function(){for(var e=I.QueryLexer.lexText;e;)e=e(this)},I.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},I.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},I.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},I.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return I.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},I.QueryLexer.prototype.width=function(){return this.pos-this.start},I.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},I.QueryLexer.prototype.backup=function(){this.pos-=1},I.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=I.QueryLexer.EOS&&this.backup()},I.QueryLexer.prototype.more=function(){return this.pos<this.length},I.QueryLexer.EOS="EOS",I.QueryLexer.FIELD="FIELD",I.QueryLexer.TERM="TERM",I.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",I.QueryLexer.BOOST="BOOST",I.QueryLexer.PRESENCE="PRESENCE",I.QueryLexer.lexField=function(e){return e.backup(),e.emit(I.QueryLexer.FIELD),e.ignore(),I.QueryLexer.lexText},I.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(I.QueryLexer.TERM)),e.ignore(),e.more())return I.QueryLexer.lexText},I.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(I.QueryLexer.EDIT_DISTANCE),I.QueryLexer.lexText},I.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(I.QueryLexer.BOOST),I.QueryLexer.lexText},I.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(I.QueryLexer.TERM)},I.QueryLexer.termSeparator=I.tokenizer.separator,I.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==I.QueryLexer.EOS)return I.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return I.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(I.QueryLexer.TERM),I.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(I.QueryLexer.TERM),I.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(I.QueryLexer.PRESENCE),I.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(I.QueryLexer.PRESENCE),I.QueryLexer.lexText;if(t.match(I.QueryLexer.termSeparator))return I.QueryLexer.lexTerm}else e.escapeCharacter()}},I.QueryParser=function(e,t){this.lexer=new I.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},I.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=I.QueryParser.parseClause;e;)e=e(this);return this.query},I.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},I.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},I.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},I.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case I.QueryLexer.PRESENCE:return I.QueryParser.parsePresence;case I.QueryLexer.FIELD:return I.QueryParser.parseField;case I.QueryLexer.TERM:return I.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value '"+t.str+"'"),new I.QueryParseError(r,t.start,t.end)}},I.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=I.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=I.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+t.str+"'";throw new I.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i)throw r="expecting term or field, found nothing",new I.QueryParseError(r,t.start,t.end);switch(i.type){case I.QueryLexer.FIELD:return I.QueryParser.parseField;case I.QueryLexer.TERM:return I.QueryParser.parseTerm;default:throw r="expecting term or field, found '"+i.type+"'",new I.QueryParseError(r,i.start,i.end)}}},I.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"'"+e+"'"})).join(", "),i="unrecognised field '"+t.str+"', possible fields: "+r;throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n)throw i="expecting term, found nothing",new I.QueryParseError(i,t.start,t.end);if(n.type===I.QueryLexer.TERM)return I.QueryParser.parseTerm;throw i="expecting term, found '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}},I.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new I.QueryParseError(i,r.start,r.end)}else e.nextClause()}},I.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}else e.nextClause()}},I.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new I.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case I.QueryLexer.TERM:return e.nextClause(),I.QueryParser.parseTerm;case I.QueryLexer.FIELD:return e.nextClause(),I.QueryParser.parseField;case I.QueryLexer.EDIT_DISTANCE:return I.QueryParser.parseEditDistance;case I.QueryLexer.BOOST:return I.QueryParser.parseBoost;case I.QueryLexer.PRESENCE:return e.nextClause(),I.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new I.QueryParseError(i,n.start,n.end)}else e.nextClause()}},void 0===(n="function"==typeof(i=function(){return I})?i.call(t,r,t,e):i)||(e.exports=n)}()},567:(e,t,r)=>{var i=r(314),n=["add","done","toJS","fromExternalJS","load","dispose","search","Worker"];e.exports=function(){var e=new Worker(URL.createObjectURL(new Blob(['/*! For license information please see 1a77c0465d2508da59cb.worker.js.LICENSE.txt */\n(()=>{var e={336:(e,t,r)=>{var i,n;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,P,L,b,T,O,I,R=function(e){var t=new R.Builder;return t.pipeline.add(R.trimmer,R.stopWordFilter,R.stemmer),t.searchPipeline.add(R.stemmer),e.call(t,t),t.build()};R.version="2.3.9",R.utils={},R.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),R.utils.asString=function(e){return null==e?"":e.toString()},R.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},R.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},R.FieldRef.joiner="/",R.FieldRef.fromString=function(e){var t=e.indexOf(R.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new R.FieldRef(i,r,e)},R.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+R.FieldRef.joiner+this.docRef),this._stringValue},R.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},R.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},R.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},R.Set.prototype.contains=function(e){return!!this.elements[e]},R.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===R.Set.complete)return this;if(e===R.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new R.Set(n)},R.Set.prototype.union=function(e){return e===R.Set.complete?R.Set.complete:e===R.Set.empty?this:new R.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},R.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},R.Token=function(e,t){this.str=e||"",this.metadata=t||{}},R.Token.prototype.toString=function(){return this.str},R.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},R.Token.prototype.clone=function(e){return e=e||function(e){return e},new R.Token(e(this.str,this.metadata),this.metadata)},R.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new R.Token(R.utils.asString(e).toLowerCase(),R.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(R.tokenizer.separator)||s==i){if(a>0){var u=R.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new R.Token(r.slice(o,s),u))}o=s+1}}return n},R.tokenizer.separator=/[\\s\\-]+/,R.Pipeline=function(){this._stack=[]},R.Pipeline.registeredFunctions=Object.create(null),R.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&R.utils.warn("Overwriting existing registered function: "+t),e.label=t,R.Pipeline.registeredFunctions[e.label]=e},R.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||R.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\\n",e)},R.Pipeline.load=function(e){var t=new R.Pipeline;return e.forEach((function(e){var r=R.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},R.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){R.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},R.Pipeline.prototype.after=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},R.Pipeline.prototype.before=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},R.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},R.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},R.Pipeline.prototype.runString=function(e,t){var r=new R.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},R.Pipeline.prototype.reset=function(){this._stack=[]},R.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return R.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},R.Vector=function(e){this._magnitude=0,this.elements=e||[]},R.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},R.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},R.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},R.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},R.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},R.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},R.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},R.Vector.prototype.toJSON=function(){return this.elements},R.stemmer=(o={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},u="[aeiouy]",l="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),p=/^(.+?)(ss|i)es$/,y=/^(.+?)([^s])s$/,m=/^(.+?)eed$/,g=/^(.+?)(ed|ing)$/,x=/.$/,v=/(at|bl|iz)$/,w=new RegExp("([^aeiouylsz])\\\\1$"),Q=new RegExp("^"+l+u+"[^aeiouwxy]$"),k=/^(.+?[^aeiou])y$/,S=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,E=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,P=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,L=/^(.+?)(s|t)(ion)$/,b=/^(.+?)e$/,T=/ll$/,O=new RegExp("^"+l+u+"[^aeiouwxy]$"),I=function(e){var t,r,i,n,s,u,l;if(e.length<3)return e;if("y"==(i=e.substr(0,1))&&(e=i.toUpperCase()+e.substr(1)),s=y,(n=p).test(e)?e=e.replace(n,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=g,(n=m).test(e)){var I=n.exec(e);(n=c).test(I[1])&&(n=x,e=e.replace(n,""))}else s.test(e)&&(t=(I=s.exec(e))[1],(s=f).test(t)&&(u=w,l=Q,(s=v).test(e=t)?e+="e":u.test(e)?(n=x,e=e.replace(n,"")):l.test(e)&&(e+="e")));return(n=k).test(e)&&(e=(t=(I=n.exec(e))[1])+"i"),(n=S).test(e)&&(t=(I=n.exec(e))[1],r=I[2],(n=c).test(t)&&(e=t+o[r])),(n=E).test(e)&&(t=(I=n.exec(e))[1],r=I[2],(n=c).test(t)&&(e=t+a[r])),s=L,(n=P).test(e)?(t=(I=n.exec(e))[1],(n=h).test(t)&&(e=t)):s.test(e)&&(t=(I=s.exec(e))[1]+I[2],(s=h).test(t)&&(e=t)),(n=b).test(e)&&(t=(I=n.exec(e))[1],s=d,u=O,((n=h).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=h,(n=T).test(e)&&s.test(e)&&(n=x,e=e.replace(n,"")),"y"==i&&(e=i.toLowerCase()+e.substr(1)),e},function(e){return e.update(I)}),R.Pipeline.registerFunction(R.stemmer,"stemmer"),R.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},R.stopWordFilter=R.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),R.Pipeline.registerFunction(R.stopWordFilter,"stopWordFilter"),R.trimmer=function(e){return e.update((function(e){return e.replace(/^\\W+/,"").replace(/\\W+$/,"")}))},R.Pipeline.registerFunction(R.trimmer,"trimmer"),R.TokenSet=function(){this.final=!1,this.edges={},this.id=R.TokenSet._nextId,R.TokenSet._nextId+=1},R.TokenSet._nextId=1,R.TokenSet.fromArray=function(e){for(var t=new R.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},R.TokenSet.fromClause=function(e){return"editDistance"in e?R.TokenSet.fromFuzzyString(e.term,e.editDistance):R.TokenSet.fromString(e.term)},R.TokenSet.fromFuzzyString=function(e,t){for(var r=new R.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new R.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else a=new R.TokenSet,n.node.edges["*"]=a;if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else u=new R.TokenSet,n.node.edges["*"]=u;1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new R.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},R.TokenSet.fromString=function(e){for(var t=new R.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new R.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},R.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},R.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},R.TokenSet.prototype.intersect=function(e){for(var t=new R.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new R.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},R.TokenSet.Builder=function(){this.previousWord="",this.root=new R.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},R.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,i=r;i<e.length;i++){var n=new R.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},R.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},R.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},R.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},R.Index.prototype.search=function(e){return this.query((function(t){new R.QueryParser(e,t).parse()}))},R.Index.prototype.query=function(e){for(var t=new R.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new R.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=R.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=R.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===R.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[F=l.fields[y]]=R.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],v=x._index;for(y=0;y<l.fields.length;y++){var w=x[F=l.fields[y]],Q=Object.keys(w),k=g+"/"+F,S=new R.Set(Q);if(l.presence==R.Query.presence.REQUIRED&&(c=c.union(S),void 0===s[F]&&(s[F]=R.Set.complete)),l.presence!=R.Query.presence.PROHIBITED){if(i[F].upsert(v,l.boost,(function(e,t){return e+t})),!n[k]){for(var E=0;E<Q.length;E++){var P,L=Q[E],b=new R.FieldRef(L,F),T=w[L];void 0===(P=r[b])?r[b]=new R.MatchData(g,F,T):P.add(g,F,T)}n[k]=!0}}else void 0===o[F]&&(o[F]=R.Set.empty),o[F]=o[F].union(S)}}}if(l.presence===R.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[F=l.fields[y]]=s[F].intersect(c)}var O=R.Set.complete,I=R.Set.empty;for(a=0;a<this.fields.length;a++){var F;s[F=this.fields[a]]&&(O=O.intersect(s[F])),o[F]&&(I=I.union(o[F]))}var C=Object.keys(r),N=[],j=Object.create(null);if(t.isNegated())for(C=Object.keys(this.fieldVectors),a=0;a<C.length;a++){b=C[a];var _=R.FieldRef.fromString(b);r[b]=new R.MatchData}for(a=0;a<C.length;a++){var D=(_=R.FieldRef.fromString(C[a])).docRef;if(O.contains(D)&&!I.contains(D)){var A,B=this.fieldVectors[_],z=i[_.fieldName].similarity(B);if(void 0!==(A=j[D]))A.score+=z,A.matchData.combine(r[_]);else{var V={ref:D,score:z,matchData:r[_]};j[D]=V,N.push(V)}}}return N.sort((function(e,t){return t.score-e.score}))},R.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:R.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},R.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new R.TokenSet.Builder,a=R.Pipeline.load(e.pipeline);e.version!=R.version&&R.utils.warn("Version mismatch when loading serialised index. Current version of lunr \'"+R.version+"\' does not match serialized index \'"+e.version+"\'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new R.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new R.Index(t)},R.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=R.tokenizer,this.pipeline=new R.Pipeline,this.searchPipeline=new R.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},R.Builder.prototype.ref=function(e){this._ref=e},R.Builder.prototype.field=function(e,t){if(/\\//.test(e))throw new RangeError("Field \'"+e+"\' contains illegal character \'/\'");this._fields[e]=t||{}},R.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},R.Builder.prototype.k1=function(e){this._k1=e},R.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new R.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},R.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=R.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},R.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=R.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new R.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],v=l[x],w=this.invertedIndex[x]._index;void 0===i[x]?(y=R.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+v),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(w,g)}e[s]=u}this.fieldVectors=e},R.Builder.prototype.createTokenSet=function(){this.tokenSet=R.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},R.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new R.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},R.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},R.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},R.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},R.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},R.Query=function(e){this.clauses=[],this.allFields=e},R.Query.wildcard=new String("*"),R.Query.wildcard.NONE=0,R.Query.wildcard.LEADING=1,R.Query.wildcard.TRAILING=2,R.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},R.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=R.Query.wildcard.NONE),e.wildcard&R.Query.wildcard.LEADING&&e.term.charAt(0)!=R.Query.wildcard&&(e.term="*"+e.term),e.wildcard&R.Query.wildcard.TRAILING&&e.term.slice(-1)!=R.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=R.Query.presence.OPTIONAL),this.clauses.push(e),this},R.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=R.Query.presence.PROHIBITED)return!1;return!0},R.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,R.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},R.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},R.QueryParseError.prototype=new Error,R.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},R.QueryLexer.prototype.run=function(){for(var e=R.QueryLexer.lexText;e;)e=e(this)},R.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},R.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},R.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},R.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return R.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},R.QueryLexer.prototype.width=function(){return this.pos-this.start},R.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},R.QueryLexer.prototype.backup=function(){this.pos-=1},R.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=R.QueryLexer.EOS&&this.backup()},R.QueryLexer.prototype.more=function(){return this.pos<this.length},R.QueryLexer.EOS="EOS",R.QueryLexer.FIELD="FIELD",R.QueryLexer.TERM="TERM",R.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",R.QueryLexer.BOOST="BOOST",R.QueryLexer.PRESENCE="PRESENCE",R.QueryLexer.lexField=function(e){return e.backup(),e.emit(R.QueryLexer.FIELD),e.ignore(),R.QueryLexer.lexText},R.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(R.QueryLexer.TERM)),e.ignore(),e.more())return R.QueryLexer.lexText},R.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.EDIT_DISTANCE),R.QueryLexer.lexText},R.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.BOOST),R.QueryLexer.lexText},R.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(R.QueryLexer.TERM)},R.QueryLexer.termSeparator=R.tokenizer.separator,R.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==R.QueryLexer.EOS)return R.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return R.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if(t.match(R.QueryLexer.termSeparator))return R.QueryLexer.lexTerm}else e.escapeCharacter()}},R.QueryParser=function(e,t){this.lexer=new R.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},R.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=R.QueryParser.parseClause;e;)e=e(this);return this.query},R.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},R.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},R.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},R.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case R.QueryLexer.PRESENCE:return R.QueryParser.parsePresence;case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value \'"+t.str+"\'"),new R.QueryParseError(r,t.start,t.end)}},R.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=R.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=R.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator\'"+t.str+"\'";throw new R.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i)throw r="expecting term or field, found nothing",new R.QueryParseError(r,t.start,t.end);switch(i.type){case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:throw r="expecting term or field, found \'"+i.type+"\'",new R.QueryParseError(r,i.start,i.end)}}},R.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"\'"+e+"\'"})).join(", "),i="unrecognised field \'"+t.str+"\', possible fields: "+r;throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n)throw i="expecting term, found nothing",new R.QueryParseError(i,t.start,t.end);if(n.type===R.QueryLexer.TERM)return R.QueryParser.parseTerm;throw i="expecting term, found \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}},R.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:var i="Unexpected lexeme type \'"+r.type+"\'";throw new R.QueryParseError(i,r.start,r.end)}else e.nextClause()}},R.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw i="Unexpected lexeme type \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}else e.nextClause()}},R.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new R.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw i="Unexpected lexeme type \'"+n.type+"\'",new R.QueryParseError(i,n.start,n.end)}else e.nextClause()}},void 0===(n="function"==typeof(i=function(){return R})?i.call(t,r,t,e):i)||(e.exports=n)}()}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var i={};(()=>{"use strict";r.d(i,{add:()=>l,done:()=>c,toJS:()=>h,fromExternalJS:()=>d,load:()=>f,dispose:()=>p,search:()=>y});var e=r(336),t=(Object.defineProperty,(e,t,r)=>new Promise(((i,n)=>{var s=e=>{try{a(r.next(e))}catch(e){n(e)}},o=e=>{try{a(r.throw(e))}catch(e){n(e)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())})));let n,s,o,a=[];function u(){n=new e.Builder,n.field("title"),n.field("description"),n.ref("ref"),n.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),o=new Promise((e=>{s=e}))}function l(e,t,r){const i=a.push(r)-1,s={title:e.toLowerCase(),description:t.toLowerCase(),ref:i};n.add(s)}function c(){return t(this,null,(function*(){s(n.build())}))}function h(){return t(this,null,(function*(){return{store:a,index:(yield o).toJSON()}}))}function d(e,r){return t(this,null,(function*(){try{if(importScripts(e),!self[r])throw new Error("Broken index file format");yield f(self[r])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function f(r){return t(this,null,(function*(){a=r.store,s(e.Index.load(r.index))}))}function p(){return t(this,null,(function*(){a=[],u()}))}function y(r,i=0){return t(this,null,(function*(){if(0===r.trim().length)return[];let t=(yield o).query((t=>{r.trim().toLowerCase().split(/\\s+/).forEach((r=>{if(1===r.length)return;const i=(t=>"*"+e.stemmer(new e.Token(t,{}))+"*")(r);t.term(i,{})}))}));return i>0&&(t=t.slice(0,i)),t.map((e=>({meta:a[e.ref],score:e.score})))}))}e.tokenizer.separator=/\\s+/,u(),addEventListener("message",(function(e){var t,r=e.data,n=r.type,s=r.method,o=r.id,a=r.params;"RPC"===n&&s&&((t=i[s])?Promise.resolve().then((function(){return t.apply(i,a)})):Promise.reject("No such method")).then((function(e){postMessage({type:"RPC",id:o,result:e})})).catch((function(e){var t={message:e};e.stack&&(t.message=e.message,t.stack=e.stack,t.name=e.name),postMessage({type:"RPC",id:o,error:t})}))})),postMessage({type:"RPC",method:"ready"})})()})();'])),{name:"[fullhash].worker.js"});return i(e,n),e}},314:e=>{e.exports=function(e,t){var r=0,i={};e.addEventListener("message",(function(t){var r=t.data;if("RPC"===r.type)if(r.id){var n=i[r.id];n&&(delete i[r.id],r.error?n[1](Object.assign(Error(r.error.message),r.error)):n[0](r.result))}else{var s=document.createEvent("Event");s.initEvent(r.method,!1,!1),s.data=r.params,e.dispatchEvent(s)}})),t.forEach((function(t){e[t]=function(){var n=arguments;return new Promise((function(s,o){var a=++r;i[a]=[s,o],e.postMessage({type:"RPC",id:a,method:t,params:[].slice.call(n)})}))}}))}}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{SearchStore:()=>n});const e="undefined"!=typeof window&&"HTMLElement"in window;"undefined"==typeof Element||Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(e){e=0===arguments.length||!!e;const t=this.parentNode,r=window.getComputedStyle(t,void 0),i=parseInt(r.getPropertyValue("border-top-width"),10),n=parseInt(r.getPropertyValue("border-left-width"),10),s=this.offsetTop-t.offsetTop<t.scrollTop,o=this.offsetTop-t.offsetTop+this.clientHeight-i>t.scrollTop+t.clientHeight,a=this.offsetLeft-t.offsetLeft<t.scrollLeft,u=this.offsetLeft-t.offsetLeft+this.clientWidth-n>t.scrollLeft+t.clientWidth,l=s&&!o;(s||o)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-i+this.clientHeight/2),(a||u)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-n+this.clientWidth/2),(s||o||a||u)&&!e&&this.scrollIntoView(l)});var t=Object.defineProperty;class n{constructor(){var i,n,s;i=this,n="searchWorker",s=function(){let t;if(e)try{t=r(567)}catch(e){t=r(27).ZP}else t=r(27).ZP;return new t}(),((e,r,i)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i})(i,"symbol"!=typeof n?n+"":n,s)}indexItems(e){const t=e=>{e.forEach((e=>{"group"!==e.type&&this.add(e.name,e.description||"",e.id),t(e.items)}))};t(e),this.searchWorker.done()}add(e,t,r){this.searchWorker.add(e,t,r)}dispose(){this.searchWorker.terminate(),this.searchWorker.dispose()}search(e){return this.searchWorker.search(e)}toJS(){return e=this,null,t=function*(){return this.searchWorker.toJS()},new Promise(((r,i)=>{var n=e=>{try{o(t.next(e))}catch(e){i(e)}},s=e=>{try{o(t.throw(e))}catch(e){i(e)}},o=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,s);o((t=t.apply(e,null)).next())}));var e,t}load(e){this.searchWorker.load(e)}fromExternalJS(e,t){e&&t&&this.searchWorker.fromExternalJS(e,t)}}})(),i})()}));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SearchStore=t():e.SearchStore=t()}(this,(()=>(()=>{var e={7:e=>{e.exports=function(e,t){var r=0,i={};e.addEventListener("message",(function(t){var r=t.data;if("RPC"===r.type)if(r.id){var n=i[r.id];n&&(delete i[r.id],r.error?n[1](Object.assign(Error(r.error.message),r.error)):n[0](r.result))}else{var s=document.createEvent("Event");s.initEvent(r.method,!1,!1),s.data=r.params,e.dispatchEvent(s)}})),t.forEach((function(t){e[t]=function(){var n=arguments;return new Promise((function(s,o){var a=++r;i[a]=[s,o],e.postMessage({type:"RPC",id:a,method:t,params:[].slice.call(n)})}))}}))}},291:(e,t,r)=>{var i,n;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,j,w,Q,k,S,E,b,L,P,T,O,R,I,F,C,N=function(e){var t=new N.Builder;return t.pipeline.add(N.trimmer,N.stopWordFilter,N.stemmer),t.searchPipeline.add(N.stemmer),e.call(t,t),t.build()};N.version="2.3.9",N.utils={},N.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),N.utils.asString=function(e){return null==e?"":e.toString()},N.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},N.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},N.FieldRef.joiner="/",N.FieldRef.fromString=function(e){var t=e.indexOf(N.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),i=e.slice(t+1);return new N.FieldRef(i,r,e)},N.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+N.FieldRef.joiner+this.docRef),this._stringValue},N.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},N.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},N.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},N.Set.prototype.contains=function(e){return!!this.elements[e]},N.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===N.Set.complete)return this;if(e===N.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new N.Set(n)},N.Set.prototype.union=function(e){return e===N.Set.complete?N.Set.complete:e===N.Set.empty?this:new N.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},N.idf=function(e,t){var r=0;for(var i in e)"_index"!=i&&(r+=Object.keys(e[i]).length);var n=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(n))},N.Token=function(e,t){this.str=e||"",this.metadata=t||{}},N.Token.prototype.toString=function(){return this.str},N.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},N.Token.prototype.clone=function(e){return e=e||function(e){return e},new N.Token(e(this.str,this.metadata),this.metadata)},N.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new N.Token(N.utils.asString(e).toLowerCase(),N.utils.clone(t))}));for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a=s-o;if(r.charAt(s).match(N.tokenizer.separator)||s==i){if(a>0){var u=N.utils.clone(t)||{};u.position=[o,a],u.index=n.length,n.push(new N.Token(r.slice(o,s),u))}o=s+1}}return n},N.tokenizer.separator=/[\s\-]+/,N.Pipeline=function(){this._stack=[]},N.Pipeline.registeredFunctions=Object.create(null),N.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&N.utils.warn("Overwriting existing registered function: "+t),e.label=t,N.Pipeline.registeredFunctions[e.label]=e},N.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||N.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},N.Pipeline.load=function(e){var t=new N.Pipeline;return e.forEach((function(e){var r=N.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},N.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach((function(e){N.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},N.Pipeline.prototype.after=function(e,t){N.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},N.Pipeline.prototype.before=function(e,t){N.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},N.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},N.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var i=this._stack[r],n=[],s=0;s<e.length;s++){var o=i(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)n.push(o[a]);else n.push(o)}e=n}return e},N.Pipeline.prototype.runString=function(e,t){var r=new N.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},N.Pipeline.prototype.reset=function(){this._stack=[]},N.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return N.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},N.Vector=function(e){this._magnitude=0,this.elements=e||[]},N.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,i=r-t,n=Math.floor(i/2),s=this.elements[2*n];i>1&&(s<e&&(t=n),s>e&&(r=n),s!=e);)i=r-t,n=t+Math.floor(i/2),s=this.elements[2*n];return s==e||s>e?2*n:s<e?2*(n+1):void 0},N.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},N.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var i=this.positionForIndex(e);this.elements[i]==e?this.elements[i+1]=r(this.elements[i+1],t):this.elements.splice(i,0,e,t)},N.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var i=this.elements[r];e+=i*i}return this._magnitude=Math.sqrt(e)},N.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,i=e.elements,n=r.length,s=i.length,o=0,a=0,u=0,l=0;u<n&&l<s;)(o=r[u])<(a=i[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*i[l+1],u+=2,l+=2);return t},N.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},N.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},N.Vector.prototype.toJSON=function(){return this.elements},N.stemmer=(o={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},h="^("+(l="[^aeiou][^aeiouy]*")+")?"+(c=(u="[aeiouy]")+"[aeiou]*")+l+"("+c+")?$",d="^("+l+")?"+c+l+c+l,f="^("+l+")?"+u,p=new RegExp("^("+l+")?"+c+l),y=new RegExp(d),m=new RegExp(h),g=new RegExp(f),x=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,j=/^(.+?)eed$/,w=/^(.+?)(ed|ing)$/,Q=/.$/,k=/(at|bl|iz)$/,S=new RegExp("([^aeiouylsz])\\1$"),E=new RegExp("^"+l+u+"[^aeiouwxy]$"),b=/^(.+?[^aeiou])y$/,L=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,P=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,T=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,O=/^(.+?)(s|t)(ion)$/,R=/^(.+?)e$/,I=/ll$/,F=new RegExp("^"+l+u+"[^aeiouwxy]$"),C=function(e){var t,r,i,n,s,u,l;if(e.length<3)return e;if("y"==(i=e.substr(0,1))&&(e=i.toUpperCase()+e.substr(1)),s=v,(n=x).test(e)?e=e.replace(n,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=w,(n=j).test(e)){var c=n.exec(e);(n=p).test(c[1])&&(n=Q,e=e.replace(n,""))}else s.test(e)&&(t=(c=s.exec(e))[1],(s=g).test(t)&&(u=S,l=E,(s=k).test(e=t)?e+="e":u.test(e)?(n=Q,e=e.replace(n,"")):l.test(e)&&(e+="e")));return(n=b).test(e)&&(e=(t=(c=n.exec(e))[1])+"i"),(n=L).test(e)&&(t=(c=n.exec(e))[1],r=c[2],(n=p).test(t)&&(e=t+o[r])),(n=P).test(e)&&(t=(c=n.exec(e))[1],r=c[2],(n=p).test(t)&&(e=t+a[r])),s=O,(n=T).test(e)?(t=(c=n.exec(e))[1],(n=y).test(t)&&(e=t)):s.test(e)&&(t=(c=s.exec(e))[1]+c[2],(s=y).test(t)&&(e=t)),(n=R).test(e)&&(t=(c=n.exec(e))[1],s=m,u=F,((n=y).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=y,(n=I).test(e)&&s.test(e)&&(n=Q,e=e.replace(n,"")),"y"==i&&(e=i.toLowerCase()+e.substr(1)),e},function(e){return e.update(C)}),N.Pipeline.registerFunction(N.stemmer,"stemmer"),N.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},N.stopWordFilter=N.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),N.Pipeline.registerFunction(N.stopWordFilter,"stopWordFilter"),N.trimmer=function(e){return e.update((function(e){return e.replace(/^\W+/,"").replace(/\W+$/,"")}))},N.Pipeline.registerFunction(N.trimmer,"trimmer"),N.TokenSet=function(){this.final=!1,this.edges={},this.id=N.TokenSet._nextId,N.TokenSet._nextId+=1},N.TokenSet._nextId=1,N.TokenSet.fromArray=function(e){for(var t=new N.TokenSet.Builder,r=0,i=e.length;r<i;r++)t.insert(e[r]);return t.finish(),t.root},N.TokenSet.fromClause=function(e){return"editDistance"in e?N.TokenSet.fromFuzzyString(e.term,e.editDistance):N.TokenSet.fromString(e.term)},N.TokenSet.fromFuzzyString=function(e,t){for(var r=new N.TokenSet,i=[{node:r,editsRemaining:t,str:e}];i.length;){var n=i.pop();if(n.str.length>0){var s,o=n.str.charAt(0);o in n.node.edges?s=n.node.edges[o]:(s=new N.TokenSet,n.node.edges[o]=s),1==n.str.length&&(s.final=!0),i.push({node:s,editsRemaining:n.editsRemaining,str:n.str.slice(1)})}if(0!=n.editsRemaining){if("*"in n.node.edges)var a=n.node.edges["*"];else a=new N.TokenSet,n.node.edges["*"]=a;if(0==n.str.length&&(a.final=!0),i.push({node:a,editsRemaining:n.editsRemaining-1,str:n.str}),n.str.length>1&&i.push({node:n.node,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)}),1==n.str.length&&(n.node.final=!0),n.str.length>=1){if("*"in n.node.edges)var u=n.node.edges["*"];else u=new N.TokenSet,n.node.edges["*"]=u;1==n.str.length&&(u.final=!0),i.push({node:u,editsRemaining:n.editsRemaining-1,str:n.str.slice(1)})}if(n.str.length>1){var l,c=n.str.charAt(0),h=n.str.charAt(1);h in n.node.edges?l=n.node.edges[h]:(l=new N.TokenSet,n.node.edges[h]=l),1==n.str.length&&(l.final=!0),i.push({node:l,editsRemaining:n.editsRemaining-1,str:c+n.str.slice(2)})}}}return r},N.TokenSet.fromString=function(e){for(var t=new N.TokenSet,r=t,i=0,n=e.length;i<n;i++){var s=e[i],o=i==n-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new N.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},N.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),i=Object.keys(r.node.edges),n=i.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<n;s++){var o=i[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},N.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,i=0;i<r;i++){var n=t[i];e=e+n+this.edges[n].id}return e},N.TokenSet.prototype.intersect=function(e){for(var t=new N.TokenSet,r=void 0,i=[{qNode:e,output:t,node:this}];i.length;){r=i.pop();for(var n=Object.keys(r.qNode.edges),s=n.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=n[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new N.TokenSet).final=p,r.output.edges[h]=y),i.push({qNode:f,output:y,node:d})}}}return t},N.TokenSet.Builder=function(){this.previousWord="",this.root=new N.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},N.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var i=0;i<e.length&&i<this.previousWord.length&&e[i]==this.previousWord[i];i++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,i=r;i<e.length;i++){var n=new N.TokenSet,s=e[i];t.edges[s]=n,this.uncheckedNodes.push({parent:t,char:s,child:n}),t=n}t.final=!0,this.previousWord=e},N.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},N.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}},N.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},N.Index.prototype.search=function(e){return this.query((function(t){new N.QueryParser(e,t).parse()}))},N.Index.prototype.query=function(e){for(var t=new N.Query(this.fields),r=Object.create(null),i=Object.create(null),n=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)i[this.fields[a]]=new N.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=N.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=N.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===N.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[R=l.fields[y]]=N.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],v=x._index;for(y=0;y<l.fields.length;y++){var j=x[R=l.fields[y]],w=Object.keys(j),Q=g+"/"+R,k=new N.Set(w);if(l.presence==N.Query.presence.REQUIRED&&(c=c.union(k),void 0===s[R]&&(s[R]=N.Set.complete)),l.presence!=N.Query.presence.PROHIBITED){if(i[R].upsert(v,l.boost,(function(e,t){return e+t})),!n[Q]){for(var S=0;S<w.length;S++){var E,b=w[S],L=new N.FieldRef(b,R),P=j[b];void 0===(E=r[L])?r[L]=new N.MatchData(g,R,P):E.add(g,R,P)}n[Q]=!0}}else void 0===o[R]&&(o[R]=N.Set.empty),o[R]=o[R].union(k)}}}if(l.presence===N.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[R=l.fields[y]]=s[R].intersect(c)}var T=N.Set.complete,O=N.Set.empty;for(a=0;a<this.fields.length;a++){var R;s[R=this.fields[a]]&&(T=T.intersect(s[R])),o[R]&&(O=O.union(o[R]))}var I=Object.keys(r),F=[],C=Object.create(null);if(t.isNegated())for(I=Object.keys(this.fieldVectors),a=0;a<I.length;a++){L=I[a];var _=N.FieldRef.fromString(L);r[L]=new N.MatchData}for(a=0;a<I.length;a++){var D=(_=N.FieldRef.fromString(I[a])).docRef;if(T.contains(D)&&!O.contains(D)){var A,B=this.fieldVectors[_],V=i[_.fieldName].similarity(B);if(void 0!==(A=C[D]))A.score+=V,A.matchData.combine(r[_]);else{var z={ref:D,score:V,matchData:r[_]};C[D]=z,F.push(z)}}}return F.sort((function(e,t){return t.score-e.score}))},N.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:N.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},N.Index.load=function(e){var t={},r={},i=e.fieldVectors,n=Object.create(null),s=e.invertedIndex,o=new N.TokenSet.Builder,a=N.Pipeline.load(e.pipeline);e.version!=N.version&&N.utils.warn("Version mismatch when loading serialised index. Current version of lunr '"+N.version+"' does not match serialized index '"+e.version+"'");for(var u=0;u<i.length;u++){var l=(h=i[u])[0],c=h[1];r[l]=new N.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),n[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=n,t.tokenSet=o.root,t.pipeline=a,new N.Index(t)},N.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=N.tokenizer,this.pipeline=new N.Pipeline,this.searchPipeline=new N.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},N.Builder.prototype.ref=function(e){this._ref=e},N.Builder.prototype.field=function(e,t){if(/\//.test(e))throw new RangeError("Field '"+e+"' contains illegal character '/'");this._fields[e]=t||{}},N.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},N.Builder.prototype.k1=function(e){this._k1=e},N.Builder.prototype.add=function(e,t){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var n=0;n<i.length;n++){var s=i[n],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new N.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<i.length;y++)p[i[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},N.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},i={},n=0;n<t;n++){var s=N.FieldRef.fromString(e[n]),o=s.fieldName;i[o]||(i[o]=0),i[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(n=0;n<a.length;n++){var u=a[n];r[u]=r[u]/i[u]}this.averageFieldLength=r},N.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,i=Object.create(null),n=0;n<r;n++){for(var s=N.FieldRef.fromString(t[n]),o=s.fieldName,a=this.fieldLengths[s],u=new N.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],v=l[x],j=this.invertedIndex[x]._index;void 0===i[x]?(y=N.idf(this.invertedIndex[x],this.documentCount),i[x]=y):y=i[x],m=y*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+v),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(j,g)}e[s]=u}this.fieldVectors=e},N.Builder.prototype.createTokenSet=function(){this.tokenSet=N.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},N.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new N.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},N.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},N.MatchData=function(e,t,r){for(var i=Object.create(null),n=Object.keys(r||{}),s=0;s<n.length;s++){var o=n[s];i[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=i)},N.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var i=t[r],n=Object.keys(e.metadata[i]);null==this.metadata[i]&&(this.metadata[i]=Object.create(null));for(var s=0;s<n.length;s++){var o=n[s],a=Object.keys(e.metadata[i][o]);null==this.metadata[i][o]&&(this.metadata[i][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[i][o][l]?this.metadata[i][o][l]=e.metadata[i][o][l]:this.metadata[i][o][l]=this.metadata[i][o][l].concat(e.metadata[i][o][l])}}}},N.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var i=Object.keys(r),n=0;n<i.length;n++){var s=i[n];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},N.Query=function(e){this.clauses=[],this.allFields=e},N.Query.wildcard=new String("*"),N.Query.wildcard.NONE=0,N.Query.wildcard.LEADING=1,N.Query.wildcard.TRAILING=2,N.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},N.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=N.Query.wildcard.NONE),e.wildcard&N.Query.wildcard.LEADING&&e.term.charAt(0)!=N.Query.wildcard&&(e.term="*"+e.term),e.wildcard&N.Query.wildcard.TRAILING&&e.term.slice(-1)!=N.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=N.Query.presence.OPTIONAL),this.clauses.push(e),this},N.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=N.Query.presence.PROHIBITED)return!1;return!0},N.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,N.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},N.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},N.QueryParseError.prototype=new Error,N.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},N.QueryLexer.prototype.run=function(){for(var e=N.QueryLexer.lexText;e;)e=e(this)},N.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,i=0;i<this.escapeCharPositions.length;i++)r=this.escapeCharPositions[i],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},N.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},N.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},N.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return N.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},N.QueryLexer.prototype.width=function(){return this.pos-this.start},N.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},N.QueryLexer.prototype.backup=function(){this.pos-=1},N.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=N.QueryLexer.EOS&&this.backup()},N.QueryLexer.prototype.more=function(){return this.pos<this.length},N.QueryLexer.EOS="EOS",N.QueryLexer.FIELD="FIELD",N.QueryLexer.TERM="TERM",N.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",N.QueryLexer.BOOST="BOOST",N.QueryLexer.PRESENCE="PRESENCE",N.QueryLexer.lexField=function(e){return e.backup(),e.emit(N.QueryLexer.FIELD),e.ignore(),N.QueryLexer.lexText},N.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(N.QueryLexer.TERM)),e.ignore(),e.more())return N.QueryLexer.lexText},N.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(N.QueryLexer.EDIT_DISTANCE),N.QueryLexer.lexText},N.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(N.QueryLexer.BOOST),N.QueryLexer.lexText},N.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(N.QueryLexer.TERM)},N.QueryLexer.termSeparator=N.tokenizer.separator,N.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==N.QueryLexer.EOS)return N.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return N.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(N.QueryLexer.TERM),N.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(N.QueryLexer.TERM),N.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(N.QueryLexer.PRESENCE),N.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(N.QueryLexer.PRESENCE),N.QueryLexer.lexText;if(t.match(N.QueryLexer.termSeparator))return N.QueryLexer.lexTerm}else e.escapeCharacter()}},N.QueryParser=function(e,t){this.lexer=new N.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},N.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=N.QueryParser.parseClause;e;)e=e(this);return this.query},N.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},N.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},N.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},N.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case N.QueryLexer.PRESENCE:return N.QueryParser.parsePresence;case N.QueryLexer.FIELD:return N.QueryParser.parseField;case N.QueryLexer.TERM:return N.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value '"+t.str+"'"),new N.QueryParseError(r,t.start,t.end)}},N.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=N.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=N.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+t.str+"'";throw new N.QueryParseError(r,t.start,t.end)}var i=e.peekLexeme();if(null==i)throw r="expecting term or field, found nothing",new N.QueryParseError(r,t.start,t.end);switch(i.type){case N.QueryLexer.FIELD:return N.QueryParser.parseField;case N.QueryLexer.TERM:return N.QueryParser.parseTerm;default:throw r="expecting term or field, found '"+i.type+"'",new N.QueryParseError(r,i.start,i.end)}}},N.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"'"+e+"'"})).join(", "),i="unrecognised field '"+t.str+"', possible fields: "+r;throw new N.QueryParseError(i,t.start,t.end)}e.currentClause.fields=[t.str];var n=e.peekLexeme();if(null==n)throw i="expecting term, found nothing",new N.QueryParseError(i,t.start,t.end);if(n.type===N.QueryLexer.TERM)return N.QueryParser.parseTerm;throw i="expecting term, found '"+n.type+"'",new N.QueryParseError(i,n.start,n.end)}},N.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case N.QueryLexer.TERM:return e.nextClause(),N.QueryParser.parseTerm;case N.QueryLexer.FIELD:return e.nextClause(),N.QueryParser.parseField;case N.QueryLexer.EDIT_DISTANCE:return N.QueryParser.parseEditDistance;case N.QueryLexer.BOOST:return N.QueryParser.parseBoost;case N.QueryLexer.PRESENCE:return e.nextClause(),N.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new N.QueryParseError(i,r.start,r.end)}else e.nextClause()}},N.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new N.QueryParseError(i,t.start,t.end)}e.currentClause.editDistance=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case N.QueryLexer.TERM:return e.nextClause(),N.QueryParser.parseTerm;case N.QueryLexer.FIELD:return e.nextClause(),N.QueryParser.parseField;case N.QueryLexer.EDIT_DISTANCE:return N.QueryParser.parseEditDistance;case N.QueryLexer.BOOST:return N.QueryParser.parseBoost;case N.QueryLexer.PRESENCE:return e.nextClause(),N.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new N.QueryParseError(i,n.start,n.end)}else e.nextClause()}},N.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var i="boost must be numeric";throw new N.QueryParseError(i,t.start,t.end)}e.currentClause.boost=r;var n=e.peekLexeme();if(null!=n)switch(n.type){case N.QueryLexer.TERM:return e.nextClause(),N.QueryParser.parseTerm;case N.QueryLexer.FIELD:return e.nextClause(),N.QueryParser.parseField;case N.QueryLexer.EDIT_DISTANCE:return N.QueryParser.parseEditDistance;case N.QueryLexer.BOOST:return N.QueryParser.parseBoost;case N.QueryLexer.PRESENCE:return e.nextClause(),N.QueryParser.parsePresence;default:throw i="Unexpected lexeme type '"+n.type+"'",new N.QueryParseError(i,n.start,n.end)}else e.nextClause()}},void 0===(n="function"==typeof(i=function(){return N})?i.call(t,r,t,e):i)||(e.exports=n)}()},586:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>a});var i=r(291),n=Object.defineProperty,s=(e,t,r)=>(((e,t,r)=>{t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r})(e,"symbol"!=typeof t?t+"":t,r),r),o=(e,t,r)=>new Promise(((i,n)=>{var s=e=>{try{a(r.next(e))}catch(e){n(e)}},o=e=>{try{a(r.throw(e))}catch(e){n(e)}},a=e=>e.done?i(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())}));class a{constructor(){s(this,"add",p),s(this,"done",y),s(this,"search",j),s(this,"toJS",m),s(this,"load",x),s(this,"dispose",v),s(this,"fromExternalJS",g)}}let u,l,c,h=[];function d(){u=new i.Builder,u.field("title"),u.field("description"),u.ref("ref"),u.pipeline.add(i.trimmer,i.stopWordFilter,i.stemmer),c=new Promise((e=>{l=e}))}i.tokenizer.separator=/\s+/,d();const f=e=>"*"+i.stemmer(new i.Token(e,{}))+"*";function p(e,t,r){const i=h.push(r)-1,n={title:e.toLowerCase(),description:t.toLowerCase(),ref:i};u.add(n)}function y(){return o(this,null,(function*(){l(u.build())}))}function m(){return o(this,null,(function*(){return{store:h,index:(yield c).toJSON()}}))}function g(e,t){return o(this,null,(function*(){try{if(importScripts(e),!self[t])throw new Error("Broken index file format");yield x(self[t])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function x(e){return o(this,null,(function*(){h=e.store,l(i.Index.load(e.index))}))}function v(){return o(this,null,(function*(){h=[],d()}))}function j(e,t=0){return o(this,null,(function*(){if(0===e.trim().length)return[];let r=(yield c).query((t=>{e.trim().toLowerCase().split(/\s+/).forEach((e=>{if(1===e.length)return;const r=f(e);t.term(r,{})}))}));return t>0&&(r=r.slice(0,t)),r.map((e=>({meta:h[e.ref],score:e.score})))}))}},680:(e,t,r)=>{var i=r(7),n=["add","done","toJS","fromExternalJS","load","dispose","search","Worker"];e.exports=function(){var e=new Worker(URL.createObjectURL(new Blob(['/*! For license information please see 6b04d896a01430ebd5f6.worker.js.LICENSE.txt */\n(()=>{var e={291:(e,t,r)=>{var n,i;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,P,L,b,T,O,I,R,F,C,N,j=function(e){var t=new j.Builder;return t.pipeline.add(j.trimmer,j.stopWordFilter,j.stemmer),t.searchPipeline.add(j.stemmer),e.call(t,t),t.build()};j.version="2.3.9",j.utils={},j.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),j.utils.asString=function(e){return null==e?"":e.toString()},j.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),n=0;n<r.length;n++){var i=r[n],s=e[i];if(Array.isArray(s))t[i]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[i]=s}}return t},j.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},j.FieldRef.joiner="/",j.FieldRef.fromString=function(e){var t=e.indexOf(j.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),n=e.slice(t+1);return new j.FieldRef(n,r,e)},j.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+j.FieldRef.joiner+this.docRef),this._stringValue},j.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},j.Set.complete={intersect:function(e){return e},union:function(){return this},contains:function(){return!0}},j.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},j.Set.prototype.contains=function(e){return!!this.elements[e]},j.Set.prototype.intersect=function(e){var t,r,n,i=[];if(e===j.Set.complete)return this;if(e===j.Set.empty)return e;this.length<e.length?(t=this,r=e):(t=e,r=this),n=Object.keys(t.elements);for(var s=0;s<n.length;s++){var o=n[s];o in r.elements&&i.push(o)}return new j.Set(i)},j.Set.prototype.union=function(e){return e===j.Set.complete?j.Set.complete:e===j.Set.empty?this:new j.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},j.idf=function(e,t){var r=0;for(var n in e)"_index"!=n&&(r+=Object.keys(e[n]).length);var i=(t-r+.5)/(r+.5);return Math.log(1+Math.abs(i))},j.Token=function(e,t){this.str=e||"",this.metadata=t||{}},j.Token.prototype.toString=function(){return this.str},j.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},j.Token.prototype.clone=function(e){return e=e||function(e){return e},new j.Token(e(this.str,this.metadata),this.metadata)},j.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map((function(e){return new j.Token(j.utils.asString(e).toLowerCase(),j.utils.clone(t))}));for(var r=e.toString().toLowerCase(),n=r.length,i=[],s=0,o=0;s<=n;s++){var a=s-o;if(r.charAt(s).match(j.tokenizer.separator)||s==n){if(a>0){var u=j.utils.clone(t)||{};u.position=[o,a],u.index=i.length,i.push(new j.Token(r.slice(o,s),u))}o=s+1}}return i},j.tokenizer.separator=/[\\s\\-]+/,j.Pipeline=function(){this._stack=[]},j.Pipeline.registeredFunctions=Object.create(null),j.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&j.utils.warn("Overwriting existing registered function: "+t),e.label=t,j.Pipeline.registeredFunctions[e.label]=e},j.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||j.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\\n",e)},j.Pipeline.load=function(e){var t=new j.Pipeline;return e.forEach((function(e){var r=j.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},j.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach((function(e){j.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},j.Pipeline.prototype.after=function(e,t){j.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},j.Pipeline.prototype.before=function(e,t){j.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},j.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},j.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r<t;r++){for(var n=this._stack[r],i=[],s=0;s<e.length;s++){var o=n(e[s],s,e);if(null!=o&&""!==o)if(Array.isArray(o))for(var a=0;a<o.length;a++)i.push(o[a]);else i.push(o)}e=i}return e},j.Pipeline.prototype.runString=function(e,t){var r=new j.Token(e,t);return this.run([r]).map((function(e){return e.toString()}))},j.Pipeline.prototype.reset=function(){this._stack=[]},j.Pipeline.prototype.toJSON=function(){return this._stack.map((function(e){return j.Pipeline.warnIfFunctionNotRegistered(e),e.label}))},j.Vector=function(e){this._magnitude=0,this.elements=e||[]},j.Vector.prototype.positionForIndex=function(e){if(0==this.elements.length)return 0;for(var t=0,r=this.elements.length/2,n=r-t,i=Math.floor(n/2),s=this.elements[2*i];n>1&&(s<e&&(t=i),s>e&&(r=i),s!=e);)n=r-t,i=t+Math.floor(n/2),s=this.elements[2*i];return s==e||s>e?2*i:s<e?2*(i+1):void 0},j.Vector.prototype.insert=function(e,t){this.upsert(e,t,(function(){throw"duplicate index"}))},j.Vector.prototype.upsert=function(e,t,r){this._magnitude=0;var n=this.positionForIndex(e);this.elements[n]==e?this.elements[n+1]=r(this.elements[n+1],t):this.elements.splice(n,0,e,t)},j.Vector.prototype.magnitude=function(){if(this._magnitude)return this._magnitude;for(var e=0,t=this.elements.length,r=1;r<t;r+=2){var n=this.elements[r];e+=n*n}return this._magnitude=Math.sqrt(e)},j.Vector.prototype.dot=function(e){for(var t=0,r=this.elements,n=e.elements,i=r.length,s=n.length,o=0,a=0,u=0,l=0;u<i&&l<s;)(o=r[u])<(a=n[l])?u+=2:o>a?l+=2:o==a&&(t+=r[u+1]*n[l+1],u+=2,l+=2);return t},j.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},j.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t<this.elements.length;t+=2,r++)e[r]=this.elements[t];return e},j.Vector.prototype.toJSON=function(){return this.elements},j.stemmer=(o={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},a={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},h="^("+(l="[^aeiou][^aeiouy]*")+")?"+(c=(u="[aeiouy]")+"[aeiou]*")+l+"("+c+")?$",d="^("+l+")?"+c+l+c+l,f="^("+l+")?"+u,p=new RegExp("^("+l+")?"+c+l),y=new RegExp(d),m=new RegExp(h),g=new RegExp(f),x=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,w=/^(.+?)eed$/,Q=/^(.+?)(ed|ing)$/,k=/.$/,S=/(at|bl|iz)$/,E=new RegExp("([^aeiouylsz])\\\\1$"),P=new RegExp("^"+l+u+"[^aeiouwxy]$"),L=/^(.+?[^aeiou])y$/,b=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,T=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,O=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,I=/^(.+?)(s|t)(ion)$/,R=/^(.+?)e$/,F=/ll$/,C=new RegExp("^"+l+u+"[^aeiouwxy]$"),N=function(e){var t,r,n,i,s,u,l;if(e.length<3)return e;if("y"==(n=e.substr(0,1))&&(e=n.toUpperCase()+e.substr(1)),s=v,(i=x).test(e)?e=e.replace(i,"$1$2"):s.test(e)&&(e=e.replace(s,"$1$2")),s=Q,(i=w).test(e)){var c=i.exec(e);(i=p).test(c[1])&&(i=k,e=e.replace(i,""))}else s.test(e)&&(t=(c=s.exec(e))[1],(s=g).test(t)&&(u=E,l=P,(s=S).test(e=t)?e+="e":u.test(e)?(i=k,e=e.replace(i,"")):l.test(e)&&(e+="e")));return(i=L).test(e)&&(e=(t=(c=i.exec(e))[1])+"i"),(i=b).test(e)&&(t=(c=i.exec(e))[1],r=c[2],(i=p).test(t)&&(e=t+o[r])),(i=T).test(e)&&(t=(c=i.exec(e))[1],r=c[2],(i=p).test(t)&&(e=t+a[r])),s=I,(i=O).test(e)?(t=(c=i.exec(e))[1],(i=y).test(t)&&(e=t)):s.test(e)&&(t=(c=s.exec(e))[1]+c[2],(s=y).test(t)&&(e=t)),(i=R).test(e)&&(t=(c=i.exec(e))[1],s=m,u=C,((i=y).test(t)||s.test(t)&&!u.test(t))&&(e=t)),s=y,(i=F).test(e)&&s.test(e)&&(i=k,e=e.replace(i,"")),"y"==n&&(e=n.toLowerCase()+e.substr(1)),e},function(e){return e.update(N)}),j.Pipeline.registerFunction(j.stemmer,"stemmer"),j.generateStopWordFilter=function(e){var t=e.reduce((function(e,t){return e[t]=t,e}),{});return function(e){if(e&&t[e.toString()]!==e.toString())return e}},j.stopWordFilter=j.generateStopWordFilter(["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every","for","from","get","got","had","has","have","he","her","hers","him","his","how","however","i","if","in","into","is","it","its","just","least","let","like","likely","may","me","might","most","must","my","neither","no","nor","not","of","off","often","on","only","or","other","our","own","rather","said","say","says","she","should","since","so","some","than","that","the","their","them","then","there","these","they","this","tis","to","too","twas","us","wants","was","we","were","what","when","where","which","while","who","whom","why","will","with","would","yet","you","your"]),j.Pipeline.registerFunction(j.stopWordFilter,"stopWordFilter"),j.trimmer=function(e){return e.update((function(e){return e.replace(/^\\W+/,"").replace(/\\W+$/,"")}))},j.Pipeline.registerFunction(j.trimmer,"trimmer"),j.TokenSet=function(){this.final=!1,this.edges={},this.id=j.TokenSet._nextId,j.TokenSet._nextId+=1},j.TokenSet._nextId=1,j.TokenSet.fromArray=function(e){for(var t=new j.TokenSet.Builder,r=0,n=e.length;r<n;r++)t.insert(e[r]);return t.finish(),t.root},j.TokenSet.fromClause=function(e){return"editDistance"in e?j.TokenSet.fromFuzzyString(e.term,e.editDistance):j.TokenSet.fromString(e.term)},j.TokenSet.fromFuzzyString=function(e,t){for(var r=new j.TokenSet,n=[{node:r,editsRemaining:t,str:e}];n.length;){var i=n.pop();if(i.str.length>0){var s,o=i.str.charAt(0);o in i.node.edges?s=i.node.edges[o]:(s=new j.TokenSet,i.node.edges[o]=s),1==i.str.length&&(s.final=!0),n.push({node:s,editsRemaining:i.editsRemaining,str:i.str.slice(1)})}if(0!=i.editsRemaining){if("*"in i.node.edges)var a=i.node.edges["*"];else a=new j.TokenSet,i.node.edges["*"]=a;if(0==i.str.length&&(a.final=!0),n.push({node:a,editsRemaining:i.editsRemaining-1,str:i.str}),i.str.length>1&&n.push({node:i.node,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)}),1==i.str.length&&(i.node.final=!0),i.str.length>=1){if("*"in i.node.edges)var u=i.node.edges["*"];else u=new j.TokenSet,i.node.edges["*"]=u;1==i.str.length&&(u.final=!0),n.push({node:u,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)})}if(i.str.length>1){var l,c=i.str.charAt(0),h=i.str.charAt(1);h in i.node.edges?l=i.node.edges[h]:(l=new j.TokenSet,i.node.edges[h]=l),1==i.str.length&&(l.final=!0),n.push({node:l,editsRemaining:i.editsRemaining-1,str:c+i.str.slice(2)})}}}return r},j.TokenSet.fromString=function(e){for(var t=new j.TokenSet,r=t,n=0,i=e.length;n<i;n++){var s=e[n],o=n==i-1;if("*"==s)t.edges[s]=t,t.final=o;else{var a=new j.TokenSet;a.final=o,t.edges[s]=a,t=a}}return r},j.TokenSet.prototype.toArray=function(){for(var e=[],t=[{prefix:"",node:this}];t.length;){var r=t.pop(),n=Object.keys(r.node.edges),i=n.length;r.node.final&&(r.prefix.charAt(0),e.push(r.prefix));for(var s=0;s<i;s++){var o=n[s];t.push({prefix:r.prefix.concat(o),node:r.node.edges[o]})}}return e},j.TokenSet.prototype.toString=function(){if(this._str)return this._str;for(var e=this.final?"1":"0",t=Object.keys(this.edges).sort(),r=t.length,n=0;n<r;n++){var i=t[n];e=e+i+this.edges[i].id}return e},j.TokenSet.prototype.intersect=function(e){for(var t=new j.TokenSet,r=void 0,n=[{qNode:e,output:t,node:this}];n.length;){r=n.pop();for(var i=Object.keys(r.qNode.edges),s=i.length,o=Object.keys(r.node.edges),a=o.length,u=0;u<s;u++)for(var l=i[u],c=0;c<a;c++){var h=o[c];if(h==l||"*"==l){var d=r.node.edges[h],f=r.qNode.edges[l],p=d.final&&f.final,y=void 0;h in r.output.edges?(y=r.output.edges[h]).final=y.final||p:((y=new j.TokenSet).final=p,r.output.edges[h]=y),n.push({qNode:f,output:y,node:d})}}}return t},j.TokenSet.Builder=function(){this.previousWord="",this.root=new j.TokenSet,this.uncheckedNodes=[],this.minimizedNodes={}},j.TokenSet.Builder.prototype.insert=function(e){var t,r=0;if(e<this.previousWord)throw new Error("Out of order word insertion");for(var n=0;n<e.length&&n<this.previousWord.length&&e[n]==this.previousWord[n];n++)r++;for(this.minimize(r),t=0==this.uncheckedNodes.length?this.root:this.uncheckedNodes[this.uncheckedNodes.length-1].child,n=r;n<e.length;n++){var i=new j.TokenSet,s=e[n];t.edges[s]=i,this.uncheckedNodes.push({parent:t,char:s,child:i}),t=i}t.final=!0,this.previousWord=e},j.TokenSet.Builder.prototype.finish=function(){this.minimize(0)},j.TokenSet.Builder.prototype.minimize=function(e){for(var t=this.uncheckedNodes.length-1;t>=e;t--){var r=this.uncheckedNodes[t],n=r.child.toString();n in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[n]:(r.child._str=n,this.minimizedNodes[n]=r.child),this.uncheckedNodes.pop()}},j.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},j.Index.prototype.search=function(e){return this.query((function(t){new j.QueryParser(e,t).parse()}))},j.Index.prototype.query=function(e){for(var t=new j.Query(this.fields),r=Object.create(null),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a<this.fields.length;a++)n[this.fields[a]]=new j.Vector;for(e.call(t,t),a=0;a<t.clauses.length;a++){var u,l=t.clauses[a],c=j.Set.empty;u=l.usePipeline?this.pipeline.runString(l.term,{fields:l.fields}):[l.term];for(var h=0;h<u.length;h++){var d=u[h];l.term=d;var f=j.TokenSet.fromClause(l),p=this.tokenSet.intersect(f).toArray();if(0===p.length&&l.presence===j.Query.presence.REQUIRED){for(var y=0;y<l.fields.length;y++)s[R=l.fields[y]]=j.Set.empty;break}for(var m=0;m<p.length;m++){var g=p[m],x=this.invertedIndex[g],v=x._index;for(y=0;y<l.fields.length;y++){var w=x[R=l.fields[y]],Q=Object.keys(w),k=g+"/"+R,S=new j.Set(Q);if(l.presence==j.Query.presence.REQUIRED&&(c=c.union(S),void 0===s[R]&&(s[R]=j.Set.complete)),l.presence!=j.Query.presence.PROHIBITED){if(n[R].upsert(v,l.boost,(function(e,t){return e+t})),!i[k]){for(var E=0;E<Q.length;E++){var P,L=Q[E],b=new j.FieldRef(L,R),T=w[L];void 0===(P=r[b])?r[b]=new j.MatchData(g,R,T):P.add(g,R,T)}i[k]=!0}}else void 0===o[R]&&(o[R]=j.Set.empty),o[R]=o[R].union(S)}}}if(l.presence===j.Query.presence.REQUIRED)for(y=0;y<l.fields.length;y++)s[R=l.fields[y]]=s[R].intersect(c)}var O=j.Set.complete,I=j.Set.empty;for(a=0;a<this.fields.length;a++){var R;s[R=this.fields[a]]&&(O=O.intersect(s[R])),o[R]&&(I=I.union(o[R]))}var F=Object.keys(r),C=[],N=Object.create(null);if(t.isNegated())for(F=Object.keys(this.fieldVectors),a=0;a<F.length;a++){b=F[a];var _=j.FieldRef.fromString(b);r[b]=new j.MatchData}for(a=0;a<F.length;a++){var D=(_=j.FieldRef.fromString(F[a])).docRef;if(O.contains(D)&&!I.contains(D)){var A,B=this.fieldVectors[_],z=n[_.fieldName].similarity(B);if(void 0!==(A=N[D]))A.score+=z,A.matchData.combine(r[_]);else{var V={ref:D,score:z,matchData:r[_]};N[D]=V,C.push(V)}}}return C.sort((function(e,t){return t.score-e.score}))},j.Index.prototype.toJSON=function(){var e=Object.keys(this.invertedIndex).sort().map((function(e){return[e,this.invertedIndex[e]]}),this),t=Object.keys(this.fieldVectors).map((function(e){return[e,this.fieldVectors[e].toJSON()]}),this);return{version:j.version,fields:this.fields,fieldVectors:t,invertedIndex:e,pipeline:this.pipeline.toJSON()}},j.Index.load=function(e){var t={},r={},n=e.fieldVectors,i=Object.create(null),s=e.invertedIndex,o=new j.TokenSet.Builder,a=j.Pipeline.load(e.pipeline);e.version!=j.version&&j.utils.warn("Version mismatch when loading serialised index. Current version of lunr \'"+j.version+"\' does not match serialized index \'"+e.version+"\'");for(var u=0;u<n.length;u++){var l=(h=n[u])[0],c=h[1];r[l]=new j.Vector(c)}for(u=0;u<s.length;u++){var h,d=(h=s[u])[0],f=h[1];o.insert(d),i[d]=f}return o.finish(),t.fields=e.fields,t.fieldVectors=r,t.invertedIndex=i,t.tokenSet=o.root,t.pipeline=a,new j.Index(t)},j.Builder=function(){this._ref="id",this._fields=Object.create(null),this._documents=Object.create(null),this.invertedIndex=Object.create(null),this.fieldTermFrequencies={},this.fieldLengths={},this.tokenizer=j.tokenizer,this.pipeline=new j.Pipeline,this.searchPipeline=new j.Pipeline,this.documentCount=0,this._b=.75,this._k1=1.2,this.termIndex=0,this.metadataWhitelist=[]},j.Builder.prototype.ref=function(e){this._ref=e},j.Builder.prototype.field=function(e,t){if(/\\//.test(e))throw new RangeError("Field \'"+e+"\' contains illegal character \'/\'");this._fields[e]=t||{}},j.Builder.prototype.b=function(e){this._b=e<0?0:e>1?1:e},j.Builder.prototype.k1=function(e){this._k1=e},j.Builder.prototype.add=function(e,t){var r=e[this._ref],n=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var i=0;i<n.length;i++){var s=n[i],o=this._fields[s].extractor,a=o?o(e):e[s],u=this.tokenizer(a,{fields:[s]}),l=this.pipeline.run(u),c=new j.FieldRef(r,s),h=Object.create(null);this.fieldTermFrequencies[c]=h,this.fieldLengths[c]=0,this.fieldLengths[c]+=l.length;for(var d=0;d<l.length;d++){var f=l[d];if(null==h[f]&&(h[f]=0),h[f]+=1,null==this.invertedIndex[f]){var p=Object.create(null);p._index=this.termIndex,this.termIndex+=1;for(var y=0;y<n.length;y++)p[n[y]]=Object.create(null);this.invertedIndex[f]=p}null==this.invertedIndex[f][s][r]&&(this.invertedIndex[f][s][r]=Object.create(null));for(var m=0;m<this.metadataWhitelist.length;m++){var g=this.metadataWhitelist[m],x=f.metadata[g];null==this.invertedIndex[f][s][r][g]&&(this.invertedIndex[f][s][r][g]=[]),this.invertedIndex[f][s][r][g].push(x)}}}},j.Builder.prototype.calculateAverageFieldLengths=function(){for(var e=Object.keys(this.fieldLengths),t=e.length,r={},n={},i=0;i<t;i++){var s=j.FieldRef.fromString(e[i]),o=s.fieldName;n[o]||(n[o]=0),n[o]+=1,r[o]||(r[o]=0),r[o]+=this.fieldLengths[s]}var a=Object.keys(this._fields);for(i=0;i<a.length;i++){var u=a[i];r[u]=r[u]/n[u]}this.averageFieldLength=r},j.Builder.prototype.createFieldVectors=function(){for(var e={},t=Object.keys(this.fieldTermFrequencies),r=t.length,n=Object.create(null),i=0;i<r;i++){for(var s=j.FieldRef.fromString(t[i]),o=s.fieldName,a=this.fieldLengths[s],u=new j.Vector,l=this.fieldTermFrequencies[s],c=Object.keys(l),h=c.length,d=this._fields[o].boost||1,f=this._documents[s.docRef].boost||1,p=0;p<h;p++){var y,m,g,x=c[p],v=l[x],w=this.invertedIndex[x]._index;void 0===n[x]?(y=j.idf(this.invertedIndex[x],this.documentCount),n[x]=y):y=n[x],m=y*((this._k1+1)*v)/(this._k1*(1-this._b+this._b*(a/this.averageFieldLength[o]))+v),m*=d,m*=f,g=Math.round(1e3*m)/1e3,u.insert(w,g)}e[s]=u}this.fieldVectors=e},j.Builder.prototype.createTokenSet=function(){this.tokenSet=j.TokenSet.fromArray(Object.keys(this.invertedIndex).sort())},j.Builder.prototype.build=function(){return this.calculateAverageFieldLengths(),this.createFieldVectors(),this.createTokenSet(),new j.Index({invertedIndex:this.invertedIndex,fieldVectors:this.fieldVectors,tokenSet:this.tokenSet,fields:Object.keys(this._fields),pipeline:this.searchPipeline})},j.Builder.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},j.MatchData=function(e,t,r){for(var n=Object.create(null),i=Object.keys(r||{}),s=0;s<i.length;s++){var o=i[s];n[o]=r[o].slice()}this.metadata=Object.create(null),void 0!==e&&(this.metadata[e]=Object.create(null),this.metadata[e][t]=n)},j.MatchData.prototype.combine=function(e){for(var t=Object.keys(e.metadata),r=0;r<t.length;r++){var n=t[r],i=Object.keys(e.metadata[n]);null==this.metadata[n]&&(this.metadata[n]=Object.create(null));for(var s=0;s<i.length;s++){var o=i[s],a=Object.keys(e.metadata[n][o]);null==this.metadata[n][o]&&(this.metadata[n][o]=Object.create(null));for(var u=0;u<a.length;u++){var l=a[u];null==this.metadata[n][o][l]?this.metadata[n][o][l]=e.metadata[n][o][l]:this.metadata[n][o][l]=this.metadata[n][o][l].concat(e.metadata[n][o][l])}}}},j.MatchData.prototype.add=function(e,t,r){if(!(e in this.metadata))return this.metadata[e]=Object.create(null),void(this.metadata[e][t]=r);if(t in this.metadata[e])for(var n=Object.keys(r),i=0;i<n.length;i++){var s=n[i];s in this.metadata[e][t]?this.metadata[e][t][s]=this.metadata[e][t][s].concat(r[s]):this.metadata[e][t][s]=r[s]}else this.metadata[e][t]=r},j.Query=function(e){this.clauses=[],this.allFields=e},j.Query.wildcard=new String("*"),j.Query.wildcard.NONE=0,j.Query.wildcard.LEADING=1,j.Query.wildcard.TRAILING=2,j.Query.presence={OPTIONAL:1,REQUIRED:2,PROHIBITED:3},j.Query.prototype.clause=function(e){return"fields"in e||(e.fields=this.allFields),"boost"in e||(e.boost=1),"usePipeline"in e||(e.usePipeline=!0),"wildcard"in e||(e.wildcard=j.Query.wildcard.NONE),e.wildcard&j.Query.wildcard.LEADING&&e.term.charAt(0)!=j.Query.wildcard&&(e.term="*"+e.term),e.wildcard&j.Query.wildcard.TRAILING&&e.term.slice(-1)!=j.Query.wildcard&&(e.term=e.term+"*"),"presence"in e||(e.presence=j.Query.presence.OPTIONAL),this.clauses.push(e),this},j.Query.prototype.isNegated=function(){for(var e=0;e<this.clauses.length;e++)if(this.clauses[e].presence!=j.Query.presence.PROHIBITED)return!1;return!0},j.Query.prototype.term=function(e,t){if(Array.isArray(e))return e.forEach((function(e){this.term(e,j.utils.clone(t))}),this),this;var r=t||{};return r.term=e.toString(),this.clause(r),this},j.QueryParseError=function(e,t,r){this.name="QueryParseError",this.message=e,this.start=t,this.end=r},j.QueryParseError.prototype=new Error,j.QueryLexer=function(e){this.lexemes=[],this.str=e,this.length=e.length,this.pos=0,this.start=0,this.escapeCharPositions=[]},j.QueryLexer.prototype.run=function(){for(var e=j.QueryLexer.lexText;e;)e=e(this)},j.QueryLexer.prototype.sliceString=function(){for(var e=[],t=this.start,r=this.pos,n=0;n<this.escapeCharPositions.length;n++)r=this.escapeCharPositions[n],e.push(this.str.slice(t,r)),t=r+1;return e.push(this.str.slice(t,this.pos)),this.escapeCharPositions.length=0,e.join("")},j.QueryLexer.prototype.emit=function(e){this.lexemes.push({type:e,str:this.sliceString(),start:this.start,end:this.pos}),this.start=this.pos},j.QueryLexer.prototype.escapeCharacter=function(){this.escapeCharPositions.push(this.pos-1),this.pos+=1},j.QueryLexer.prototype.next=function(){if(this.pos>=this.length)return j.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},j.QueryLexer.prototype.width=function(){return this.pos-this.start},j.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},j.QueryLexer.prototype.backup=function(){this.pos-=1},j.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=j.QueryLexer.EOS&&this.backup()},j.QueryLexer.prototype.more=function(){return this.pos<this.length},j.QueryLexer.EOS="EOS",j.QueryLexer.FIELD="FIELD",j.QueryLexer.TERM="TERM",j.QueryLexer.EDIT_DISTANCE="EDIT_DISTANCE",j.QueryLexer.BOOST="BOOST",j.QueryLexer.PRESENCE="PRESENCE",j.QueryLexer.lexField=function(e){return e.backup(),e.emit(j.QueryLexer.FIELD),e.ignore(),j.QueryLexer.lexText},j.QueryLexer.lexTerm=function(e){if(e.width()>1&&(e.backup(),e.emit(j.QueryLexer.TERM)),e.ignore(),e.more())return j.QueryLexer.lexText},j.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(j.QueryLexer.EDIT_DISTANCE),j.QueryLexer.lexText},j.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(j.QueryLexer.BOOST),j.QueryLexer.lexText},j.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(j.QueryLexer.TERM)},j.QueryLexer.termSeparator=j.tokenizer.separator,j.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==j.QueryLexer.EOS)return j.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return j.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(j.QueryLexer.TERM),j.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(j.QueryLexer.TERM),j.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(j.QueryLexer.PRESENCE),j.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(j.QueryLexer.PRESENCE),j.QueryLexer.lexText;if(t.match(j.QueryLexer.termSeparator))return j.QueryLexer.lexTerm}else e.escapeCharacter()}},j.QueryParser=function(e,t){this.lexer=new j.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},j.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=j.QueryParser.parseClause;e;)e=e(this);return this.query},j.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},j.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},j.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},j.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case j.QueryLexer.PRESENCE:return j.QueryParser.parsePresence;case j.QueryLexer.FIELD:return j.QueryParser.parseField;case j.QueryLexer.TERM:return j.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value \'"+t.str+"\'"),new j.QueryParseError(r,t.start,t.end)}},j.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=j.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=j.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator\'"+t.str+"\'";throw new j.QueryParseError(r,t.start,t.end)}var n=e.peekLexeme();if(null==n)throw r="expecting term or field, found nothing",new j.QueryParseError(r,t.start,t.end);switch(n.type){case j.QueryLexer.FIELD:return j.QueryParser.parseField;case j.QueryLexer.TERM:return j.QueryParser.parseTerm;default:throw r="expecting term or field, found \'"+n.type+"\'",new j.QueryParseError(r,n.start,n.end)}}},j.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"\'"+e+"\'"})).join(", "),n="unrecognised field \'"+t.str+"\', possible fields: "+r;throw new j.QueryParseError(n,t.start,t.end)}e.currentClause.fields=[t.str];var i=e.peekLexeme();if(null==i)throw n="expecting term, found nothing",new j.QueryParseError(n,t.start,t.end);if(i.type===j.QueryLexer.TERM)return j.QueryParser.parseTerm;throw n="expecting term, found \'"+i.type+"\'",new j.QueryParseError(n,i.start,i.end)}},j.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:var n="Unexpected lexeme type \'"+r.type+"\'";throw new j.QueryParseError(n,r.start,r.end)}else e.nextClause()}},j.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="edit distance must be numeric";throw new j.QueryParseError(n,t.start,t.end)}e.currentClause.editDistance=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new j.QueryParseError(n,i.start,i.end)}else e.nextClause()}},j.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="boost must be numeric";throw new j.QueryParseError(n,t.start,t.end)}e.currentClause.boost=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case j.QueryLexer.TERM:return e.nextClause(),j.QueryParser.parseTerm;case j.QueryLexer.FIELD:return e.nextClause(),j.QueryParser.parseField;case j.QueryLexer.EDIT_DISTANCE:return j.QueryParser.parseEditDistance;case j.QueryLexer.BOOST:return j.QueryParser.parseBoost;case j.QueryLexer.PRESENCE:return e.nextClause(),j.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new j.QueryParseError(n,i.start,i.end)}else e.nextClause()}},void 0===(i="function"==typeof(n=function(){return j})?n.call(t,r,t,e):n)||(e.exports=i)}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};(()=>{"use strict";r.d(n,{add:()=>c,dispose:()=>y,done:()=>h,fromExternalJS:()=>f,load:()=>p,search:()=>m,toJS:()=>d});var e=r(291),t=(Object.defineProperty,(e,t,r)=>new Promise(((n,i)=>{var s=e=>{try{a(r.next(e))}catch(e){i(e)}},o=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())})));let i,s,o,a=[];function u(){i=new e.Builder,i.field("title"),i.field("description"),i.ref("ref"),i.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),o=new Promise((e=>{s=e}))}e.tokenizer.separator=/\\s+/,u();const l=t=>"*"+e.stemmer(new e.Token(t,{}))+"*";function c(e,t,r){const n=a.push(r)-1,s={title:e.toLowerCase(),description:t.toLowerCase(),ref:n};i.add(s)}function h(){return t(this,null,(function*(){s(i.build())}))}function d(){return t(this,null,(function*(){return{store:a,index:(yield o).toJSON()}}))}function f(e,r){return t(this,null,(function*(){try{if(importScripts(e),!self[r])throw new Error("Broken index file format");yield p(self[r])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function p(r){return t(this,null,(function*(){a=r.store,s(e.Index.load(r.index))}))}function y(){return t(this,null,(function*(){a=[],u()}))}function m(e,r=0){return t(this,null,(function*(){if(0===e.trim().length)return[];let t=(yield o).query((t=>{e.trim().toLowerCase().split(/\\s+/).forEach((e=>{if(1===e.length)return;const r=l(e);t.term(r,{})}))}));return r>0&&(t=t.slice(0,r)),t.map((e=>({meta:a[e.ref],score:e.score})))}))}addEventListener("message",(function(e){var t,r=e.data,i=r.type,s=r.method,o=r.id,a=r.params;"RPC"===i&&s&&((t=n[s])?Promise.resolve().then((function(){return t.apply(n,a)})):Promise.reject("No such method")).then((function(e){postMessage({type:"RPC",id:o,result:e})})).catch((function(e){var t={message:e};e.stack&&(t.message=e.message,t.stack=e.stack,t.name=e.name),postMessage({type:"RPC",id:o,error:t})}))})),postMessage({type:"RPC",method:"ready"})})()})();'])),{name:"[fullhash].worker.js"});return i(e,n),e}}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{"use strict";r.r(i),r.d(i,{SearchStore:()=>n});const e="undefined"!=typeof window&&"HTMLElement"in window;"undefined"==typeof Element||Element.prototype.scrollIntoViewIfNeeded||(Element.prototype.scrollIntoViewIfNeeded=function(e){e=0===arguments.length||!!e;const t=this.parentNode,r=window.getComputedStyle(t,void 0),i=parseInt(r.getPropertyValue("border-top-width"),10),n=parseInt(r.getPropertyValue("border-left-width"),10),s=this.offsetTop-t.offsetTop<t.scrollTop,o=this.offsetTop-t.offsetTop+this.clientHeight-i>t.scrollTop+t.clientHeight,a=this.offsetLeft-t.offsetLeft<t.scrollLeft,u=this.offsetLeft-t.offsetLeft+this.clientWidth-n>t.scrollLeft+t.clientWidth,l=s&&!o;(s||o)&&e&&(t.scrollTop=this.offsetTop-t.offsetTop-t.clientHeight/2-i+this.clientHeight/2),(a||u)&&e&&(t.scrollLeft=this.offsetLeft-t.offsetLeft-t.clientWidth/2-n+this.clientWidth/2),(s||o||a||u)&&!e&&this.scrollIntoView(l)});var t=Object.defineProperty;class n{constructor(){var i,n,s;i=this,n="searchWorker",s=function(){let t;if(e)try{t=r(680)}catch(e){t=r(586).Ay}else t=r(586).Ay;return new t}(),((e,r,i)=>{r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[r]=i})(i,"symbol"!=typeof n?n+"":n,s)}indexItems(e){const t=e=>{e.forEach((e=>{"group"!==e.type&&this.add(e.name,e.description||"",e.id),t(e.items)}))};t(e),this.searchWorker.done()}add(e,t,r){this.searchWorker.add(e,t,r)}dispose(){this.searchWorker.terminate(),this.searchWorker.dispose()}search(e){return this.searchWorker.search(e)}toJS(){return e=this,t=function*(){return this.searchWorker.toJS()},new Promise(((r,i)=>{var n=e=>{try{o(t.next(e))}catch(e){i(e)}},s=e=>{try{o(t.throw(e))}catch(e){i(e)}},o=e=>e.done?r(e.value):Promise.resolve(e.value).then(n,s);o((t=t.apply(e,null)).next())}));var e,t}load(e){this.searchWorker.load(e)}fromExternalJS(e,t){e&&t&&this.searchWorker.fromExternalJS(e,t)}}})(),i})()));
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.info=void 0;var tslib_1=require("tslib"),code_builder_1=require("../../helpers/code-builder"),__1=require("../.."),constants_1=require("../../helpers/constants"),code_helpers_1=require("../../helpers/code-helpers"),utils_1=require("../../../../utils"),types_1=require("../../../../../types"),indent=1;function hasMimeType(e,t){return void 0===e&&(e={}),(0,utils_1.normalizeMimeType)(e.mimeType)===t}var handler=function(e,t,s){var r,a,n,i,p,d,o=s.target,l=s.client,u=(0,tslib_1.__assign)({capitalize:!0,showBoilerplate:!0,checkErrors:!0,printBody:!0,timeout:-1,indent:" "},t),h=null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0],y=u.checkErrors?"err":"_",v=e.method.toUpperCase(),c=new code_builder_1.CodeBuilder({indentation:u.indent,variablesPrefix:u.variablesPrefix,capitalize:u.capitalize,lang:constants_1.Lang.GO}),m=function(){u.checkErrors&&c.push(indent,"if err != nil {").push(indent+1,"panic(err)").push(indent,"}")};if(u.showBoilerplate&&(c.push("package main").blank().push("import (").push(indent,'"fmt"'),u.timeout>0&&c.push(indent,'"time"'),h&&c.push(indent,'"encoding/json"'),hasMimeType(e.postData,types_1.MediaTypes.MULTIPART)&&(c.push(indent,'"mime/multipart"'),c.push(indent,'"io"'),c.push(indent,'"bytes"')),(hasMimeType(e.postData,types_1.MediaTypes.URL_ENCODED)||hasMimeType(null===(n=null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a[0])||void 0===n?void 0:n.postData,types_1.MediaTypes.URL_ENCODED))&&(c.push(indent,'"net/url"'),c.push(indent,'"strconv"')),(hasMimeType(e.postData,types_1.MediaTypes.JSON)||hasMimeType(null===(p=null===(i=e.securityOAuth2ExtraCalls)||void 0===i?void 0:i[0])||void 0===p?void 0:p.postData,types_1.MediaTypes.JSON))&&c.push(indent,'"bytes"'),(e.postData&&!hasMimeType(e.postData,types_1.MediaTypes.JSON)||h)&&c.push(indent,'"strings"'),c.push(indent,'"net/http"'),u.printBody&&c.push(indent,'"io/ioutil"'),c.push(")").blank().push("func main() {")),Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){e.allHeaders[t]='"'+e.allHeaders[t]+'"'})),h){var _="oAuth2",b=u.checkErrors?y+" := ":"",f=u.capitalize?"Res":"res",q=new __1.HTTPSnippet(h).convert(o,l,(0,tslib_1.__assign)((0,tslib_1.__assign)({},u),{printBody:!1,variablesPrefix:_,showBoilerplate:!1}));c.push(q).blank().push(indent,"var oAuth2"+f+"Body struct {").push(indent+1,"Access_token string").push(indent,"}").push(indent,b+"json.NewDecoder("+_+f+".Body).Decode(&"+_+f+"Body)").blank(),m(),e.allHeaders.Authorization='"Bearer " + oAuth2'+f+"Body.Access_token"}if((0,code_helpers_1.printUrlVariablesDeclarations)(e,c,indent),u.timeout>0&&(l=c.var("client"),c.push(indent,"%s := http.Client{",l).push(indent+1,"Timeout: time.Duration(%s * time.Second),",u.timeout).push(indent,"}").blank()),c.push(indent,c.var("reqUrl")+" := "+(0,code_helpers_1.buildUrlExpression)(e,c)),e.postData){var w=void 0;switch((0,utils_1.normalizeMimeType)(e.postData.mimeType)){case types_1.MediaTypes.URL_ENCODED:c.push(indent,"%s := url.Values{}",c.var("data")),e.postData.params.forEach((function(e){c.push(indent,'%s.Set("%s", "%s")',c.var("data"),e.name,e.value)})),c.push(indent,'%s, %s := http.NewRequest("%s", %s, strings.NewReader(%s.Encode()))',c.var("req"),y,v,c.var("reqUrl"),c.var("data")),e.allHeaders["Content-Length"]="strconv.Itoa(len("+c.var("data")+".Encode()))";break;case types_1.MediaTypes.JSON:w=JSON.stringify(e.postData.jsonObj,null,2).split("\n").map((function(e){return u.indent+e})).join("\n").trim(),c.push(indent,"var "+c.var("data")+" = []byte(`"+w+"`)"),c.push(indent,'%s, %s := http.NewRequest("%s", %s, bytes.NewBuffer(%s))',c.var("req"),y,v,c.var("reqUrl"),c.var("data"));break;case types_1.MediaTypes.MULTIPART:c.push(indent,"%s := &bytes.Buffer{}",c.var("data")).push(indent,"writer := multipart.NewWriter(%s)",c.var("data")),e.postData.params.forEach((function(e){if(!e.fileName&&!e.contentType)return c.push(indent,'%s, _ := writer.CreateFormField("%s")',c.var(e.name+"Fw"),e.name).push(indent,'_, %s = io.Copy(%s, strings.NewReader("%s"))',y,c.var(e.name+"Fw"),e.value),void m();e.fileName&&(c.push(indent,'%s, %s = writer.CreateFormFile("%s", "%s")',c.var(e.name+"Fw"),y,e.name,e.fileName),m())})),c.push(indent,"writer.Close()").blank().push(indent,"%s := bytes.NewReader(%s.Bytes())",c.var("payload"),c.var("data")).push(indent,'%s, %s := http.NewRequest("%s", %s, %s)',c.var("req"),y,v,c.var("reqUrl"),c.var("payload")),e.allHeaders["Content-Type"]="writer.FormDataContentType()";break;default:e.postData.text&&c.push(indent,"%s := strings.NewReader(%s)",c.var("payload"),JSON.stringify(null===(d=e.postData)||void 0===d?void 0:d.text)).push(indent,'%s, %s := http.NewRequest("%s", %s, %s)',c.var("req"),y,v,c.var("reqUrl"),c.var("payload"))}}else c.push(indent,'%s, %s := http.NewRequest("%s", %s, nil)',c.var("req"),y,v,c.var("reqUrl"));if(Object.getOwnPropertyNames(e.queryObj).length){for(var T in c.blank().push(indent,c.var("query")+" := "+c.var("req")+".URL.Query()"),e.queryObj){var g=e.queryObj[T],N="string"==typeof g&&/^\[.*\]$/.test(g)?"`"+g+"`":'"'+g+'"';c.push(indent,c.var("query")+'.Add("'+T+'", '+N+")")}c.push(indent,c.var("req")+".URL.RawQuery = "+c.var("query")+".Encode()").blank()}if(m(),e.basicAuth){var k=e.basicAuth,D=k.username,O=k.password;c.push(indent,'%s.SetBasicAuth("'+D+'", "'+O+'")',c.var("req"))}return Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){c.push(indent,'%s.Header.Add("%s", %s)',c.var("req"),t,e.allHeaders[t])})),c.push(indent,"%s, %s := %s.Do(%s)",c.var("res"),y,l,c.var("req")),m(),u.printBody&&(c.push(indent,"defer %s.Body.Close()",c.var("res")).push(indent,"%s, %s := ioutil.ReadAll(%s.Body)",c.var("body"),y,c.var("res")),m()),c.blank().push(indent,"fmt.Println(%s)",c.var("res")),u.printBody&&c.push(indent,"fmt.Println(string(%s))",c.var("body")),u.showBoilerplate&&c.push("}"),c.join()};exports.info={key:"native",title:"NewRequest",link:"http://golang.org/pkg/net/http/#NewRequest",description:"Golang HTTP client request"},exports.default=handler;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.info=void 0;var tslib_1=require("tslib"),code_builder_1=require("../../helpers/code-builder"),__1=require("../.."),constants_1=require("../../helpers/constants"),code_helpers_1=require("../../helpers/code-helpers"),utils_1=require("../../../../utils"),types_1=require("../../../../../types"),indent=1;function hasMimeType(e,t){return void 0===e&&(e={}),(0,utils_1.normalizeMimeType)(e.mimeType)===t}var handler=function(e,t,s){var r,a,n,i,p,d,o=s.target,l=s.client,u=(0,tslib_1.__assign)({capitalize:!0,showBoilerplate:!0,checkErrors:!0,printBody:!0,timeout:-1,indent:" "},t),h=null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0],y=u.checkErrors?"err":"_",v=e.method.toUpperCase(),c=new code_builder_1.CodeBuilder({indentation:u.indent,variablesPrefix:u.variablesPrefix,capitalize:u.capitalize,lang:constants_1.Lang.GO}),m=function(){u.checkErrors&&c.push(indent,"if err != nil {").push(indent+1,"panic(err)").push(indent,"}")};if(u.showBoilerplate&&(c.push("package main").blank().push("import (").push(indent,'"fmt"'),u.timeout>0&&c.push(indent,'"time"'),h&&c.push(indent,'"encoding/json"'),hasMimeType(e.postData,types_1.MediaTypes.MULTIPART)&&(c.push(indent,'"mime/multipart"'),c.push(indent,'"io"'),c.push(indent,'"bytes"')),(hasMimeType(e.postData,types_1.MediaTypes.URL_ENCODED)||hasMimeType(null===(n=null===(a=e.securityOAuth2ExtraCalls)||void 0===a?void 0:a[0])||void 0===n?void 0:n.postData,types_1.MediaTypes.URL_ENCODED))&&(c.push(indent,'"net/url"'),c.push(indent,'"strconv"')),(hasMimeType(e.postData,types_1.MediaTypes.JSON)||hasMimeType(null===(p=null===(i=e.securityOAuth2ExtraCalls)||void 0===i?void 0:i[0])||void 0===p?void 0:p.postData,types_1.MediaTypes.JSON))&&c.push(indent,'"bytes"'),(e.postData&&!hasMimeType(e.postData,types_1.MediaTypes.JSON)||h)&&c.push(indent,'"strings"'),c.push(indent,'"net/http"'),u.printBody&&c.push(indent,'"io/ioutil"'),c.push(")").blank().push("func main() {")),Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){e.allHeaders[t]='"'+e.allHeaders[t]+'"'})),h){var _="oAuth2",b=u.checkErrors?y+" := ":"",f=u.capitalize?"Res":"res",q=new __1.HTTPSnippet(h).convert(o,l,(0,tslib_1.__assign)((0,tslib_1.__assign)({},u),{printBody:!1,variablesPrefix:_,showBoilerplate:!1}));c.push(q).blank().push(indent,"var "+_+f+"Body struct {").push(indent+1,"Access_token string").push(indent,"}").push(indent,b+"json.NewDecoder("+_+f+".Body).Decode(&"+_+f+"Body)").blank(),m(),e.allHeaders.Authorization='"Bearer " + '+_+f+"Body.Access_token"}if((0,code_helpers_1.printUrlVariablesDeclarations)(e,c,indent),u.timeout>0&&(l=c.var("client"),c.push(indent,"%s := http.Client{",l).push(indent+1,"Timeout: time.Duration(%s * time.Second),",u.timeout).push(indent,"}").blank()),c.push(indent,c.var("reqUrl")+" := "+(0,code_helpers_1.buildUrlExpression)(e,c)),e.postData){var w=void 0;switch((0,utils_1.normalizeMimeType)(e.postData.mimeType)){case types_1.MediaTypes.URL_ENCODED:c.push(indent,"%s := url.Values{}",c.var("data")),e.postData.params.forEach((function(e){c.push(indent,'%s.Set("%s", "%s")',c.var("data"),e.name,e.value)})),c.push(indent,'%s, %s := http.NewRequest("%s", %s, strings.NewReader(%s.Encode()))',c.var("req"),y,v,c.var("reqUrl"),c.var("data")),e.allHeaders["Content-Length"]="strconv.Itoa(len("+c.var("data")+".Encode()))";break;case types_1.MediaTypes.JSON:w=JSON.stringify(e.postData.jsonObj,null,2).split("\n").map((function(e){return u.indent+e})).join("\n").trim(),c.push(indent,"var "+c.var("data")+" = []byte(`"+w+"`)"),c.push(indent,'%s, %s := http.NewRequest("%s", %s, bytes.NewBuffer(%s))',c.var("req"),y,v,c.var("reqUrl"),c.var("data"));break;case types_1.MediaTypes.MULTIPART:c.push(indent,"%s := &bytes.Buffer{}",c.var("data")).push(indent,"writer := multipart.NewWriter(%s)",c.var("data")),e.postData.params.forEach((function(e){if(!e.fileName&&!e.contentType)return c.push(indent,'%s, _ := writer.CreateFormField("%s")',c.var(e.name+"Fw"),e.name).push(indent,'_, %s = io.Copy(%s, strings.NewReader("%s"))',y,c.var(e.name+"Fw"),e.value),void m();e.fileName&&(c.push(indent,'%s, %s = writer.CreateFormFile("%s", "%s")',c.var(e.name+"Fw"),y,e.name,e.fileName),m())})),c.push(indent,"writer.Close()").blank().push(indent,"%s := bytes.NewReader(%s.Bytes())",c.var("payload"),c.var("data")).push(indent,'%s, %s := http.NewRequest("%s", %s, %s)',c.var("req"),y,v,c.var("reqUrl"),c.var("payload")),e.allHeaders["Content-Type"]="writer.FormDataContentType()";break;default:e.postData.text&&c.push(indent,"%s := strings.NewReader(%s)",c.var("payload"),JSON.stringify(null===(d=e.postData)||void 0===d?void 0:d.text)).push(indent,'%s, %s := http.NewRequest("%s", %s, %s)',c.var("req"),y,v,c.var("reqUrl"),c.var("payload"))}}else c.push(indent,'%s, %s := http.NewRequest("%s", %s, nil)',c.var("req"),y,v,c.var("reqUrl"));if(Object.getOwnPropertyNames(e.queryObj).length){for(var T in c.blank().push(indent,c.var("query")+" := "+c.var("req")+".URL.Query()"),e.queryObj){var g=e.queryObj[T],N="string"==typeof g&&/^\[.*\]$/.test(g)?"`"+g+"`":'"'+g+'"';c.push(indent,c.var("query")+'.Add("'+T+'", '+N+")")}c.push(indent,c.var("req")+".URL.RawQuery = "+c.var("query")+".Encode()").blank()}if(m(),e.basicAuth){var k=e.basicAuth,D=k.username,O=k.password;c.push(indent,'%s.SetBasicAuth("'+D+'", "'+O+'")',c.var("req"))}return Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){c.push(indent,'%s.Header.Add("%s", %s)',c.var("req"),t,e.allHeaders[t])})),c.push(indent,"%s, %s := %s.Do(%s)",c.var("res"),y,l,c.var("req")),m(),u.printBody&&(c.push(indent,"defer %s.Body.Close()",c.var("res")).push(indent,"%s, %s := ioutil.ReadAll(%s.Body)",c.var("body"),y,c.var("res")),m()),c.blank().push(indent,"fmt.Println(%s)",c.var("res")),u.printBody&&c.push(indent,"fmt.Println(string(%s))",c.var("body")),u.showBoilerplate&&c.push("}"),c.join()};exports.info={key:"native",title:"NewRequest",link:"http://golang.org/pkg/net/http/#NewRequest",description:"Golang HTTP client request"},exports.default=handler;
2
2
  //# sourceMappingURL=native.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),code_builder_1=require("../../helpers/code-builder"),code_helpers_1=require("../../helpers/code-helpers"),constants_1=require("../../helpers/constants"),__1=require("../.."),utils_1=require("../../../../utils"),types_1=require("../../../../../types"),utils_2=require("./utils"),indent=1,handler=function(e,t,a){var s,r,i,l,n,o=a.target,p=a.client,u=Object.assign({indent:" ",showBoilerplate:!0,printBody:!0},t),d=new code_builder_1.CodeBuilder({indentation:u.indent,variablesPrefix:u.variablesPrefix,lang:constants_1.Lang.R}),_=e.method.toUpperCase(),h=null===(s=e.securityOAuth2ExtraCalls)||void 0===s?void 0:s[0];if(u.showBoilerplate&&d.push("library(httr)").blank(),h){var b="oauth2_",c=new __1.HTTPSnippet(h).convert(o,p,(0,tslib_1.__assign)((0,tslib_1.__assign)({},u),{variablesPrefix:b,showBoilerplate:!1}));d.push(c).push('access_token = content(oauth2_data_req, "parsed")$access_token').blank(),e.allHeaders.Authorization='paste("Bearer", access_token)'}var v="";if(null==e?void 0:e.postData)switch((0,utils_1.normalizeMimeType)(null===(r=null==e?void 0:e.postData)||void 0===r?void 0:r.mimeType)){case types_1.MediaTypes.URL_ENCODED:n="form",v=d.var("body");var y=(0,utils_2.postDataToRListBody)(e.postData.params,u);d.push(v+" <- list("+y+")").blank();break;case types_1.MediaTypes.JSON:n="json",v=d.var("body");y=(0,utils_2.objectToRString)(e.postData.jsonObj,u);d.push(v+" = '"+y+"'").blank();break;case types_1.MediaTypes.MULTIPART:n="multipart",v=d.var("body");y=(0,utils_2.postDataToRListBody)(e.postData.params,u);d.push(v+" <- list("+y+")").blank();break;default:(null===(i=e.postData)||void 0===i?void 0:i.text)&&(v=d.var("body"),n="raw",d.push(v+" = "+(0,utils_2.objectToRString)(null===(l=e.postData)||void 0===l?void 0:l.text)).blank())}(0,code_helpers_1.printUrlVariablesDeclarations)(e,d),Object.keys((0,tslib_1.__assign)((0,tslib_1.__assign)({},e.pathParameters),e.serverVariables)).length&&d.blank().push("# create you own operator").push('"%&%" <- function(x, y)paste0(x,y)').blank();var k=(0,code_helpers_1.buildUrlExpression)(e,d);d.push("url = "+k).blank();var f=d.var("data_req");if(d.push(f+" <- "+_+"("),d.push(indent,"url,"),e.basicAuth){var T=e.basicAuth,g=T.username,j=T.password;d.push(indent,'authenticate("'+g+'", "'+j+'")')}if(Object.keys(e.allHeaders).length){var m=""+Object.keys(e.allHeaders).map((function(t){return'"'+t+'" = '+(e.allHeaders[t].startsWith("paste")?e.allHeaders[t]:'"'+e.allHeaders[t]+'"')})).join(", ");m&&d.push(indent,"add_headers("+m+"),")}return v&&(d.push(indent,"body = "+v+","),d.push(indent,'encode = "'+n+'",')),d.push(indent,"verbose()"),d.push(")"),u.printBody&&d.blank().push("content("+f+("raw"===n?', "text"':"")+")"),d.join()};exports.default=handler;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=require("tslib"),code_builder_1=require("../../helpers/code-builder"),code_helpers_1=require("../../helpers/code-helpers"),constants_1=require("../../helpers/constants"),__1=require("../.."),utils_1=require("../../../../utils"),types_1=require("../../../../../types"),utils_2=require("./utils"),indent=1,handler=function(e,t,a){var s,r,i,l,n,o=a.target,p=a.client,u=Object.assign({indent:" ",showBoilerplate:!0,printBody:!0},t),d=new code_builder_1.CodeBuilder({indentation:u.indent,variablesPrefix:u.variablesPrefix,lang:constants_1.Lang.R}),_=e.method.toUpperCase(),b=null===(s=e.securityOAuth2ExtraCalls)||void 0===s?void 0:s[0];if(u.showBoilerplate&&d.push("library(httr)").blank(),b){var h="oauth2_",c=new __1.HTTPSnippet(b).convert(o,p,(0,tslib_1.__assign)((0,tslib_1.__assign)({},u),{variablesPrefix:h,showBoilerplate:!1})),v=h+"data_req";d.push(c).push("access_token = content("+v+', "parsed")$access_token').blank(),e.allHeaders.Authorization='paste("Bearer", access_token)'}var y="";if(null==e?void 0:e.postData)switch((0,utils_1.normalizeMimeType)(null===(r=null==e?void 0:e.postData)||void 0===r?void 0:r.mimeType)){case types_1.MediaTypes.URL_ENCODED:n="form",y=d.var("body");var k=(0,utils_2.postDataToRListBody)(e.postData.params,u);d.push(y+" <- list("+k+")").blank();break;case types_1.MediaTypes.JSON:n="json",y=d.var("body");k=(0,utils_2.objectToRString)(e.postData.jsonObj,u);d.push(y+" = '"+k+"'").blank();break;case types_1.MediaTypes.MULTIPART:n="multipart",y=d.var("body");k=(0,utils_2.postDataToRListBody)(e.postData.params,u);d.push(y+" <- list("+k+")").blank();break;default:(null===(i=e.postData)||void 0===i?void 0:i.text)&&(y=d.var("body"),n="raw",d.push(y+" = "+(0,utils_2.objectToRString)(null===(l=e.postData)||void 0===l?void 0:l.text)).blank())}(0,code_helpers_1.printUrlVariablesDeclarations)(e,d),Object.keys((0,tslib_1.__assign)((0,tslib_1.__assign)({},e.pathParameters),e.serverVariables)).length&&d.blank().push("# create you own operator").push('"%&%" <- function(x, y)paste0(x,y)').blank();var f=(0,code_helpers_1.buildUrlExpression)(e,d);d.push("url = "+f).blank();var T=d.var("data_req");if(d.push(T+" <- "+_+"("),d.push(indent,"url,"),e.basicAuth){var g=e.basicAuth,j=g.username,m=g.password;d.push(indent,'authenticate("'+j+'", "'+m+'")')}if(Object.keys(e.allHeaders).length){var x=""+Object.keys(e.allHeaders).map((function(t){return'"'+t+'" = '+(e.allHeaders[t].startsWith("paste")?e.allHeaders[t]:'"'+e.allHeaders[t]+'"')})).join(", ");x&&d.push(indent,"add_headers("+x+"),")}return y&&(d.push(indent,"body = "+y+","),d.push(indent,'encode = "'+n+'",')),d.push(indent,"verbose()"),d.push(")"),u.printBody&&d.blank().push("content("+T+("raw"===n?', "text"':"")+")"),d.join()};exports.default=handler;
2
2
  //# sourceMappingURL=httr.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.info=void 0;var tslib_1=require("tslib"),stringify_object_1=(0,tslib_1.__importDefault)(require("stringify-object")),code_builder_1=require("../../helpers/code-builder"),__1=require("../.."),constants_1=require("../../helpers/constants"),code_helpers_1=require("../../helpers/code-helpers"),utils_1=require("../../../../utils"),types_1=require("../../../../../types"),indent=1;function hasMimeType(e,t){return void 0===e&&(e={}),(0,utils_1.normalizeMimeType)(e.mimeType)===t}var handler=function(e,t,s){var r,a,i,n,l,o=s.target,u=s.client,p=e.method.toUpperCase(),d=null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0],h=(0,tslib_1.__assign)({capitalize:!0,showBoilerplate:!0,indent:" "},t),c=new code_builder_1.CodeBuilder({indentation:h.indent,variablesPrefix:h.variablesPrefix,capitalize:h.capitalize,lang:constants_1.Lang.RUBY});h.showBoilerplate&&(c.push("require 'uri'").push("require 'net/http'"),"https:"===e.uriObj.protocol&&c.push("require 'openssl'"),(hasMimeType(e.postData,types_1.MediaTypes.JSON)||d)&&c.unshift("require 'json'"),c.blank()),Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){e.allHeaders[t]="'"+e.allHeaders[t]+"'"}));var _=p.charAt(0)+p.substring(1).toLowerCase();if(["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"].indexOf(p)<0&&c.push("class Net::HTTP::%s < Net::HTTPRequest",_).push(" METHOD = '%s'",p.toUpperCase()).push(" REQUEST_HAS_BODY = '%s'",(null===(a=e.postData)||void 0===a?void 0:a.text)?"true":"false").push(" RESPONSE_HAS_BODY = true").push("end").blank(),d){var b="oAuth2",v=new __1.HTTPSnippet(d).convert(o,u,(0,tslib_1.__assign)((0,tslib_1.__assign)({},h),{variablesPrefix:b,showBoilerplate:!1})),y="oAuth2"+(h.capitalize?"Response":"response");c.push(v).push("access_token = JSON.parse("+y+".body)['access_token']").blank(),e.allHeaders.Authorization='"Bearer " + access_token'}if((0,code_helpers_1.printUrlVariablesDeclarations)(e,c),c.push(c.var("url")+" = URI("+(0,code_helpers_1.buildUrlExpression)(e,c)+")"),Object.getOwnPropertyNames(e.queryObj).length&&(c.push(c.var("params")+" = "+(0,stringify_object_1.default)(e.queryObj,{indent:h.indent,inlineCharacterLimit:25})),c.push(c.var("url")+".query = URI.encode_www_form("+c.var("params")+")")),c.blank().push(c.var("http")+" = Net::HTTP.new("+c.var("url")+".host, "+c.var("url")+".port)"),"https:"===e.uriObj.protocol&&c.push(c.var("http")+".use_ssl = true"),c.blank().push(c.var("request")+" = Net::HTTP::%s.new("+c.var("url")+")",_),Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){e.allHeaders[t]!=="'"+types_1.MediaTypes.MULTIPART+"'"&&c.push(c.var("request")+"['%s'] = %s",t,e.allHeaders[t])})),null==e?void 0:e.postData){var T={};switch((0,utils_1.normalizeMimeType)(null===(i=null==e?void 0:e.postData)||void 0===i?void 0:i.mimeType)){case types_1.MediaTypes.URL_ENCODED:e.postData.params.forEach((function(e){T[e.name]=e.value})),c.push(c.var("request")+".body = URI.encode_www_form("+(0,stringify_object_1.default)(T,{indent:h.indent,inlineCharacterLimit:25})+")");break;case types_1.MediaTypes.JSON:c.push(c.var("request")+".body = "+(0,stringify_object_1.default)(e.postData.jsonObj,{indent:h.indent,inlineCharacterLimit:25}).replace(/null/g,"nil")+".to_json");break;case types_1.MediaTypes.MULTIPART:e.postData.params&&(c.push(c.var("form_data")+" = ["),e.postData.params.forEach((function(e){c.push(indent,"['"+e.name+"', '"+e.value+"'],")})),c.push("]")),c.push(c.var("request")+".set_form("+c.var("form_data")+", '"+types_1.MediaTypes.MULTIPART+"')");break;default:(null===(n=e.postData)||void 0===n?void 0:n.text)&&c.push(c.var("request")+".body = "+JSON.stringify(null===(l=e.postData)||void 0===l?void 0:l.text))}}if(e.basicAuth){var f=e.basicAuth,m=f.username,O=f.password;c.push(c.var("request")+".basic_auth('"+m+"', '"+O+"')")}return c.blank().push(c.var("response")+" = "+c.var("http")+".request("+c.var("request")+")").push("puts "+c.var("response")+".read_body").blank(),c.join()};exports.info={key:"native",title:"net::http",link:"http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",description:"Ruby HTTP client"},exports.default=handler;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.info=void 0;var tslib_1=require("tslib"),stringify_object_1=(0,tslib_1.__importDefault)(require("stringify-object")),code_builder_1=require("../../helpers/code-builder"),__1=require("../.."),constants_1=require("../../helpers/constants"),code_helpers_1=require("../../helpers/code-helpers"),utils_1=require("../../../../utils"),types_1=require("../../../../../types"),indent=1;function hasMimeType(e,t){return void 0===e&&(e={}),(0,utils_1.normalizeMimeType)(e.mimeType)===t}var handler=function(e,t,s){var r,a,i,n,l,o=s.target,p=s.client,u=e.method.toUpperCase(),d=null===(r=e.securityOAuth2ExtraCalls)||void 0===r?void 0:r[0],h=(0,tslib_1.__assign)({capitalize:!0,showBoilerplate:!0,indent:" "},t),c=new code_builder_1.CodeBuilder({indentation:h.indent,variablesPrefix:h.variablesPrefix,capitalize:h.capitalize,lang:constants_1.Lang.RUBY});h.showBoilerplate&&(c.push("require 'uri'").push("require 'net/http'"),"https:"===e.uriObj.protocol&&c.push("require 'openssl'"),(hasMimeType(e.postData,types_1.MediaTypes.JSON)||d)&&c.unshift("require 'json'"),c.blank()),Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){e.allHeaders[t]="'"+e.allHeaders[t]+"'"}));var _=u.charAt(0)+u.substring(1).toLowerCase();if(["GET","POST","HEAD","DELETE","PATCH","PUT","OPTIONS","COPY","LOCK","UNLOCK","MOVE","TRACE"].indexOf(u)<0&&c.push("class Net::HTTP::%s < Net::HTTPRequest",_).push(" METHOD = '%s'",u.toUpperCase()).push(" REQUEST_HAS_BODY = '%s'",(null===(a=e.postData)||void 0===a?void 0:a.text)?"true":"false").push(" RESPONSE_HAS_BODY = true").push("end").blank(),d){var b="oAuth2",v=new __1.HTTPSnippet(d).convert(o,p,(0,tslib_1.__assign)((0,tslib_1.__assign)({},h),{variablesPrefix:b,showBoilerplate:!1})),y=b+(h.capitalize?"Response":"response");c.push(v).push("access_token = JSON.parse("+y+".body)['access_token']").blank(),e.allHeaders.Authorization='"Bearer " + access_token'}if((0,code_helpers_1.printUrlVariablesDeclarations)(e,c),c.push(c.var("url")+" = URI("+(0,code_helpers_1.buildUrlExpression)(e,c)+")"),Object.getOwnPropertyNames(e.queryObj).length&&(c.push(c.var("params")+" = "+(0,stringify_object_1.default)(e.queryObj,{indent:h.indent,inlineCharacterLimit:25})),c.push(c.var("url")+".query = URI.encode_www_form("+c.var("params")+")")),c.blank().push(c.var("http")+" = Net::HTTP.new("+c.var("url")+".host, "+c.var("url")+".port)"),"https:"===e.uriObj.protocol&&c.push(c.var("http")+".use_ssl = true"),c.blank().push(c.var("request")+" = Net::HTTP::%s.new("+c.var("url")+")",_),Object.keys(e.allHeaders).length&&Object.keys(e.allHeaders).forEach((function(t){e.allHeaders[t]!=="'"+types_1.MediaTypes.MULTIPART+"'"&&c.push(c.var("request")+"['%s'] = %s",t,e.allHeaders[t])})),null==e?void 0:e.postData){var T={};switch((0,utils_1.normalizeMimeType)(null===(i=null==e?void 0:e.postData)||void 0===i?void 0:i.mimeType)){case types_1.MediaTypes.URL_ENCODED:e.postData.params.forEach((function(e){T[e.name]=e.value})),c.push(c.var("request")+".body = URI.encode_www_form("+(0,stringify_object_1.default)(T,{indent:h.indent,inlineCharacterLimit:25})+")");break;case types_1.MediaTypes.JSON:c.push(c.var("request")+".body = "+(0,stringify_object_1.default)(e.postData.jsonObj,{indent:h.indent,inlineCharacterLimit:25}).replace(/null/g,"nil")+".to_json");break;case types_1.MediaTypes.MULTIPART:e.postData.params&&(c.push(c.var("form_data")+" = ["),e.postData.params.forEach((function(e){c.push(indent,"['"+e.name+"', '"+e.value+"'],")})),c.push("]")),c.push(c.var("request")+".set_form("+c.var("form_data")+", '"+types_1.MediaTypes.MULTIPART+"')");break;default:(null===(n=e.postData)||void 0===n?void 0:n.text)&&c.push(c.var("request")+".body = "+JSON.stringify(null===(l=e.postData)||void 0===l?void 0:l.text))}}if(e.basicAuth){var f=e.basicAuth,m=f.username,O=f.password;c.push(c.var("request")+".basic_auth('"+m+"', '"+O+"')")}return c.blank().push(c.var("response")+" = "+c.var("http")+".request("+c.var("request")+")").push("puts "+c.var("response")+".read_body").blank(),c.join()};exports.info={key:"native",title:"net::http",link:"http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",description:"Ruby HTTP client"},exports.default=handler;
2
2
  //# sourceMappingURL=native.js.map
package/lib/utils.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getJsUrl=exports.getWindowReferenceOptions=exports.dottedString=exports.joinStringFactory=exports.get=exports.getSecurityDetailsOptions=exports.getSecurityDetails=exports.setSecurityDetailsVariants=exports.setSecurityDetails=exports.unescapeFormId=exports.escapeFormId=exports.fromLocalStorage=exports.toLocalStorage=exports.getParameterValue=exports.setParameterValue=exports.fromSessionStorage=exports.toSessionStorage=exports.debounce=exports.setGlobalStore=exports.getGlobalStore=void 0;var _store,utils_1=require("./redoc-lib/src/utils"),getGlobalStore=function(){return _store};exports.getGlobalStore=getGlobalStore;var setGlobalStore=function(e){return _store=e};function debounce(e,t,r){var o,s=0;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];function a(){s>1&&e.apply(void 0,n),s=0,o=null}s++,o?clearTimeout(o):r&&e.apply(void 0,n),o=setTimeout(a,t)}}function toSessionStorage(e,t){utils_1.IS_BROWSER&&window.sessionStorage.setItem("redoc."+e,t)}function fromSessionStorage(e){return utils_1.IS_BROWSER&&window.sessionStorage.getItem("redoc."+e)||""}function setParameterValue(e,t,r){toSessionStorage(e+"."+t,JSON.stringify(r))}function getParameterValue(e,t){try{return JSON.parse(fromSessionStorage(e+"."+t))}catch(e){return null}}function toLocalStorage(e,t){window.localStorage.setItem("redoc."+e,t)}function fromLocalStorage(e){return utils_1.IS_BROWSER&&window.localStorage.getItem("redoc."+e)||""}function escapeFormId(e){return e.replace(/[.[\]]/g,(function(e){return{".":"%2e","[":"%5b","]":"%5d"}[e]||""}))}function unescapeFormId(e){return e.replace(/%2e|%5b|%5d/g,(function(e){return{"%2e":".","%5b":"[","%5d":"]"}[e]||""}))}function setSecurityDetails(e,t){e=escapeFormId(e),"string"==typeof t?toSessionStorage("auth."+e,t):t&&(toSessionStorage("auth."+e+".password",t.password||""),toSessionStorage("auth."+e+".username",t.username||""),toSessionStorage("auth."+e+".token",t.token&&JSON.stringify(t.token)||""),toSessionStorage("auth."+e+".client_id",t.client_id||""),toSessionStorage("auth."+e+".client_secret",t.client_secret||""),toSessionStorage("auth."+e+".scopes",t.scopes&&JSON.stringify(t.scopes)||""))}function setSecurityDetailsVariants(e,t){toSessionStorage("auth."+(e=escapeFormId(e))+".variants",JSON.stringify(t))}function getSecurityDetails(e){var t=fromSessionStorage("auth."+(e=escapeFormId(e))),r=fromSessionStorage("auth."+e+".token");return{raw:t,password:fromSessionStorage("auth."+e+".password"),username:fromSessionStorage("auth."+e+".username"),token:r&&JSON.parse(r)||null,client_id:fromSessionStorage("auth."+e+".client_id"),client_secret:fromSessionStorage("auth."+e+".client_secret"),scopes:fromSessionStorage("auth."+e+".scopes")}}function getSecurityDetailsOptions(e,t){var r=fromSessionStorage("auth."+(e=escapeFormId(e))+".variants");if(!r)return null;var o=JSON.parse(r);return o&&Array.isArray(o)?o.map((function(e){return e.details?""===t&&e.details&&"string"==typeof e.details?{label:e.label,value:e.details}:"object"==typeof e.details?{label:e.label,value:e.details[t]}:null:null})).filter(notNull):null}function notNull(e){return null!==e}function get(e,t,r){return void 0===e&&(e={}),"string"==typeof t&&(t=t.split(".")),t.reduce((function(e,t){return e&&e[t]?e[t]:r}),e)}function joinStringFactory(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter(Boolean).join(e)}}function getWindowReferenceOptions(e){var t;return utils_1.IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}function getJsUrl(){var e;if(!utils_1.IS_BROWSER)return"";var t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+t+'"><\/script>'),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}exports.setGlobalStore=setGlobalStore,exports.debounce=debounce,exports.toSessionStorage=toSessionStorage,exports.fromSessionStorage=fromSessionStorage,exports.setParameterValue=setParameterValue,exports.getParameterValue=getParameterValue,exports.toLocalStorage=toLocalStorage,exports.fromLocalStorage=fromLocalStorage,exports.escapeFormId=escapeFormId,exports.unescapeFormId=unescapeFormId,exports.setSecurityDetails=setSecurityDetails,exports.setSecurityDetailsVariants=setSecurityDetailsVariants,exports.getSecurityDetails=getSecurityDetails,exports.getSecurityDetailsOptions=getSecurityDetailsOptions,exports.get=get,exports.joinStringFactory=joinStringFactory,exports.dottedString=joinStringFactory("."),exports.getWindowReferenceOptions=getWindowReferenceOptions,exports.getJsUrl=getJsUrl;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getJsUrl=exports.getWindowReferenceOptions=exports.dottedString=exports.joinStringFactory=exports.get=exports.getSecurityDetailsOptions=exports.getSecurityDetails=exports.setSecurityDetailsVariants=exports.setSecurityDetails=exports.unescapeFormId=exports.escapeFormId=exports.fromLocalStorage=exports.toLocalStorage=exports.getParameterValue=exports.setParameterValue=exports.fromSessionStorage=exports.toSessionStorage=exports.debounce=exports.setGlobalStore=exports.getGlobalStore=void 0;var _store,utils_1=require("./redoc-lib/src/utils"),getGlobalStore=function(){return _store};exports.getGlobalStore=getGlobalStore;var setGlobalStore=function(e){return _store=e};function debounce(e,t,r){var o,s=0;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];s++,o?clearTimeout(o):r&&e.apply(void 0,n),o=setTimeout((function(){s>1&&e.apply(void 0,n),s=0,o=null}),t)}}function toSessionStorage(e,t){utils_1.IS_BROWSER&&window.sessionStorage.setItem("redoc."+e,t)}function fromSessionStorage(e){return utils_1.IS_BROWSER&&window.sessionStorage.getItem("redoc."+e)||""}function setParameterValue(e,t,r){toSessionStorage(e+"."+t,JSON.stringify(r))}function getParameterValue(e,t){try{return JSON.parse(fromSessionStorage(e+"."+t))}catch(e){return null}}function toLocalStorage(e,t){window.localStorage.setItem("redoc."+e,t)}function fromLocalStorage(e){return utils_1.IS_BROWSER&&window.localStorage.getItem("redoc."+e)||""}function escapeFormId(e){return e.replace(/[.[\]]/g,(function(e){return{".":"%2e","[":"%5b","]":"%5d"}[e]||""}))}function unescapeFormId(e){return e.replace(/%2e|%5b|%5d/g,(function(e){return{"%2e":".","%5b":"[","%5d":"]"}[e]||""}))}function setSecurityDetails(e,t){e=escapeFormId(e),"string"==typeof t?toSessionStorage("auth."+e,t):t&&(toSessionStorage("auth."+e+".password",t.password||""),toSessionStorage("auth."+e+".username",t.username||""),toSessionStorage("auth."+e+".token",t.token&&JSON.stringify(t.token)||""),toSessionStorage("auth."+e+".client_id",t.client_id||""),toSessionStorage("auth."+e+".client_secret",t.client_secret||""),toSessionStorage("auth."+e+".scopes",t.scopes&&JSON.stringify(t.scopes)||""))}function setSecurityDetailsVariants(e,t){toSessionStorage("auth."+(e=escapeFormId(e))+".variants",JSON.stringify(t))}function getSecurityDetails(e){var t=fromSessionStorage("auth."+(e=escapeFormId(e))),r=fromSessionStorage("auth."+e+".token");return{raw:t,password:fromSessionStorage("auth."+e+".password"),username:fromSessionStorage("auth."+e+".username"),token:r&&JSON.parse(r)||null,client_id:fromSessionStorage("auth."+e+".client_id"),client_secret:fromSessionStorage("auth."+e+".client_secret"),scopes:fromSessionStorage("auth."+e+".scopes")}}function getSecurityDetailsOptions(e,t){var r=fromSessionStorage("auth."+(e=escapeFormId(e))+".variants");if(!r)return null;var o=JSON.parse(r);return o&&Array.isArray(o)?o.map((function(e){return e.details?""===t&&e.details&&"string"==typeof e.details?{label:e.label,value:e.details}:"object"==typeof e.details?{label:e.label,value:e.details[t]}:null:null})).filter(notNull):null}function notNull(e){return null!==e}function get(e,t,r){return void 0===e&&(e={}),"string"==typeof t&&(t=t.split(".")),t.reduce((function(e,t){return e&&e[t]?e[t]:r}),e)}function joinStringFactory(e){return function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return t.filter(Boolean).join(e)}}function getWindowReferenceOptions(e){var t;return utils_1.IS_BROWSER?null===(t=null===window||void 0===window?void 0:window.REFERENCE_DOCS_OPTIONS)||void 0===t?void 0:t[e]:null}function getJsUrl(){var e;if(!utils_1.IS_BROWSER)return"";var t=+new Date+Math.random();try{return document.currentScript&&(document.currentScript.async||document.currentScript.defer)||document.write('<script id="dummy'+t+'"><\/script>'),(null===(e=document.getElementById("dummy"+t))||void 0===e?void 0:e.previousSibling).src}catch(e){return""}}exports.setGlobalStore=setGlobalStore,exports.debounce=debounce,exports.toSessionStorage=toSessionStorage,exports.fromSessionStorage=fromSessionStorage,exports.setParameterValue=setParameterValue,exports.getParameterValue=getParameterValue,exports.toLocalStorage=toLocalStorage,exports.fromLocalStorage=fromLocalStorage,exports.escapeFormId=escapeFormId,exports.unescapeFormId=unescapeFormId,exports.setSecurityDetails=setSecurityDetails,exports.setSecurityDetailsVariants=setSecurityDetailsVariants,exports.getSecurityDetails=getSecurityDetails,exports.getSecurityDetailsOptions=getSecurityDetailsOptions,exports.get=get,exports.joinStringFactory=joinStringFactory,exports.dottedString=joinStringFactory("."),exports.getWindowReferenceOptions=getWindowReferenceOptions,exports.getJsUrl=getJsUrl;
2
2
  //# sourceMappingURL=utils.js.map