performance.mark("js-parse-end:32984-7e4a34de6ac25b16.js"); "use strict";(globalThis.webpackChunk_github_ui_github_ui=globalThis.webpackChunk_github_ui_github_ui||[]).push([["32984"],{45540(e,t,i){i.d(t,{N:()=>u});var s=i(4069),r=i(91385),a=i(12907),l=i(17243),o=i(47903),n=i(16518),d=i(14705);class u{cachedFilterCount=0;cachedFiltersUsed=[];cachedNestedGroupCount=0;config;isValidated=!1;#e;#t;#i={};#s={};#r=[];#a=[];#l;constructor(e="",t=[],i,s,r,l=!1){this.#t=t,this.#l=e,this.#e=s,this.isValidated=l,r&&(this.#i=r.staticContext,this.cachedFilterCount=r.cachedFilterCount??0,this.cachedFiltersUsed=r.cachedFiltersUsed??[],this.cachedNestedGroupCount=r.cachedNestedGroupCount??0),this.config=i??a.a7,this.#o(t)}get activeBlock(){return this.#e}get activeBlockId(){return this.#e?.id??-1}get blocks(){return this.#t}clearActiveBlock(){this.#e=void 0}get context(){let e={...this.#i??{},...this.#s??{}};if(!this.#i?.repo){let t=this.#t.filter(e=>(0,d.aK)(e)&&"repo"===e.provider.key).map(e=>e.value.values.map(e=>!1!==e.valid?(0,d.M5)(e.value)??"":"")).flat();if(t.length>0&&(e.repo=t.join(",")),!this.#i?.org){let t=this.#t.filter(e=>(0,d.aK)(e)&&"org"===e.provider.key).map(e=>e.value.values.map(e=>!1!==e.valid?(0,d.M5)(e.value)??"":"")).flat();t.length>0&&(e.org=t.join(","))}}return e}get contextURLParams(){return new URLSearchParams(this.context)}get errors(){return this.#r?Array.from(this.#r):[]}getErrors(e=!1){return e?[...this.#r,...this.#a]:this.#r}get filterCount(){if(!this.isValidated||!(0,d.Ed)(this))return this.cachedFilterCount;let e=this.blocks.filter(e=>(0,d.aK)(e)&&e.value.values.some(e=>e.valid)).length;return this.cachedFilterCount=e,e}get filtersUsed(){if(!(0,d.Ed)(this))return this.cachedFiltersUsed;let e=(0,d.wR)(this.blocks).filter(e=>(0,d.aK)(e)).map(e=>e.provider?.key);return this.cachedFiltersUsed=e,e}get instanceContext(){return{cachedFilterCount:this.cachedFilterCount,cachedFiltersUsed:this.cachedFiltersUsed,cachedNestedGroupCount:this.cachedNestedGroupCount,staticContext:this.#i}}get nestedGroupCount(){if(!(0,d.Ed)(this))return this.cachedNestedGroupCount;let e=(0,d.wR)(this.blocks).filter(e=>(0,d.W9)(e)).reduce((e,t)=>Math.max(e,t.groupDepth||0),0);return this.cachedNestedGroupCount=e,e}get raw(){return this.#l}get staticContext(){return this.#i}set staticContext(e){this.#i=e}set additionalParams(e){this.#s=e}addQueryParam(e,t){this.#s||(this.#s={}),this.#s[e]=t}async getSuggestions(e,t,i){let a=this.activeBlock,u=[];if(!a&&""===this.raw||a?.type===n._B.Space||a?.type===n._B.UnmatchedOpenParen||a?.type===n._B.Group&&(a?.raw.endsWith("(")||a?.raw==="()")){u=[{id:"providers-suggestion-group",suggestions:Object.values(t).filter(e=>this.#n(e)&&e.options.support.status===n.b9.Supported).filter(e=>e.priority<=l.$D).sort((e,t)=>e.priority-t.priority).map(e=>({type:n.ak.Key,displayName:e.displayName,ariaLabel:`${e.displayName}, Filter${e.description?`, ${e.description}`:""}`,priority:e.priority,icon:e.icon,value:e.key}))}];let e=[];i.groupAndKeywordSupport&&(e.push((0,d.PU)()),e.push((0,d.j1)()));let s=e=>!0===e.options.filterTypes.exclusive&&this.#n(e);Object.values(t).filter(s).length>0&&e.push((0,d.m1)()),u.push({id:"utility-suggestion-group",suggestions:e})}else if(a?.type===n._B.Text&&"-"===a.raw){let e=Object.values(t).filter(e=>e.options.filterTypes.exclusive&&this.#n(e)&&e.options.support.status===n.b9.Supported).filter(e=>e.priority<=l.$D).sort((e,t)=>e.priority-t.priority).map(e=>({type:n.ak.Key,displayName:e.displayName,ariaLabel:`${e.displayName}, Filter${e.description?`, ${e.description}`:""}`,priority:e.priority,icon:e.icon,value:`-${e.key}`}));u=[{id:"exclude-providers",title:o.D.exclude,suggestions:e}]}else if(a?.type===n._B.Text){let r=[],l=(0,d.ON)(a)?a:null,o=l&&e-l.startIndex<=l.raw.indexOf(i.filterDelimiter)?l.raw.substring(0,e-l.startIndex):a.raw;Object.values(t).map(e=>{if(((0,d.kZ)(e,o,!0)||e.displayName&&e.displayName.startsWith(o))&&this.#n(e)&&e.options.support.status===n.b9.Supported){let t=e.key;t===o&&t.endsWith(".")||(a.raw.startsWith("-")&&e.options.filterTypes.exclusive&&(t=`-${e.key}`),r.push({type:n.ak.Key,displayName:e.displayName,ariaLabel:`${e.displayName}, Filter${e.description?`, ${e.description}`:""}`,priority:e.priority-(0,s.dt)(o,e.key),icon:e.icon,value:t}))}}),r.sort((e,t)=>e.priority-t.priority),u=[{id:"providers-suggestion-group",suggestions:r}];let c=[];i.groupAndKeywordSupport&&("and".startsWith(o.toLocaleLowerCase())&&c.push((0,d.PU)()),"or".startsWith(o.toLocaleLowerCase())&&c.push((0,d.j1)())),u.push({id:"utility-suggestion-group",suggestions:c})}else if((0,d.aK)(a)){let l=[],o=(0,d.Xz)(a.key.value);if((0,d.v7)(a)){let[c,h]=(0,d.t4)(a,e);if("key"===c){let e=[];Object.values(t).map(t=>{((0,r.qA)(h.value,t.key)||t.options.filterTypes.exclusive&&(0,r.qA)(h.value,`-${t.key}`))&&this.#n(t)&&e.push({type:n.ak.Key,displayName:t.displayName,ariaLabel:`${t.displayName}, Filter${t.description?`, ${t.description}`:""}`,priority:t.priority-(0,s.dt)(h.value,t.key),icon:t.icon,value:t.key})}),e.sort((e,t)=>e.priority-t.priority),u=[{id:"providers-suggestion-group",suggestions:e}]}else if("value"===c){let s=Object.values(t).find(e=>(0,d.kZ)(e,o)),r=await s?.getSuggestions(this,a,i,e);l=r?.filter(e=>0>a.value.values.findIndex(t=>(0,d.M5)(t.value)===e.value&&!t.hasCaret)).sort((e,t)=>e.priority-t.priority)??[]}}u=[{id:"values-suggestion-group",suggestions:l}]}return u}#n(e){return e.options.filterTypes?.multiKey!==!1||this.blocks.filter(t=>(0,d.aK)(t)&&t.key.value===e.key).length<1}#o(e){let t=new Set,i=new Set,s=e=>{for(let r of e)if((0,d.W9)(r)){if(!r.valid)for(let e of r.validations??[])e.message&&t.add(e.message);s(r.blocks)}else if((0,d.aK)(r)&&!1===r.valid&&this.activeBlockId!==r.id){if(r.validationMessage&&t.add(r.validationMessage??""),!r.key.valid)for(let e of r.key.validations??[])e.message&&t.add(e.message);for(let e of r.value.values)if(!1===e.valid)if(e.validations)for(let i of e.validations??[])i.message&&t.add(i.message);else t.add(o.D.filterInvalidValue(r.key.value,(0,d.q5)((0,d.I8)(e.value))??""))}else if(((0,d.oE)(r)||(0,d.iy)(r))&&r.validations)i.add(o.D.unbalancedParentheses);else if((0,d.ON)(r))for(let e of r.validations??[])e.message&&i.add(e.message)};(this.#l.match(/"/g)??[]).length%2!=0&&i.add(o.D.unbalancedQuotations),s(e),this.#r=Array.from(t),this.#a=Array.from(i)}}},97707(e,t,i){i.d(t,{i:()=>p});var s=i(46632),r=i(12907),a=i(17243),l=i(47903),o=i(45540),n=i(16518),d=i(14705);let u=(0,s.A)((e,t)=>RegExp(`([\\s${e}"]*?)((?:>|<|>=|<=)*[\\w\\d\\-_"'?/\\.=+!@#$%^&*`+(t?");:\\p{Extended_Pictographic}]*)$":"();:\\p{Extended_Pictographic}]*)$"),"gu")),c=(0,s.A)((e,t)=>RegExp(`[\\s${e}${t?")":""}](?=(?:[^"]*"[^"]*")*[^"]*$)`,"g")),h=(0,s.A)(e=>RegExp(`${e}(?=(?:[^"]*"[^"]*")*[^"]*$)`,"g"));class p{filterProviders=[];config;#d={};#u;NEXT_DELIMITER_REGEX;ITEMS_REGEX;LAST_DELIMITER_REGEX;constructor(e=[],t){this.filterProviders=e,this.config=t??r.a7,this.#u=new Set,this.NEXT_DELIMITER_REGEX=c(this.config.valueDelimiter,this.config.groupAndKeywordSupport??!1),this.ITEMS_REGEX=h(this.config.valueDelimiter),this.LAST_DELIMITER_REGEX=u(this.config.valueDelimiter,this.config.groupAndKeywordSupport??!1)}parse(e,t=new o.N("",[],this.config),i=-1){let s,r=function(e,t,i=-1){let{matchedParens:s,unmatchedOpenParens:r,unmatchedCloseParens:o}=function(e){let t=[],i=[],s=!1,r=new Set,a=new Set;for(let r=0;r0){let e=t.pop();void 0!==e&&i.push([e,r])}else")"!==e[r]||s||a.add(r);else t.push(r);let l=new Map;for(let[e,t]of i)l.set(e,t);for(let e of t)r.add(e);return{matchedParens:l,unmatchedOpenParens:r,unmatchedCloseParens:a}}(e),u=0,c=0,h=0;return function p(g=e.length){let v=[],f=e.substring(0,g);for(;ua.mn;v.push({id:c,type:n._B.Group,raw:e.substring(t,r+1),blocks:p(r),groupDepth:h,startIndex:t,endIndex:r,hasCaret:(0,d.dV)(i,t,r),valid:!o,validations:o?[{type:n.b.MaxNestedGroups,message:l.D.maxNestedGroups}]:[]}),h-=1,u=r+1}else if(t&&"("===f[u])v.push({id:c,type:n._B.UnmatchedOpenParen,raw:"(",startIndex:u,endIndex:u+1,hasCaret:(0,d.dV)(i,u+1,u+1),valid:!1,validations:[{type:n.b.UnbalancedParentheses,message:l.D.unbalancedParentheses}]}),c+=1,u+=1;else if(t&&")"===f[u])v.push({id:c,type:n._B.UnmatchedCloseParen,raw:")",startIndex:u,endIndex:u+1,hasCaret:(0,d.dV)(i,u+1,u+1),valid:!1,validations:[{type:n.b.UnbalancedParentheses,message:l.D.unbalancedParentheses}]}),c+=1,u+=1;else if(f[u]?.search(/\s/)===0){let e=f[u]??"";for(let t=u+1;t-1&&(e=s>-1&&f[s]?.match(/\s/)?s+1:s);let a=f.substring(u,e).trimEnd();v.push({id:c,type:n._B.Text,raw:a,startIndex:u,endIndex:u+a.length,hasCaret:(0,d.dV)(i,u,u+a.length),valid:0===r.size&&0===o.size,validations:[]}),c+=1,u+=a.length}return v}()}(e,this.config.groupAndKeywordSupport??!1,i),u=e=>{for(let[t,r]of e.entries())if(r.type!==n._B.Space&&r.type!==n._B.UnmatchedOpenParen&&r.type!==n._B.UnmatchedCloseParen)if(this.config.groupAndKeywordSupport&&(0,d.W9)(r))r.blocks=u(r.blocks),!r.blocks.length&&r.hasCaret&&(s=r);else{let l=r;if(this.config.groupAndKeywordSupport&&a.d6.includes(l.raw))l.type=n._B.Keyword;else{let s=l.raw,r=s.indexOf(this.config.filterDelimiter),a=s.substring(0,r),o=this.filterProviders.find(e=>(0,d.kZ)(e,a));o&&(l=this.processFilterBlock(l,o,r,i),e[t]=l)}l.hasCaret&&(s=l)}else r.type===n._B.Space&&r.hasCaret||r.type===n._B.UnmatchedOpenParen&&r.hasCaret?s=r:r.type===n._B.UnmatchedCloseParen&&r.hasCaret&&(s=r);return e};return r=u(r),new o.N(e,r,this.config,s,t.instanceContext)}replaceActiveBlockWithPresenceBlock(e,t){let i,s=0,r=e.activeBlock;if(!(r&&(0,d.v7)(r)))return[e.raw,e.raw.length];{let a=e.raw.substring(0,r.startIndex),l=e.raw.substring(r.endIndex);return s=(i=`${a}${t}${this.config.filterDelimiter}${r.key.value}`).length,[i+=l&&l[0]?.search(/\s/)!==0?` ${l}`:l,s]}}insertSuggestion(e,t,i){let s,r=0,a=e.activeBlock;if(a&&(0,d.v7)(a)){let l=e.raw.substring(0,a.startIndex),o=e.raw.substring(a.endIndex),n=[],u=a.key.value;if(t.startsWith("-"))u=t,r=(s=`${l}${u}${this.config.filterDelimiter}`).length;else{for(let e of a.value.values)(0,d.dV)(i,e.startIndex,e.endIndex)?(r=e.startIndex+t.length,n.push(t)):n.push((0,d.I8)(e.value)??"");s=`${l}${u}${this.config.filterDelimiter}${n.join(this.config.valueDelimiter)}`}s+=o}else if(a&&(0,d.ON)(a)&&i-a.startIndex<=a.raw.indexOf(this.config.filterDelimiter)){let i=e.raw.substring(0,a.startIndex),l=e.raw.substring(a.endIndex),o=a.raw.indexOf(this.config.filterDelimiter),n=a.raw.substring(o+1);s=`${i}${t}${n}${l}`,r=i.length+t.length}else if(i>=0){let a=e.raw.substring(0,i),l=e.raw.substring(i);this.NEXT_DELIMITER_REGEX.lastIndex=0;let o=this.NEXT_DELIMITER_REGEX.exec(l);l=o?l.substring(o.index):"",s=(a=a.replace(this.LAST_DELIMITER_REGEX,"$1")+t)+l,r=a.length}else r=(s=e.raw+t).length;return[s,r]}getRaw(e){let t="";for(let i of e.blocks)(0,d.aK)(i)?(t+=i.key.value,t+=i.value.raw?`${e.config.filterDelimiter}${i.value.raw}`:""):t+=i.raw;return t}validateFilterProvider(e,t=!1){return e.options.support.status===n.b9.Unsupported?[!1,{type:n.b.FilterProviderUnsupported,message:e.options.support.message??l.D.filterProviderNotSupported(e.key)}]:e.options.support.status===n.b9.Deprecated?[!1,{type:n.b.FilterProviderDeprecated,message:e.options.support.message??l.D.filterProviderDeprecated(e.key)}]:!t&&a.jb.includes(e.key)?[!1,{type:n.b.FilterProviderTopLevel,message:l.D.filterProviderTopLevel(e.key)}]:[!0,void 0]}processFilterBlock(e,t,i,s){let r=e.startIndex,a=e.raw.substring(0,i),l=e.raw.substring(i+1),o=(0,d.zB)(t,a,l)??n.tl.Is,u=r+i+1,c=l.split(this.ITEMS_REGEX);if(o===n.tl.Between){let e=[];c.map(t=>{let i=t.split("..").filter(e=>e);i.length<2&&(t.startsWith("..")?i=["",...i]:i.push("")),e=[...e,...i]}),c=e}let h=c.map(e=>{let i={startIndex:u,endIndex:u+e.length,hasCaret:(0,d.dV)(s,u,u+e.length),value:e,valid:!!this.#u.has(`${a}${this.config.filterDelimiter}${(0,d.I8)(e)}`)||void 0};t.filterValues&&void 0===i.valid&&t.filterValues?.find(t=>!!((0,d.I8)(t.value)===e||t.aliases?.includes(e))&&(i.valid=!0,!0));let r=o===n.tl.Between?2:1;return u=u+e.length+r,i});return{...e,type:n._B.Filter,provider:t,operator:o,valid:!!this.#u.has(e.raw)||void 0,key:{startIndex:r,endIndex:r+i,hasCaret:(0,d.dV)(s,r,r+i),value:a},value:{startIndex:r+i+1,endIndex:r+e.raw.length,hasCaret:(0,d.dV)(s,r+i+1,r+e.raw.length),values:h,raw:l}}}async validateQueryBlock(e,t,i=!1){if((0,d.v7)(e)){let[s,r]=this.validateFilterProvider(e.provider,i),a=await e.provider.validateFilterBlockValues?.(t,e,e.value.values,this.config);a.map(t=>{t.valid&&this.#u.add(`${e.provider.key}${this.config.filterDelimiter}${(0,d.I8)(t.value)}`)});let l=a.every(e=>e.valid)&&s;return l&&this.#u.add(e.raw),{...e,valid:l,key:{...e.key,valid:s,validations:r?[r]:void 0},value:{...e.value,values:a}}}return e}async validateGroupBlock(e,t){let i=await Promise.all(e.blocks.map(e=>(0,d.W9)(e)?this.validateGroupBlock(e,t):this.validateQueryBlock(e,t)));return{...e,blocks:i}}async validateFilterQuery(e){let t=[];e.blocks.map(i=>{(0,d.W9)(i)?t.push(this.validateGroupBlock(i,e)):(0,d.h8)(i)&&t.push(this.validateQueryBlock(i,e,!0))});let i=await Promise.all(t);return!this.#d[e.raw]&&(0,d.Ed)(e)&&(this.#d[e.raw]=e),new o.N(e.raw,i,this.config,e.activeBlock,e.instanceContext,!0)}}}}]); //# sourceMappingURL=32984-7e4a34de6ac25b16-5baedc056cc4aae2.js.map