@mongodb-js/compass-query-bar
Version:
Renders a component for executing MongoDB queries through a GUI.
2 lines • 720 kB
JavaScript
/*! For license information please see index.js.LICENSE.txt */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.QueryBarPlugin=t():e.QueryBarPlugin=t()}(global,(function(){return(()=>{var e={8195:(e,t,n)=>{"use strict";n.r(t),n.d(t,{activate:()=>Me,configureActions:()=>G,configureStore:()=>ye,deactivate:()=>Le,default:()=>be,metadata:()=>ge});var r=n(7028),i=n.n(r),a=n(9497),s=n.n(a),o=n(3980),u=n.n(o);const c=require("hadron-react-components");var l=n(6635);const d=require("@mongodb-js/compass-components"),h={filter:{name:"filter",type:"document",placeholder:"Type a query: { field: 'value' }",link:"https://docs.mongodb.com/compass/current/query/filter/"},project:{name:"project",type:"document",placeholder:"{ field: 0 }",link:"https://docs.mongodb.com/manual/tutorial/project-fields-from-query-results/"},sort:{name:"sort",type:"document",placeholder:"{ field: -1 } or [['field', -1]]",link:"https://docs.mongodb.com/manual/reference/method/cursor.sort/"},collation:{name:"collation",type:"document",placeholder:"{ locale: 'simple' }",link:"https://docs.mongodb.com/master/reference/collation/"},skip:{name:"skip",type:"numeric",placeholder:"0",link:"https://docs.mongodb.com/manual/reference/method/cursor.skip/"},limit:{name:"limit",type:"numeric",placeholder:"0",link:"https://docs.mongodb.com/manual/reference/method/cursor.limit/"},maxTimeMS:{name:"maxTimeMS",label:"Max Time MS",type:"numeric",placeholder:"60000",link:"https://docs.mongodb.com/manual/reference/method/cursor.maxTimeMS/"}},_=require("mongodb-ace-autocompleter"),f=(0,d.css)({minWidth:d.spacing[7],border:"1px solid transparent",borderRadius:d.spacing[1],overflow:"visible"}),p=(0,d.css)({borderColor:d.uiColors.red.base,"&:focus-within":{borderColor:d.uiColors.gray.base}}),m={useSoftTabs:!0,minLines:1,maxLines:10,fontSize:12,highlightActiveLine:!1,showGutter:!1};function y(e,t){const n=e.commands.byName[t];n.bindKey=void 0,e.commands.addCommand(n)}const g=({hasError:e,id:t,onChange:n,onApply:r,placeholder:i,refreshEditorAction:o,schemaFields:u=[],serverVersion:c="3.6.0",value:l=""})=>{const h=(0,d.useFocusRing)({outer:!0,focusWithin:!0,hover:!0}),g=(0,a.useRef)(new _.QueryAutoCompleter(c,d.EditorTextCompleter,u)),v=(0,a.useRef)(void 0);(0,a.useEffect)((()=>{const e=o.listen((()=>{v.current?.renderer.updateFull()}));return()=>{e()}}),[o]),(0,a.useLayoutEffect)((()=>{g.current.update(u)}),[u]);const M=(0,a.useCallback)((()=>r()),[r]),L=(0,a.useRef)(M);L.current=M;const b=(0,a.useCallback)((e=>{e.renderer.setPadding(d.spacing[2]),v.current=e,v.current.setBehavioursEnabled(!0),y(e,"indent"),y(e,"outdent"),v.current.commands.addCommand({name:"executeQuery",bindKey:{win:"Enter",mac:"Enter"},exec:()=>{L.current()}})}),[]);return s().createElement(d.Editor,{variant:d.EditorVariant.Shell,className:(0,d.cx)(f,h.className,e&&p),theme:"mongodb-query",text:l,onChangeText:e=>n(e),id:t,options:m,completer:g.current,placeholder:i,fontSize:12,scrollMargin:[6,6,0,0],onLoad:b})},v=(0,d.css)({display:"flex",position:"relative",alignItems:"flex-start"}),M=(0,d.css)({flexGrow:1}),L=(0,d.css)({paddingTop:d.spacing[1],marginRight:d.spacing[2]}),b=(0,d.cx)(L,(0,d.css)({minWidth:3*d.spacing[5]})),k=(0,d.css)({minWidth:d.spacing[7],display:"flex",flexGrow:1}),Y=(0,d.css)({input:{borderColor:"transparent"}}),w=(0,d.css)({input:{borderColor:"transparent"}}),S=(0,d.css)({input:{borderColor:d.uiColors.red.base}}),x=(0,d.css)({height:d.spacing[4]+d.spacing[1],textTransform:"capitalize",display:"flex",alignItems:"center"}),D=(0,d.cx)(x,(0,d.css)({minWidth:3*d.spacing[5]})),T=(0,d.withTheme)((({darkMode:e,hasError:t,onApply:n,onChange:r,id:i,placeholder:o="",queryOption:u,refreshEditorAction:c,schemaFields:l=[],serverVersion:_,value:f=""})=>{const p=(0,a.useMemo)((()=>"document"===h[u].type),[u]);return s().createElement("div",{className:(0,d.cx)(v,p&&M),"data-testid":`query-bar-option-${u}`},"filter"!==u&&s().createElement("div",{className:p?D:x},s().createElement(d.Label,{htmlFor:i,id:`query-bar-option-input-${u}-label`,className:p?b:L},u)),s().createElement("div",{className:(0,d.cx)(p&&k)},p?s().createElement(g,{hasError:t,id:i,queryOption:u,onApply:n,onChange:r,placeholder:o,refreshEditorAction:c,schemaFields:l,serverVersion:_,value:f}):s().createElement(d.TextInput,{"aria-labelledby":`query-bar-option-input-${u}-label`,id:i,"data-testid":"query-bar-option-input",className:(0,d.cx)(e?w:Y,t&&S),type:"text",sizeVariant:"small",state:t?"error":"none",value:`${f}`,onChange:e=>r(e.target.value),placeholder:o})))})),j=require("@mongodb-js/compass-logging"),{track:A}=(0,j.createLoggerAndTelemetry)("COMPASS-QUERY-BAR-UI"),E=(0,d.cx)((0,d.css)({border:"none",backgroundColor:"transparent",display:"inline-flex",alignItems:"center",padding:d.spacing[2]-2,marginLeft:d.spacing[1],"&:hover":{cursor:"pointer"}}),d.focusRing),O=(0,d.css)({maxHeight:"calc(100vh - 270px)",marginTop:d.spacing[1],display:"flex"}),H=({globalAppRegistry:e,localAppRegistry:t})=>{const n=(0,a.useRef)({component:e.getRole("Query.QueryHistory")?.[0].component,store:t.getStore("Query.History"),actions:t.getAction("Query.History.Actions")}),[r,i]=(0,a.useState)(!1),o=(0,a.useCallback)((e=>{e&&A("Query History Opened"),i(e)}),[i]),u=n.current.component;if(!u)return null;const c=({onClose:e})=>s().createElement(u,{onClose:e,store:n.current?.store,actions:n.current?.actions});return s().createElement(d.InteractivePopover,{className:O,trigger:({onClick:e,ref:t,children:n})=>s().createElement(s().Fragment,null,s().createElement("button",{"data-testid":"query-history-button",onClick:e,className:E,"aria-label":"Open query history","aria-haspopup":"true",tabIndex:0,"aria-expanded":!!r||void 0,type:"button",ref:t},s().createElement(d.Icon,{glyph:"Clock"}),s().createElement(d.Icon,{glyph:"CaretDown"})),n),open:r,setOpen:o},c)},C=(0,d.css)({alignItems:"flex-start",display:"flex",flexGrow:1,position:"relative",gap:d.spacing[2]}),P=({queryOptionsLayout:e,onApply:t,onChangeQueryOption:n,queryOptionProps:r,refreshEditorAction:i,schemaFields:a,serverVersion:o})=>s().createElement("div",{className:C},"string"==typeof e?s().createElement(T,{hasError:!r[`${e}Valid`],key:`query-option-${e}`,queryOption:e,onChange:t=>n(e,t),onApply:t,placeholder:r[`${e}Placeholder`]||h[e].placeholder,id:`query-bar-option-input-${e}`,refreshEditorAction:i,schemaFields:a,serverVersion:o,value:r[`${e}String`]}):e.map((e=>s().createElement(T,{hasError:!r[`${e}Valid`],key:`query-option-${e}`,queryOption:e,onChange:t=>n(e,t),onApply:t,placeholder:r[`${e}Placeholder`]||h[e].placeholder,id:`query-bar-option-input-${e}`,refreshEditorAction:i,schemaFields:a,serverVersion:o,value:r[`${e}String`]})))),I=(0,d.css)({display:"flex",flexDirection:"column",flexGrow:1,background:"white",border:`1px solid ${d.uiColors.gray.light2}`,borderRadius:"6px",padding:d.spacing[2]}),F=(0,d.css)({background:d.uiColors.gray.dark3,borderColor:d.uiColors.gray.dark2}),N=(0,d.css)({display:"flex",alignItems:"flex-start",gap:d.spacing[2],paddingLeft:d.spacing[2]}),R=(0,d.css)({flexGrow:1}),W=(0,d.css)({padding:0}),$=(0,d.css)({display:"flex",flexDirection:"column",marginTop:d.spacing[2],padding:`0 ${d.spacing[2]}px`,gap:d.spacing[2]}),z=(0,d.withTheme)((({buttonLabel:e="Apply",darkMode:t,expanded:n=!1,globalAppRegistry:r,localAppRegistry:i,onApply:o,onChangeQueryOption:u,onOpenExportToLanguage:c,onReset:l,queryOptionsLayout:_=["project",["sort","maxTimeMS"],["collation","skip","limit"]],queryState:f,refreshEditorAction:p,resultId:m,schemaFields:y,serverVersion:g,showExportToLanguageButton:v=!0,showQueryHistoryButton:M=!0,toggleExpandQueryOptions:L,valid:b,...k})=>{const Y=(0,a.useCallback)((()=>{b&&o()}),[o,b]),w=(0,a.useCallback)((e=>{e.preventDefault(),Y()}),[Y]),S="query-bar-option-input-filter";return s().createElement("form",{className:(0,d.cx)(I,t&&F),"data-testid":"query-bar",onSubmit:w,noValidate:!0,"data-result-id":m},s().createElement("div",{className:N},s().createElement("div",{className:D},s().createElement(d.Label,{htmlFor:S,id:"query-bar-option-input-filter-label",className:W},s().createElement(d.Link,{href:"https://docs.mongodb.com/compass/current/query/filter/",target:"_blank"},"Filter")),M&&s().createElement(H,{localAppRegistry:i,globalAppRegistry:r})),s().createElement("div",{className:R},s().createElement(T,{hasError:!k.filterValid,queryOption:"filter",id:S,onChange:e=>u("filter",e),onApply:Y,placeholder:k.filterPlaceholder||h.filter.placeholder,refreshEditorAction:p,schemaFields:y,serverVersion:g,value:k.filterString})),s().createElement(d.Button,{"aria-label":"Reset query","data-testid":"query-bar-reset-filter-button",onClick:l,disabled:"apply"!==f,size:"small",type:"button"},"Reset"),s().createElement(d.Button,{"data-testid":"query-bar-apply-filter-button",disabled:!b,variant:"primary",size:"small",type:"submit",onClick:w},e),v&&s().createElement(d.Button,{onClick:c,title:"Open export to language","aria-label":"Open export to language","data-testid":"query-bar-open-export-to-language-button",type:"button",size:"small"},s().createElement(d.Icon,{glyph:"Code"})),_&&_.length>0&&s().createElement(d.MoreOptionsToggle,{"aria-controls":"additional-query-options-container","data-testid":"query-bar-options-toggle",isExpanded:n,onToggleOptions:L})),n&&_&&_.length>0&&s().createElement("div",{className:$,id:"additional-query-options-container"},_.map(((e,t)=>s().createElement(P,{queryOptionsLayout:e,key:`query-bar-row-${t}`,queryOptionProps:k,onChangeQueryOption:u,onApply:Y,refreshEditorAction:p,schemaFields:y,serverVersion:g})))))}));function V({actions:e,onApply:t,onReset:n,store:r,...o}){const u=(0,a.useCallback)((()=>{e.apply(),(0,l.isFunction)(t)&&t()}),[t,e]),d=(0,a.useCallback)((()=>{e.reset(),(0,l.isFunction)(n)&&n()}),[n,e]);return s().createElement(c.StoreConnector,{store:r},s().createElement(z,i()({onApply:u,onReset:d,onChangeQueryOption:e.typeQueryString,onOpenExportToLanguage:e.exportToLanguage,refreshEditorAction:e.refreshEditor,toggleExpandQueryOptions:e.toggleQueryOptions,globalAppRegistry:r.globalAppRegistry,localAppRegistry:r.localAppRegistry},o)))}V.displayName="QueryBarPlugin",V.propTypes={actions:u().object.isRequired,onApply:u().func,onReset:u().func,queryOptions:u().arrayOf(u().string),resultId:u().oneOfType([u().string,u().number]),showExportToLanguageButton:u().bool,showQueryHistoryButton:u().bool,store:u().object.isRequired};const B=V;var U=n(862),q=n.n(U);const G=()=>q().createActions({toggleQueryOptions:{sync:!0},toggleSample:{sync:!0},setQuery:{sync:!0},setQueryString:{sync:!0},typeQueryString:{sync:!0},setValue:{sync:!0},clearValue:{sync:!0},addDistinctValue:{sync:!0},removeDistinctValue:{sync:!0},toggleDistinctValue:{sync:!0},setDistinctValues:{sync:!0},setRangeValues:{sync:!0},setGeoWithinValue:{sync:!0},apply:{sync:!0},reset:{sync:!0},exportToLanguage:{sync:!0},toggleQueryHistory:{sync:!0},refreshEditor:{sync:!0}});var J=n(9837),K=n.n(J),Q=n(3347),Z=n.n(Q);const X=require("assert");var ee=n.n(X),te=n(7776),ne=n.n(te),re=n(4943);const ie=["filter","project","collation","sort","skip","limit","sample","maxTimeMS"],ae=["$geoIntersects","$geoWithin","$near","$nearSphere"];function se(e){return!!(0,l.isPlainObject)(e)&&0!==(0,l.intersection)(Object.keys(e),ae).length}function oe(e){return null!==e&&"object"==typeof e&&("[object RegExp]"===Object.prototype.toString.call(e)||Object.values(e).some(oe))}var ue=n(1378);const ce={},le=n.n(ue)()("1m"),de=n(445)("mongodb-compass:stores:query-changed-store"),he=ie.concat(["queryState","ns"]),_e=(e={})=>{const t=q().createStore({mixins:[K().store],init:function(){this.queryBarStore=e.store,this.queryBarStore.listen(this.onQueryBarStoreChanged.bind(this)),this.lastExecutedQuery=this.queryBarStore.state.lastExecutedQuery,this.namespace=e.namespace},getInitialState:()=>(0,l.pick)(e.store.getInitialState(),he),_detectChange(e){const t=!(0,l.isEqual)(this.lastExecutedQuery,e.lastExecutedQuery)||!(0,l.isEqual)(this.namespace,e.ns);return t&&(this.lastExecutedQuery=(0,l.cloneDeep)(e.lastExecutedQuery),this.namespace=e.ns),t},onQueryBarStoreChanged(e){if(this._detectChange(e)){const t={},n=e.lastExecutedQuery||this.getInitialState();for(const e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e]);t.queryState=e.queryState,t.ns=e.ns;const r=this.localAppRegistry,i=this.globalAppRegistry;if(r?r.emit("query-changed",t):de("Error: AppRegistry not available for query-changed-store"),i){const e=this.queryBarStore.state.isTimeSeries?"time-series":"collection";i.emit("compass:query-bar:query-changed",{...t,collectionType:e})}this.setState(t)}}});return e.localAppRegistry&&(t.localAppRegistry=e.localAppRegistry),e.globalAppRegistry&&(t.globalAppRegistry=e.globalAppRegistry),t},{track:fe,debug:pe}=(0,j.createLoggerAndTelemetry)("COMPASS-QUERY-BAR-UI"),me="Query.ChangedStore",ye=(e={})=>{const t=q().createStore({mixins:[K().store],listenables:e.actions,onCollectionChanged(e,t,n){const r=this.getInitialState();r.ns=e,r.isTimeSeries=t,r.isReadonly=n,this.setState(r)},onServerVersionChanged(e){this.setState({serverVersion:e})},exportToLanguage(){this.localAppRegistry.emit("open-query-export-to-language",{filter:this.state.filterString,project:this.state.projectString,sort:this.state.sortString,collation:this.state.collationString,skip:this.state.skipString,limit:this.state.limitString,maxTimeMS:this.state.maxTimeMSString}),this.globalAppRegistry.emit("compass:export-to-language:opened",{source:"Query"})},toggleQueryHistory(){this.localAppRegistry.emit("toggle-query-history")},getInitialState:()=>({filter:ce,project:null,sort:null,collation:null,skip:0,limit:0,sample:!1,maxTimeMS:le,filterString:"",projectString:"",sortString:"",collationString:"",skipString:"",limitString:"",maxTimeMSString:"",queryState:"reset",valid:!0,filterValid:!0,projectValid:!0,sortValid:!0,collationValid:!0,skipValid:!0,limitValid:!0,sampleValid:!0,maxTimeMSValid:!0,lastExecutedQuery:null,userTyping:!1,autoPopulated:!1,expanded:!1,ns:"",isTimeSeries:!1,isReadonly:!1,serverVersion:"3.6.0",schemaFields:[]}),_stoppedTyping(){this.userTypingTimer=null,this.setState({userTyping:!1})},toggleQueryOptions(e){this.setState({expanded:(0,l.isBoolean)(e)?e:!this.state.expanded})},toggleSample(e){const t={sample:(0,l.isBoolean)(e)?e:!this.state.sample};t.sample&&0===this.state.limit&&(t.limit=1e3,t.limitString=String(1e3),t.limitValid=!0),this.setState(t)},typeQueryString(e,t){this.userTypingTimer&&clearTimeout(this.userTypingTimer),this.userTypingTimer=setTimeout(this._stoppedTyping,100),this.setQueryString(e,t,!0)},setQueryString(e,t,n){ee()(ie.includes(e));const r=this._validateInput(e,t),i={userTyping:Boolean(n)};if(i[`${e}String`]=t,i[`${e}Valid`]=!1!==r,!1!==r){i[e]=r;const t={filter:this.state.filterValid,project:this.state.projectValid,sort:this.state.sortValid,collation:this.state.collationValid,skip:this.state.skipValid,limit:this.state.limitValid,maxTimeMS:this.state.maxTimeMSValid};t[e]=!1!==r,i.valid=(0,l.every)((0,l.values)(t))}else i.valid=!1;i.autoPopulated=!n,this.setState(i)},autoPopulateQuery(e){this.setQuery(e,!0)},handleGeoQueryFromSchema(e){const t=function(e,t){const n={...e};for(const[e,t]of Object.entries(n))se(t)&&delete n[e];Array.isArray(n.$or)&&(n.$or=n.$or.filter((e=>!function(e){return!!(0,l.isPlainObject)(e)&&void 0!==Object.values(e).find(se)}(e))),n.$or.length||delete n.$or);for(const[e,r]of Object.entries(t))se(r)&&(n[e]=r);return t.$or&&(n.$or=[...Array.isArray(n.$or)?n.$or:[],...t.$or]),n}(this.state.filter,e);this.setQuery({filter:t},!0)},setQuery(e,t=!1){((0,l.isUndefined)(e)||(0,l.isNull)(e))&&(e=this._getDefaultQuery());const n=(0,l.without)(ie,"sample");let r=(0,l.mapValues)((0,l.pick)(e,n),Z().stringify),i=(0,l.mapValues)(r,((e,t)=>!1!==this._validateInput(t,e)));const a=[];Object.keys(i).forEach((e=>{!0===i[e]&&a.push(e)}));const s=(0,l.every)((0,l.values)(Object.assign({filter:this.state.filterValid,project:this.state.projectValid,sort:this.state.sortValid,collation:this.state.collationValid,skip:this.state.skipValid,limit:this.state.limitValid,maxTimeMS:this.state.maxTimeMSValid},i)));r=(0,l.mapKeys)(r,((e,t)=>`${t}String`)),i=(0,l.mapKeys)(i,((e,t)=>`${t}Valid`));const o=Object.assign({},(0,l.pick)(e,a),r,i);(0,l.has)(e,"sample")&&this.toggleSample(e.sample),o.autoPopulated=t,o.valid=s,this.setState(o)},_cloneQuery(){return(0,l.mapValues)((0,l.pick)(this.state,ie),l.clone)},_getDefaultQuery(){return(0,l.pick)(this.getInitialState(),ie)},_validateInput(e,t){const n=Z().validate(e,t,{validate:!1});return("filter"!==e||""!==n)&&n},_validateQuery(){return!1!==Z().isFilterValid(this.state.filterString,{validate:!1})&&!1!==Z().isProjectValid(this.state.projectString)&&!1!==Z().isSortValid(this.state.sortString)&&!1!==Z().isCollationValid(this.state.collationString)&&!1!==Z().isSkipValid(this.state.skipString)&&!1!==Z().isLimitValid(this.state.limitString)&&!1!==Z().isMaxTimeMSValid(this.state.maxTimeMSString)},setValue(e){const t=(0,l.clone)(this.state.filter);e.unsetIfSet&&(0,l.isEqual)(t[e.field],e.value,re.bsonEqual)?delete t[e.field]:t[e.field]=e.value,this.setQuery({filter:t},!0)},setDistinctValues(e){const t=(0,l.clone)(this.state.filter);if((0,l.isArray)(e.value))return e.value.length>1?t[e.field]={$in:e.value}:1===e.value.length?t[e.field]=e.value[0]:this.clearValue(e),void this.setQuery({filter:t},!0);t[e.field]=e.value,this.setQuery({filter:t},!0)},clearValue(e){const t=(0,l.clone)(this.state.filter);delete t[e.field],this.setQuery({filter:t},!0)},addDistinctValue(e){const t=(0,l.clone)(this.state.filter),n=(0,l.get)(t,e.field,void 0);if(void 0===n)return t[e.field]=e.value,void this.setQuery({filter:t},!0);if((0,l.isPlainObject)(n)){if((0,l.has)(n,"$in")){const n=t[e.field].$in;return void((0,l.includes)(n,e.value)||(t[e.field].$in.push(e.value),this.setQuery({filter:t},!0)))}return t[e.field]=e.value,void this.setQuery({filter:t},!0)}t[e.field]={$in:[n,e.value]},this.setQuery({filter:t},!0)},removeDistinctValue(e){const t=(0,l.clone)(this.state.filter),n=(0,l.get)(t,e.field,void 0);if(void 0!==n){if((0,l.isPlainObject)(n)&&(0,l.has)(n,"$in")){const n=t[e.field].$in,r=(0,l.pull)(n,e.value);return r.length>1?t[e.field].$in=r:1===r.length?t[e.field]=r[0]:delete t[e.field],void this.setQuery({filter:t},!0)}return(0,l.isEqual)(n,e.value,re.bsonEqual)?(delete t[e.field],void this.setQuery({filter:t},!0)):void 0}},toggleDistinctValue(e){const t=(0,l.get)(this.state.filter,e.field,void 0);((0,re.hasDistinctValue)(t,e.value)?this.removeDistinctValue:this.addDistinctValue)(e)},setRangeValues(e){const t=(0,l.clone)(this.state.filter),n={};let r;const i=(0,l.get)(e,"min",void 0),a=(0,l.get)(e,"max",void 0);void 0!==i||void 0!==a?(void 0!==i&&(r=(0,l.get)(e,"minInclusive",!0)?"$gte":"$gt",n[r]=i),void 0!==a&&(r=(0,l.get)(e,"maxInclusive",!1)?"$lte":"$lt",n[r]=a),e.unsetIfSet&&(0,l.isEqual)(t[e.field],n,re.bsonEqual)?delete t[e.field]:t[e.field]=n,this.setQuery({filter:t},!0)):this.clearValue({field:e.field})},setGeoWithinValue(e){const t=(0,l.clone)(this.state.filter),n={},r=(0,l.get)(e,"radius",0),i=(0,l.get)(e,"center",null);if(r&&i)return n.$geoWithin={$centerSphere:[[i[0],i[1]],r]},t[e.field]=n,void this.setQuery({filter:t},!0);this.clearValue({field:e.field})},apply(){if(this._validateQuery()){fe("Query Executed",{has_projection:!!this.state.project&&Object.keys(this.state.project).length>0,has_skip:this.state.skip>0,has_limit:this.state.limit>0,has_collation:!!this.state.collation,changed_maxtimems:this.state.maxTimeMS!==le,collection_type:this.state.isTimeSeries?"time-series":this.state.isReadonly?"readonly":"collection",used_regex:oe(this.state.filter)});const e=this.localAppRegistry;if(e){const t={filter:this.state.filter,project:this.state.project,sort:this.state.sort,collation:this.state.collation,skip:this.state.skip,limit:this.state.limit,ns:this.state.ns,maxTimeMS:this.state.maxTimeMS};e.emit("query-applied",t)}this.setState({valid:!0,queryState:"apply",lastExecutedQuery:this._cloneQuery()})}},reset(){if(!(0,l.isEqual)(this._cloneQuery(),this._getDefaultQuery()))if((0,l.isEqual)(this.state.lastExecutedQuery,this._getDefaultQuery()))this.setQuery();else if(this.state.valid){const e=this.getInitialState();e.ns=this.state.ns,e.isTimeSeries=this.state.isTimeSeries,e.isReadonly=this.state.isReadonly,e.autoPopulated=!0,this.setState((0,l.omit)(e,"expanded"))}},storeDidUpdate(e){pe("query store changed",ne()(e,this.state))}});if(e.localAppRegistry){const n=e.localAppRegistry;t.localAppRegistry=n,n.on("auto-populate-query",(e=>{t.autoPopulateQuery(e)})),n.on("fields-changed",(e=>{t.setState({schemaFields:e.aceFields})})),n.on("subtab-changed",(()=>{e.actions.refreshEditor()})),n.on("compass:schema:geo-query",(e=>{t.handleGeoQueryFromSchema(e)})),n.on("compass:query-history:run-query",(e=>{t.setQuery(e,!0)})),n.getStore(me).onQueryBarStoreChanged||(e.store=t,n.registerStore(me,_e(e)))}return e.globalAppRegistry&&(t.globalAppRegistry=e.globalAppRegistry),e.namespace&&t.onCollectionChanged(e.namespace,e.isTimeSeries,e.isReadonly),e.serverVersion&&t.onServerVersionChanged(e.serverVersion),e.query&&t.setQuery(e.query,!0),t},ge=JSON.parse('{"name":"@mongodb-js/compass-query-bar","productName":"Query Bar plugin","version":"8.2.0","description":"Renders a component for executing MongoDB queries through a GUI.","homepage":"https://github.com/mongodb-js/compass","license":"SSPL","author":{"name":"MongoDB Inc","email":"compass@mongodb.com"},"bugs":{"url":"https://jira.mongodb.org/projects/COMPASS/issues","email":"compass@mongodb.com"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/mongodb-js/compass.git"},"files":["dist"],"main":"dist/index.js","compass:main":"src/index.ts","exports":{"browser":"./dist/browser.js","require":"./dist/index.js"},"compass:exports":{".":"./src/index.ts"},"scripts":{"prepublishOnly":"npm run compile && compass-scripts check-exports-exist","compile":"npm run webpack -- --mode production","prewebpack":"rimraf ./dist","webpack":"webpack-compass","analyze":"npm run webpack -- --mode production --analyze","typecheck":"tsc -p tsconfig-lint.json --noEmit","eslint":"eslint","prettier":"prettier","lint":"npm run eslint . && npm run prettier -- --check .","depcheck":"compass-scripts check-peer-deps && depcheck","check":"npm run typecheck && npm run lint && npm run depcheck","check-ci":"npm run check","test":"mocha","test-electron":"xvfb-maybe electron-mocha --no-sandbox","test-cov":"nyc -x \\"**/*.spec.*\\" --reporter=lcov --reporter=text --reporter=html npm run test","test-watch":"npm run test -- --watch","test-ci":"npm run test-cov","test-ci-electron":"npm run test-electron","reformat":"npm run prettier -- --write ."},"peerDependencies":{"@mongodb-js/compass-components":"^1.2.0","@mongodb-js/compass-logging":"^1.1.0","hadron-react-components":"^6.2.0","mongodb-ace-autocompleter":"^1.1.1","react":"^16.14.0"},"devDependencies":{"@mongodb-js/eslint-config-compass":"^1.0.1","@mongodb-js/mocha-config-compass":"^1.0.1","@mongodb-js/prettier-config-compass":"^1.0.0","@mongodb-js/tsconfig-compass":"^1.0.1","@mongodb-js/webpack-config-compass":"^1.0.2","@testing-library/react":"^12.1.4","@testing-library/user-event":"^13.5.0","ace-builds":"^1.4.3","chai":"^4.2.0","debug":"^4.2.0","depcheck":"^1.4.1","electron":"^15.5.7","enzyme":"^3.11.0","eslint":"^7.25.0","hadron-app-registry":"^9.0.1","lodash":"^4.17.15","mocha":"^7.0.1","mongodb-query-parser":"^2.4.6","mongodb-query-util":"^0.2.1","ms":"^2.1.2","nyc":"^15.1.0","object-diff":"0.0.4","prop-types":"^15.7.2","react-dom":"^16.14.0","reflux":"^0.4.1","reflux-state-mixin":"github:mongodb-js/reflux-state-mixin","rimraf":"^3.0.1","sinon":"^9.2.3","xvfb-maybe":"^0.2.1"},"dependencies":{"@mongodb-js/compass-components":"^1.2.0","@mongodb-js/compass-logging":"^1.1.0","hadron-react-components":"^6.2.0","mongodb-ace-autocompleter":"^1.1.1","react":"^16.14.0"},"gitHead":"775735842ab7675c6267fb09c22e61fc9b97cd6d"}'),ve={name:"Query Bar",component:B,configureStore:ye,configureActions:G,storeName:"Query.Store",actionName:"Query.Actions"};function Me(e){e.registerRole("Query.QueryBar",ve)}function Le(e){e.deregisterRole("Query.QueryBar",ve)}const be=B},3650:(e,t,n)=>{"use strict";var r=n(769),i=n(2489),a=Buffer.from&&Buffer.from!==Uint8Array.from;function s(e,t){return"string"==typeof e?t==e:e&&"function"==typeof e.exec?e.exec(t):"boolean"==typeof e||"object"==typeof e?e:"function"==typeof e&&e(t)}t.parse=function(e,t){var n,o,u=new r,c=i((function(e){"string"==typeof e&&(e=a?Buffer.from(e):new Buffer(e)),u.write(e)}),(function(e){e&&c.write(e),n&&c.emit("header",n),o&&c.emit("footer",o),c.queue(null)}));return"string"==typeof e&&(e=e.split(".").map((function(e){return"$*"===e?{emitKey:!0}:"*"===e||(""===e?{recurse:!0}:e)}))),e&&e.length||(e=null),u.onValue=function(r){if(this.root||(c.root=r),e){for(var i=0,a=0,o=!1,u=!1;i<e.length;){var d,h=e[i];if(a++,h&&!h.recurse){if(!(d=a===this.stack.length?this:this.stack[a]))return;if(!s(h,d.key))return void l(d.key,r);o=!!h.emitKey,u=!!h.emitPath,i++}else{i++;var _=e[i];if(!_)return;for(;;){if(!(d=a===this.stack.length?this:this.stack[a]))return;if(s(_,d.key)){i++,Object.isFrozen(this.stack[a])||(this.stack[a].value=null);break}l(d.key,r),a++}}}if(n&&(c.emit("header",n),n=!1),a===this.stack.length){var f=this.stack.slice(1).map((function(e){return e.key})).concat([this.key]),p=r;for(var m in null!=p&&null!=(p=t?t(p,f):p)&&((o||u)&&(p={value:p},o&&(p.key=this.key),u&&(p.path=f)),c.queue(p)),this.value&&delete this.value[this.key],this.stack)Object.isFrozen(this.stack[m])||(this.stack[m].value=null)}}},u._onToken=u.onToken,u.onToken=function(t,n){u._onToken(t,n),0===this.stack.length&&c.root&&(e||c.queue(c.root),c.root=null)},u.onError=function(e){e.message.indexOf("at position")>-1&&(e.message="Invalid JSON ("+e.message+")"),c.emit("error",e)},c;function l(e,t){!1!==n&&((n=n||{})[e]=t),!1!==o&&!1===n&&((o=o||{})[e]=t)}},t.stringify=function(e,t,n,r){r=r||0,!1===e?(e="",t="\n",n=""):null==e&&(e="[\n",t="\n,\n",n="\n]\n");var a,s=!0,o=!1;return a=i((function(n){o=!0;try{var i=JSON.stringify(n,null,r)}catch(e){return a.emit("error",e)}s?(s=!1,a.queue(e+i)):a.queue(t+i)}),(function(t){o||a.queue(e),a.queue(n),a.queue(null)}))},t.stringifyObject=function(e,t,n,r){r=r||0,!1===e?(e="",t="\n",n=""):null==e&&(e="{\n",t="\n,\n",n="\n}\n");var a=!0,s=!1;return i((function(n){s=!0;var i=JSON.stringify(n[0])+":"+JSON.stringify(n[1],null,r);a?(a=!1,this.queue(e+i)):this.queue(t+i)}),(function(t){s||this.queue(e),this.queue(n),this.queue(null)}))}},5130:(e,t,n)=>{t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const n="color: "+this.color;t.splice(1,0,n,"color: inherit");let r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=n(7123)(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},7123:(e,t,n)=>{e.exports=function(e){function t(e){let n,i=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),s=i-(n||i);r.diff=s,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";o++;const a=t.formatters[i];if("function"==typeof a){const t=e[o];n=a.call(r,t),e.splice(o,1),o--}return n})),t.formatArgs.call(r,e),(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null===i?t.enabled(e):i,set:e=>{i=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,n){const r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let n;t.save(e),t.names=[],t.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=n(1378),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((n=>{t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let n=0;for(let t=0;t<e.length;t++)n=(n<<5)-n+e.charCodeAt(t),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}},445:(e,t,n)=>{"undefined"==typeof process||"renderer"===process.type||!0===process.browser||process.__nwjs?e.exports=n(5130):e.exports=n(8414)},8414:(e,t,n)=>{const r=n(6224),i=n(3837);t.init=function(e){e.inspectOpts={};const n=Object.keys(t.inspectOpts);for(let r=0;r<n.length;r++)e.inspectOpts[n[r]]=t.inspectOpts[n[r]]},t.log=function(...e){return process.stderr.write(i.format(...e)+"\n")},t.formatArgs=function(n){const{namespace:r,useColors:i}=this;if(i){const t=this.color,i="[3"+(t<8?t:"8;5;"+t),a=` ${i};1m${r} [0m`;n[0]=a+n[0].split("\n").join("\n"+a),n.push(i+"m+"+e.exports.humanize(this.diff)+"[0m")}else n[0]=(t.inspectOpts.hideDate?"":(new Date).toISOString()+" ")+r+" "+n[0]},t.save=function(e){e?process.env.DEBUG=e:delete process.env.DEBUG},t.load=function(){return process.env.DEBUG},t.useColors=function(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):r.isatty(process.stderr.fd)},t.destroy=i.deprecate((()=>{}),"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{const e=n(7013);e&&(e.stderr||e).level>=2&&(t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch(e){}t.inspectOpts=Object.keys(process.env).filter((e=>/^debug_/i.test(e))).reduce(((e,t)=>{const n=t.substring(6).toLowerCase().replace(/_([a-z])/g,((e,t)=>t.toUpperCase()));let r=process.env[t];return r=!!/^(yes|on|true|enabled)$/i.test(r)||!/^(no|off|false|disabled)$/i.test(r)&&("null"===r?null:Number(r)),e[n]=r,e}),{}),e.exports=n(7123)(t);const{formatters:a}=e.exports;a.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split("\n").map((e=>e.trim())).join(" ")},a.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}},55:(e,t,n)=>{var r=n(2781),i=["write","end","destroy"],a=["resume","pause"],s=["data","close"],o=Array.prototype.slice;function u(e,t){if(e.forEach)return e.forEach(t);for(var n=0;n<e.length;n++)t(e[n],n)}e.exports=function(e,t){var n=new r,c=!1;return u(i,(function(t){n[t]=function(){return e[t].apply(e,arguments)}})),u(a,(function(e){n[e]=function(){n.emit(e);var r=t[e];if(r)return r.apply(t,arguments);t.emit(e)}})),u(s,(function(e){t.on(e,(function(){var t=o.call(arguments);t.unshift(e),n.emit.apply(n,t)}))})),t.on("end",(function(){if(!c){c=!0;var e=o.call(arguments);e.unshift("end"),n.emit.apply(n,e)}})),e.on("drain",(function(){n.emit("drain")})),e.on("error",l),t.on("error",l),n.writable=e.writable,n.readable=t.readable,n;function l(e){n.emit("error",e)}}},1829:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>lt});var r={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},i="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",a={5:i,"5module":i+" export import",6:i+" const class extends export import super"},s=/^in(stanceof)?$/,o="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",u="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",c=new RegExp("["+o+"]"),l=new RegExp("["+o+u+"]");o=u=null;var d=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],h=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function _(e,t){for(var n=65536,r=0;r<t.length;r+=2){if((n+=t[r])>e)return!1;if((n+=t[r+1])>=e)return!0}}function f(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&c.test(String.fromCharCode(e)):!1!==t&&_(e,d)))}function p(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&l.test(String.fromCharCode(e)):!1!==t&&(_(e,d)||_(e,h)))))}var m=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function y(e,t){return new m(e,{beforeExpr:!0,binop:t})}var g={beforeExpr:!0},v={startsExpr:!0},M={};function L(e,t){return void 0===t&&(t={}),t.keyword=e,M[e]=new m(e,t)}var b={num:new m("num",v),regexp:new m("regexp",v),string:new m("string",v),name:new m("name",v),privateId:new m("privateId",v),eof:new m("eof"),bracketL:new m("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new m("]"),braceL:new m("{",{beforeExpr:!0,startsExpr:!0}),braceR:new m("}"),parenL:new m("(",{beforeExpr:!0,startsExpr:!0}),parenR:new m(")"),comma:new m(",",g),semi:new m(";",g),colon:new m(":",g),dot:new m("."),question:new m("?",g),questionDot:new m("?."),arrow:new m("=>",g),template:new m("template"),invalidTemplate:new m("invalidTemplate"),ellipsis:new m("...",g),backQuote:new m("`",v),dollarBraceL:new m("${",{beforeExpr:!0,startsExpr:!0}),eq:new m("=",{beforeExpr:!0,isAssign:!0}),assign:new m("_=",{beforeExpr:!0,isAssign:!0}),incDec:new m("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new m("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:y("||",1),logicalAND:y("&&",2),bitwiseOR:y("|",3),bitwiseXOR:y("^",4),bitwiseAND:y("&",5),equality:y("==/!=/===/!==",6),relational:y("</>/<=/>=",7),bitShift:y("<</>>/>>>",8),plusMin:new m("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:y("%",10),star:y("*",10),slash:y("/",10),starstar:new m("**",{beforeExpr:!0}),coalesce:y("??",1),_break:L("break"),_case:L("case",g),_catch:L("catch"),_continue:L("continue"),_debugger:L("debugger"),_default:L("default",g),_do:L("do",{isLoop:!0,beforeExpr:!0}),_else:L("else",g),_finally:L("finally"),_for:L("for",{isLoop:!0}),_function:L("function",v),_if:L("if"),_return:L("return",g),_switch:L("switch"),_throw:L("throw",g),_try:L("try"),_var:L("var"),_const:L("const"),_while:L("while",{isLoop:!0}),_with:L("with"),_new:L("new",{beforeExpr:!0,startsExpr:!0}),_this:L("this",v),_super:L("super",v),_class:L("class",v),_extends:L("extends",g),_export:L("export"),_import:L("import",v),_null:L("null",v),_true:L("true",v),_false:L("false",v),_in:L("in",{beforeExpr:!0,binop:7}),_instanceof:L("instanceof",{beforeExpr:!0,binop:7}),_typeof:L("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:L("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:L("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},k=/\r\n?|\n|\u2028|\u2029/,Y=new RegExp(k.source,"g");function w(e){return 10===e||13===e||8232===e||8233===e}var S=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,x=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,D=Object.prototype,T=D.hasOwnProperty,j=D.toString;function A(e,t){return T.call(e,t)}var E=Array.isArray||function(e){return"[object Array]"===j.call(e)};function O(e){return new RegExp("^(?:"+e.replace(/ /g,"|")+")$")}var H=function(e,t){this.line=e,this.column=t};H.prototype.offset=function(e){return new H(this.line,this.column+e)};var C=function(e,t,n){this.start=t,this.end=n,null!==e.sourceFile&&(this.source=e.sourceFile)};function P(e,t){for(var n=1,r=0;;){Y.lastIndex=r;var i=Y.exec(e);if(!(i&&i.index<t))return new H(n,t-r);++n,r=i.index+i[0].length}}var I={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},F=!1;function N(e,t){return 2|(e?4:0)|(t?8:0)}var R=function(e,t,n){this.options=e=function(e){var t={};for(var n in I)t[n]=e&&A(e,n)?e[n]:I[n];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!F&&"object"==typeof console&&console.warn&&(F=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),null==t.allowReserved&&(t.allowReserved=t.ecmaVersion<5),E(t.onToken)){var r=t.onToken;t.onToken=function(e){return r.push(e)}}return E(t.onComment)&&(t.onComment=function(e,t){return function(n,r,i,a,s,o){var u={type:n?"Block":"Line",value:r,start:i,end:a};e.locations&&(u.loc=new C(this,s,o)),e.ranges&&(u.range=[i,a]),t.push(u)}}(t,t.onComment)),t}(e),this.sourceFile=e.sourceFile,this.keywords=O(a[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var i="";!0!==e.allowReserved&&(i=r[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(i+=" await")),this.reservedWords=O(i);var s=(i?i+" ":"")+r.strict;this.reservedWordsStrict=O(s),this.reservedWordsStrictBind=O(s+" "+r.strictBind),this.input=String(t),this.containsEsc=!1,n?(this.pos=n,this.lineStart=this.input.lastIndexOf("\n",n-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(k).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=b.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]},W={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}};R.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},W.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},W.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},W.inAsync.get=function(){return(4&this.currentVarScope().flags)>0&&!this.currentVarScope().inClassFieldInit},W.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||256&t.flags)return!1;if(2&t.flags)return(4&t.flags)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},W.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(64&t)>0||n||this.options.allowSuperOutsideMethod},W.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},W.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},W.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,n=e.inClassFieldInit;return(258&t)>0||n},W.inClassStaticBlock.get=function(){return(256&this.currentVarScope().flags)>0},R.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var n=this,r=0;r<e.length;r++)n=e[r](n);return n},R.parse=function(e,t){return new this(t,e).parse()},R.parseExpressionAt=function(e,t,n){var r=new this(n,e,t);return r.nextToken(),r.parseExpression()},R.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(R.prototype,W);var $=R.prototype,z=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;function V(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}$.strictDirective=function(e){for(;;){x.lastIndex=e,e+=x.exec(this.input)[0].length;var t=z.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){x.lastIndex=e+t[0].length;var n=x.exec(this.input),r=n.index+n[0].length,i=this.input.charAt(r);return";"===i||"}"===i||k.test(n[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(r+1))}e+=t[0].length,x.lastIndex=e,e+=x.exec(this.input)[0].length,";"===this.input[e]&&e++}},$.eat=function(e){return this.type===e&&(this.next(),!0)},$.isContextual=function(e){return this.type===b.name&&this.value===e&&!this.containsEsc},$.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},$.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},$.canInsertSemicolon=function(){return this.type===b.eof||this.type===b.braceR||k.test(this.input.slice(this.lastTokEnd,this.start))},$.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},$.semicolon=function(){this.eat(b.semi)||this.insertSemicolon()||this.unexpected()},$.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},$.expect=function(e){this.eat(e)||this.unexpected()},$.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")},$.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var n=t?e.parenthesizedAssign:e.parenthesizedBind;n>-1&&this.raiseRecoverable(n,"Parenthesized pattern")}},$.checkExpressionErrors=function(e,t){if(!e)return!1;var n=e.shorthandAssign,r=e.doubleProto;if(!t)return n>=0||r>=0;n>=0&&this.raise(n,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")},$.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},$.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var B=R.prototype;B.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==b.eof;){var n=this.parseStatement(null,!0,t);e.body.push(n)}if(this.inModule)for(var r=0,i=Object.keys(this.undefinedExports);r<i.length;r+=1){var a=i[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var U={kind:"loop"},q={kind:"switch"};B.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;x.lastIndex=this.pos;var t=x.exec(this.input),n=this.pos+t[0].length,r=this.input.charCodeAt(n);if(91===r||92===r||r>55295&&r<56320)return!0;if(e)return!1;if(123===r)return!0;if(f(r,!0)){for(var i=n+1;p(r=this.input.charCodeAt(i),!0);)++i;if(92===r||r>55295&&r<56320)return!0;var a=this.input.slice(n,i);if(!s.test(a))return!0}return!1},B.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;x.las