Skip to content

Conversation

@briangann
Copy link
Collaborator

This is an example of using hugo for enhanced documentation.

Run yarn docs-dev to build and edit on the fly, spins up local process for viewing
Run yarn docs-build to build

@github-actions

This comment has been minimized.

@briangann briangann moved this from 📬 Triage to 💡 Ideation in Plugins Platform / Grafana Community Dec 9, 2025
@briangann briangann self-assigned this Dec 9, 2025
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zizmor found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@github-actions
Copy link

github-actions bot commented Dec 9, 2025

😢 zizmor failed with exit code 14.

Expand for full output
error[unpinned-uses]: unpinned action reference
 --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/build_site/action.yaml:7:7
  |
7 |       uses: peaceiris/actions-hugo@v3
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
  |
  = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/check_milestone/action.yaml:19:7
   |
19 |       uses: octokit/[email protected]
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/check_milestone/action.yaml:33:7
   |
33 |       uses: octokit/[email protected]
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/check_milestone/action.yaml:47:7
   |
47 |       uses: ashley-taylor/regex-property-action@master
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/check_milestone/action.yaml:57:7
   |
57 |       uses: ashley-taylor/regex-property-action@master
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/check_milestone/action.yaml:67:7
   |
67 |       uses: ashley-taylor/regex-property-action@master
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/deploy_site/action.yaml:11:7
   |
11 |       uses: peaceiris/actions-gh-pages@v3
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:28:7
   |
28 |       uses: Kaven-Universe/github-action-current-date-time@v1
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:34:7
   |
34 |       uses: ashley-taylor/regex-property-action@master
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:44:7
   |
44 |       uses: ashley-taylor/regex-property-action@master
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:54:7
   |
54 |       uses: ashley-taylor/regex-property-action@master
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:71:7
   |
71 |       uses: WyriHaximus/github-action-next-semvers@v1
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
  --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:78:7
   |
78 |       uses: Akkjon/[email protected]
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
   |
   = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:114:7
    |
114 |       uses: surahmansada/file-regex-replace@v1
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:121:7
    |
121 |       uses: surahmansada/file-regex-replace@v1
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:154:7
    |
154 |       uses: guibranco/github-file-reader-action-v2@latest
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:159:7
    |
159 |       uses: surahmansada/file-regex-replace@v1
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:167:7
    |
167 |       uses: ashley-taylor/regex-property-action@master
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:179:7
    |
179 |       uses: planetscale/[email protected]
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:214:7
    |
214 |       uses: ncipollo/release-action@v1
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

error[unpinned-uses]: unpinned action reference
   --> ./docs-hugo/themes/hugo-theme-relearn/.github/actions/release_milestone/action.yaml:224:7
    |
224 |       uses: WyriHaximus/github-action-create-milestone@v1
    |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ action is not pinned to a hash (required by blanket policy)
    |
    = note: audit confidence → High

129 findings (51 ignored, 57 suppressed): 0 informational, 0 low, 0 medium, 21 high

}
if (children != null) {
forEach(children, function (child) {
el.appendChild(typeof child === 'string' ? document.createTextNode(child) : child);

Check failure

Code scanning / CodeQL

Client-side cross-site scripting High documentation

Cross-site scripting vulnerability due to
user-provided value
.
Cross-site scripting vulnerability due to
user-provided value
.

Copilot Autofix

AI about 1 month ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

@@ -0,0 +1 @@
!function(){"use strict";var t,e,i,o={62:function(t,e,i){var o,s=this&&this.__extends||(o=function(t,e){return o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])},o(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}),n=this&&this.__assign||function(){return n=Object.assign||function(t){for(var e,i=1,o=arguments.length;i<o;i++)for(var s in e=arguments[i])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t},n.apply(this,arguments)},r=this&&this.__read||function(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var o,s,n=i.call(t),r=[];try{for(;(void 0===e||e-- >0)&&!(o=n.next()).done;)r.push(o.value)}catch(t){s={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(s)throw s.error}}return r},a=this&&this.__spreadArray||function(t,e,i){if(i||2===arguments.length)for(var o,s=0,n=e.length;s<n;s++)!o&&s in e||(o||(o=Array.prototype.slice.call(e,0,s)),o[s]=e[s]);return t.concat(o||Array.prototype.slice.call(e))},l=this&&this.__values||function(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],o=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&o>=t.length&&(t=void 0),{value:t&&t[o++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(e,"__esModule",{value:!0}),e.AssistiveMmlHandler=e.AssistiveMmlMathDocumentMixin=e.AssistiveMmlMathItemMixin=e.LimitedMmlVisitor=void 0;var p=i(769),c=i(433),u=i(77),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.getAttributes=function(e){return t.prototype.getAttributes.call(this,e).replace(/ ?id=".*?"/,"")},e}(c.SerializedMmlVisitor);function m(t){return function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.prototype.assistiveMml=function(t,e){if(void 0===e&&(e=!1),!(this.state()>=p.STATE.ASSISTIVEMML)){if(!this.isEscaped&&(t.options.enableAssistiveMml||e)){var i=t.adaptor,o=t.toMML(this.root).replace(/\n */g,"").replace(/<!--.*?-->/g,""),s=i.firstChild(i.body(i.parse(o,"text/html"))),n=i.node("mjx-assistive-mml",{unselectable:"on",display:this.display?"block":"inline"},[s]);i.setAttribute(i.firstChild(this.typesetRoot),"aria-hidden","true"),i.setStyle(this.typesetRoot,"position","relative"),i.append(this.typesetRoot,n)}this.state(p.STATE.ASSISTIVEMML)}},e}(t)}function M(t){var e;return e=function(t){function e(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];var o=t.apply(this,a([],r(e),!1))||this,s=o.constructor,n=s.ProcessBits;return n.has("assistive-mml")||n.allocate("assistive-mml"),o.visitor=new h(o.mmlFactory),o.options.MathItem=m(o.options.MathItem),"addStyles"in o&&o.addStyles(s.assistiveStyles),o}return s(e,t),e.prototype.toMML=function(t){return this.visitor.visitTree(t)},e.prototype.assistiveMml=function(){var t,e;if(!this.processed.isSet("assistive-mml")){try{for(var i=l(this.math),o=i.next();!o.done;o=i.next()){o.value.assistiveMml(this)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.processed.set("assistive-mml")}return this},e.prototype.state=function(e,i){return void 0===i&&(i=!1),t.prototype.state.call(this,e,i),e<p.STATE.ASSISTIVEMML&&this.processed.clear("assistive-mml"),this},e}(t),e.OPTIONS=n(n({},t.OPTIONS),{enableAssistiveMml:!0,renderActions:(0,u.expandable)(n(n({},t.OPTIONS.renderActions),{assistiveMml:[p.STATE.ASSISTIVEMML]}))}),e.assistiveStyles={"mjx-assistive-mml":{position:"absolute !important",top:"0px",left:"0px",clip:"rect(1px, 1px, 1px, 1px)",padding:"1px 0px 0px 0px !important",border:"0px !important",display:"block !important",width:"auto !important",overflow:"hidden !important","-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},'mjx-assistive-mml[display="block"]':{width:"100% !important"}},e}e.LimitedMmlVisitor=h,(0,p.newState)("ASSISTIVEMML",153),e.AssistiveMmlMathItemMixin=m,e.AssistiveMmlMathDocumentMixin=M,e.AssistiveMmlHandler=function(t){return t.documentClass=M(t.documentClass),t}},306:function(t,e){e.q=void 0,e.q="3.2.2"},723:function(t,e){MathJax._.components.global.isObject,MathJax._.components.global.combineConfig,MathJax._.components.global.combineDefaults,e.r8=MathJax._.components.global.combineWithMathJax,MathJax._.components.global.MathJax},769:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.protoItem=MathJax._.core.MathItem.protoItem,e.AbstractMathItem=MathJax._.core.MathItem.AbstractMathItem,e.STATE=MathJax._.core.MathItem.STATE,e.newState=MathJax._.core.MathItem.newState},433:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.DATAMJX=MathJax._.core.MmlTree.SerializedMmlVisitor.DATAMJX,e.toEntity=MathJax._.core.MmlTree.SerializedMmlVisitor.toEntity,e.SerializedMmlVisitor=MathJax._.core.MmlTree.SerializedMmlVisitor.SerializedMmlVisitor},77:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObject=MathJax._.util.Options.isObject,e.APPEND=MathJax._.util.Options.APPEND,e.REMOVE=MathJax._.util.Options.REMOVE,e.OPTIONS=MathJax._.util.Options.OPTIONS,e.Expandable=MathJax._.util.Options.Expandable,e.expandable=MathJax._.util.Options.expandable,e.makeArray=MathJax._.util.Options.makeArray,e.keys=MathJax._.util.Options.keys,e.copy=MathJax._.util.Options.copy,e.insert=MathJax._.util.Options.insert,e.defaultOptions=MathJax._.util.Options.defaultOptions,e.userOptions=MathJax._.util.Options.userOptions,e.selectOptions=MathJax._.util.Options.selectOptions,e.selectOptionsFromKeys=MathJax._.util.Options.selectOptionsFromKeys,e.separateOptions=MathJax._.util.Options.separateOptions,e.lookup=MathJax._.util.Options.lookup}},s={};function n(t){var e=s[t];if(void 0!==e)return e.exports;var i=s[t]={exports:{}};return o[t].call(i.exports,i,i.exports,n),i.exports}t=n(723),e=n(306),i=n(62),MathJax.loader&&MathJax.loader.checkVersion("a11y/assistive-mml",e.q,"a11y"),(0,t.r8)({_:{a11y:{"assistive-mml":i}}}),MathJax.startup&&MathJax.startup.extendHandler((function(t){return(0,i.AssistiveMmlHandler)(t)}))}(); No newline at end of file

Check failure

Code scanning / CodeQL

Incomplete multi-character sanitization High

This string may still contain
<!--
, which may cause an HTML element injection vulnerability.

Copilot Autofix

AI about 1 month ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
const e={arabic:"ar",armenian:"am",bulgarian:"bg",danish:"dk",dutch:"nl",english:"en",finnish:"fi",french:"fr",german:"de",greek:"gr",hungarian:"hu",indian:"in",indonesian:"id",irish:"ie",italian:"it",lithuanian:"lt",nepali:"np",norwegian:"no",portuguese:"pt",romanian:"ro",russian:"ru",serbian:"rs",slovenian:"ru",spanish:"es",swedish:"se",tamil:"ta",turkish:"tr",ukrainian:"uk",sanskrit:"sk"},t={dutch:/[^A-Za-zàèéìòóù0-9_'-]+/gim,english:/[^A-Za-zàèéìòóù0-9_'-]+/gim,french:/[^a-z0-9äâàéèëêïîöôùüûœç-]+/gim,italian:/[^A-Za-zàèéìòóù0-9_'-]+/gim,norwegian:/[^a-z0-9_æøåÆØÅäÄöÖüÜ]+/gim,portuguese:/[^a-z0-9à-úÀ-Ú]/gim,russian:/[^a-z0-9а-яА-ЯёЁ]+/gim,spanish:/[^a-z0-9A-Zá-úÁ-ÚñÑüÜ]+/gim,swedish:/[^a-z0-9_åÅäÄöÖüÜ-]+/gim,german:/[^a-z0-9A-ZäöüÄÖÜß]+/gim,finnish:/[^a-z0-9äöÄÖ]+/gim,danish:/[^a-z0-9æøåÆØÅ]+/gim,hungarian:/[^a-z0-9áéíóöőúüűÁÉÍÓÖŐÚÜŰ]+/gim,romanian:/[^a-z0-9ăâîșțĂÂÎȘȚ]+/gim,serbian:/[^a-z0-9čćžšđČĆŽŠĐ]+/gim,turkish:/[^a-z0-9çÇğĞıİöÖşŞüÜ]+/gim,lithuanian:/[^a-z0-9ąčęėįšųūžĄČĘĖĮŠŲŪŽ]+/gim,arabic:/[^a-z0-9أ-ي]+/gim,nepali:/[^a-z0-9अ-ह]+/gim,irish:/[^a-z0-9áéíóúÁÉÍÓÚ]+/gim,indian:/[^a-z0-9अ-ह]+/gim,armenian:/[^a-z0-9ա-ֆ]+/gim,greek:/[^a-z0-9α-ωά-ώ]+/gim,indonesian:/[^a-z0-9]+/gim,ukrainian:/[^a-z0-9а-яА-ЯіїєІЇЄ]+/gim,slovenian:/[^a-z0-9螚ȎŠ]+/gim,bulgarian:/[^a-z0-9а-яА-Я]+/gim,tamil:/[^a-z0-9அ-ஹ]+/gim,sanskrit:/[^a-z0-9A-Zāīūṛḷṃṁḥśṣṭḍṇṅñḻḹṝ]+/gim},n=Object.keys(e);const r=Date.now().toString().slice(5);let o=0;const s=BigInt(1e3),i=BigInt(1e6),a=BigInt(1e9),c=65535;function l(e,t){if(t.length<c)Array.prototype.push.apply(e,t);else{const n=t.length;for(let r=0;r<n;r+=c)Array.prototype.push.apply(e,t.slice(r,r+c))}}function u(e,t){return void 0===Object.hasOwn?Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0:Object.hasOwn(e,t)?e[t]:void 0}function d(e,t){const n={},r=t.length;for(let o=0;o<r;o++){const r=t[o],s=r.split(".");let i=e;const a=s.length;for(let e=0;e<a;e++)if(i=i[s[e]],"object"==typeof i){if(null!==i&&"lat"in i&&"lon"in i&&"number"==typeof i.lat&&"number"==typeof i.lon){i=n[r]=i;break}if(!Array.isArray(i)&&null!==i&&e===a-1){i=void 0;break}}else if((null===i||"object"!=typeof i)&&e<a-1){i=void 0;break}void 0!==i&&(n[r]=i)}return n}const f={cm:.01,m:1,km:1e3,ft:.3048,yd:.9144,mi:1609.344};function h(e,t){const n=f[t];if(void 0===n)throw new Error(S("INVALID_DISTANCE_SUFFIX",e).message);return e*n}const p="intersection"in new Set;const g="union"in new Set;function m(e,t){return g?e?e.union(t):t:e?new Set([...e,...t]):new Set(t)}const y={NO_LANGUAGE_WITH_CUSTOM_TOKENIZER:"Do not pass the language option to create when using a custom tokenizer.",LANGUAGE_NOT_SUPPORTED:`Language "%s" is not supported.\nSupported languages are:\n - ${n.join("\n - ")}`,INVALID_STEMMER_FUNCTION_TYPE:"config.stemmer property must be a function.",MISSING_STEMMER:'As of version 1.0.0 @orama/orama does not ship non English stemmers by default. To solve this, please explicitly import and specify the "%s" stemmer from the package @orama/stemmers. See https://docs.orama.com/open-source/text-analysis/stemming for more information.',CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY:"Custom stop words array must only contain strings.",UNSUPPORTED_COMPONENT:'Unsupported component "%s".',COMPONENT_MUST_BE_FUNCTION:'The component "%s" must be a function.',COMPONENT_MUST_BE_FUNCTION_OR_ARRAY_FUNCTIONS:'The component "%s" must be a function or an array of functions.',INVALID_SCHEMA_TYPE:'Unsupported schema type "%s" at "%s". Expected "string", "boolean" or "number" or array of them.',DOCUMENT_ID_MUST_BE_STRING:'Document id must be of type "string". Got "%s" instead.',DOCUMENT_ALREADY_EXISTS:'A document with id "%s" already exists.',DOCUMENT_DOES_NOT_EXIST:'A document with id "%s" does not exists.',MISSING_DOCUMENT_PROPERTY:'Missing searchable property "%s".',INVALID_DOCUMENT_PROPERTY:'Invalid document property "%s": expected "%s", got "%s"',UNKNOWN_INDEX:'Invalid property name "%s". Expected a wildcard string ("*") or array containing one of the following properties: %s',INVALID_BOOST_VALUE:"Boost value must be a number greater than, or less than 0.",INVALID_FILTER_OPERATION:"You can only use one operation per filter, you requested %d.",SCHEMA_VALIDATION_FAILURE:'Cannot insert document due schema validation failure on "%s" property.',INVALID_SORT_SCHEMA_TYPE:'Unsupported sort schema type "%s" at "%s". Expected "string" or "number".',CANNOT_SORT_BY_ARRAY:'Cannot configure sort for "%s" because it is an array (%s).',UNABLE_TO_SORT_ON_UNKNOWN_FIELD:'Unable to sort on unknown field "%s". Allowed fields: %s',SORT_DISABLED:"Sort is disabled. Please read the documentation at https://docs.oramasearch for more information.",UNKNOWN_GROUP_BY_PROPERTY:'Unknown groupBy property "%s".',INVALID_GROUP_BY_PROPERTY:'Invalid groupBy property "%s". Allowed types: "%s", but given "%s".',UNKNOWN_FILTER_PROPERTY:'Unknown filter property "%s".',INVALID_VECTOR_SIZE:'Vector size must be a number greater than 0. Got "%s" instead.',INVALID_VECTOR_VALUE:'Vector value must be a number greater than 0. Got "%s" instead.',INVALID_INPUT_VECTOR:'Property "%s" was declared as a %s-dimensional vector, but got a %s-dimensional vector instead.\nInput vectors must be of the size declared in the schema, as calculating similarity between vectors of different sizes can lead to unexpected results.',WRONG_SEARCH_PROPERTY_TYPE:'Property "%s" is not searchable. Only "string" properties are searchable.',FACET_NOT_SUPPORTED:'Facet doens\'t support the type "%s".',INVALID_DISTANCE_SUFFIX:'Invalid distance suffix "%s". Valid suffixes are: cm, m, km, mi, yd, ft.',INVALID_SEARCH_MODE:'Invalid search mode "%s". Valid modes are: "fulltext", "vector", "hybrid".',MISSING_VECTOR_AND_SECURE_PROXY:"No vector was provided and no secure proxy was configured. Please provide a vector or configure an Orama Secure Proxy to perform hybrid search.",MISSING_TERM:'"term" is a required parameter when performing hybrid search. Please provide a search term.',INVALID_VECTOR_INPUT:'Invalid "vector" property. Expected an object with "value" and "property" properties, but got "%s" instead.',PLUGIN_CRASHED:"A plugin crashed during initialization. Please check the error message for more information:",PLUGIN_SECURE_PROXY_NOT_FOUND:"Could not find '@orama/secure-proxy-plugin' installed in your Orama instance.\nPlease install it before proceeding with creating an answer session.\nRead more at https://docs.orama.com/open-source/plugins/plugin-secure-proxy#plugin-secure-proxy\n",PLUGIN_SECURE_PROXY_MISSING_CHAT_MODEL:"Could not find a chat model defined in the secure proxy plugin configuration.\nPlease provide a chat model before proceeding with creating an answer session.\nRead more at https://docs.orama.com/open-source/plugins/plugin-secure-proxy#plugin-secure-proxy\n",ANSWER_SESSION_LAST_MESSAGE_IS_NOT_ASSISTANT:"The last message in the session is not an assistant message. Cannot regenerate non-assistant messages.",PLUGIN_COMPONENT_CONFLICT:'The component "%s" is already defined. The plugin "%s" is trying to redefine it.'};function S(e,...t){const n=new Error(function(e,...t){return e.replace(/%(?:(?<position>\d+)\$)?(?<width>-?\d*\.?\d*)(?<type>[dfs])/g,(function(...e){const n=e[e.length-1],{width:r,type:o,position:s}=n,i=s?t[Number.parseInt(s)-1]:t.shift(),a=""===r?0:Number.parseInt(r);switch(o){case"d":return i.toString().padStart(a,"0");case"f":{let e=i;const[t,n]=r.split(".").map((e=>Number.parseFloat(e)));return"number"==typeof n&&n>=0&&(e=e.toFixed(n)),"number"==typeof t&&t>=0?e.toString().padStart(a,"0"):e.toString()}case"s":return a<0?i.toString().padEnd(-a," "):i.toString().padStart(a," ");default:return i}}))}(y[e]??`Unsupported Orama Error code: ${e}`,...t));return n.code=e,"captureStackTrace"in Error.prototype&&Error.captureStackTrace(n),n}function b(e){return{raw:Number(e),formatted:(t=e,"number"==typeof t&&(t=BigInt(t)),t<s?`${t}ns`:t<i?t/s+"μs":t<a?t/i+"ms":t/a+"s")};var t}function I(e){if(e.id){if("string"!=typeof e.id)throw S("DOCUMENT_ID_MUST_BE_STRING",typeof e.id);return e.id}return`${r}-${o++}`}function T(e,t){for(const[n,r]of Object.entries(t)){const t=e[n];if(void 0!==t&&(("geopoint"!==r||"object"!=typeof t||"number"!=typeof t.lon||"number"!=typeof t.lat)&&("enum"!==r||"string"!=typeof t&&"number"!=typeof t)))if("enum[]"===r&&Array.isArray(t)){const e=t.length;for(let r=0;r<e;r++)if("string"!=typeof t[r]&&"number"!=typeof t[r])return n+"."+r}else if(w(r)){const e=A(r);if(!Array.isArray(t)||t.length!==e)throw S("INVALID_INPUT_VECTOR",n,e,t.length)}else if(D(r)){if(!Array.isArray(t))return n;const e=v(r),o=t.length;for(let r=0;r<o;r++)if(typeof t[r]!==e)return n+"."+r}else if("object"!=typeof r){if(typeof t!==r)return n}else{if(!t||"object"!=typeof t)return n;const e=T(t,r);if(e)return n+"."+e}}}const O={string:!1,number:!1,boolean:!1,enum:!1,geopoint:!1,"string[]":!0,"number[]":!0,"boolean[]":!0,"enum[]":!0},_={"string[]":"string","number[]":"number","boolean[]":"boolean","enum[]":"enum"};function N(e){return"geopoint"===e}function w(e){return"string"==typeof e&&/^vector\[\d+\]$/.test(e)}function D(e){return"string"==typeof e&&O[e]}function v(e){return _[e]}function A(e){const t=Number(e.slice(7,-1));switch(!0){case isNaN(t):throw S("INVALID_VECTOR_VALUE",e);case t<=0:throw S("INVALID_VECTOR_SIZE",e);default:return t}}function P(e){return{internalIdToId:e.internalIdToId}}function E(e,t){const{internalIdToId:n}=t;e.internalDocumentIDStore.idToInternalId.clear(),e.internalDocumentIDStore.internalIdToId=[];const r=n.length;for(let t=0;t<r;t++){const r=n[t];e.internalDocumentIDStore.idToInternalId.set(r,t+1),e.internalDocumentIDStore.internalIdToId.push(r)}}function k(e,t){if("string"==typeof t){const n=e.idToInternalId.get(t);if(n)return n;const r=e.idToInternalId.size+1;return e.idToInternalId.set(t,r),e.internalIdToId.push(t),r}return t>e.internalIdToId.length?k(e,t.toString()):t}var R=Object.freeze({__proto__:null,createInternalDocumentIDStore:function(){return{idToInternalId:new Map,internalIdToId:[],save:P,load:E}},save:P,load:E,getInternalDocumentId:k,getDocumentIdFromInternalId:function(e,t){if(e.internalIdToId.length<t)throw new Error(`Invalid internalId ${t}`);return e.internalIdToId[t-1]}});function M(e,t){return{sharedInternalDocumentStore:t,docs:{},count:0}}function z(e,t){const n=k(e.sharedInternalDocumentStore,t);return e.docs[n]}function x(e,t){const n=t.length,r=Array.from({length:n});for(let o=0;o<n;o++){const n=k(e.sharedInternalDocumentStore,t[o]);r[o]=e.docs[n]}return r}function L(e){return e.docs}function C(e,t,n,r){return void 0===e.docs[n]&&(e.docs[n]=r,e.count++,!0)}function U(e,t){const n=k(e.sharedInternalDocumentStore,t);return void 0!==e.docs[n]&&(delete e.docs[n],e.count--,!0)}function B(e){return e.count}function F(e,t){const n=t;return{docs:n.docs,count:n.count,sharedInternalDocumentStore:e}}function W(e){return{docs:e.docs,count:e.count}}var V=Object.freeze({__proto__:null,create:M,get:z,getMultiple:x,getAll:L,store:C,remove:U,count:B,load:F,save:W,createDocumentsStore:function(){return{create:M,get:z,getMultiple:x,getAll:L,store:C,remove:U,count:B,load:F,save:W}}});class J{k;v;l=null;r=null;h=1;constructor(e,t){this.k=e,this.v=new Set(t)}updateHeight(){this.h=Math.max(J.getHeight(this.l),J.getHeight(this.r))+1}static getHeight(e){return e?e.h:0}getBalanceFactor(){return J.getHeight(this.l)-J.getHeight(this.r)}rotateLeft(){const e=this.r;return this.r=e.l,e.l=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){const e=this.l;return this.l=e.r,e.r=this,this.updateHeight(),e.updateHeight(),e}toJSON(){return{k:this.k,v:Array.from(this.v),l:this.l?this.l.toJSON():null,r:this.r?this.r.toJSON():null,h:this.h}}static fromJSON(e){const t=new J(e.k,e.v);return t.l=e.l?J.fromJSON(e.l):null,t.r=e.r?J.fromJSON(e.r):null,t.h=e.h,t}}class ${root=null;insertCount=0;constructor(e,t){void 0!==e&&void 0!==t&&(this.root=new J(e,t))}insert(e,t,n=1e3){this.root=this.insertNode(this.root,e,t,n)}insertMultiple(e,t,n=1e3){for(const r of t)this.insert(e,r,n)}rebalance(){this.root&&(this.root=this.rebalanceNode(this.root))}toJSON(){return{root:this.root?this.root.toJSON():null,insertCount:this.insertCount}}static fromJSON(e){const t=new $;return t.root=e.root?J.fromJSON(e.root):null,t.insertCount=e.insertCount||0,t}insertNode(e,t,n,r){if(null===e)return new J(t,[n]);const o=[];let s=e,i=null;for(;null!==s;)if(o.push({parent:i,node:s}),t<s.k){if(null===s.l){s.l=new J(t,[n]),o.push({parent:s,node:s.l});break}i=s,s=s.l}else{if(!(t>s.k))return s.v.add(n),e;if(null===s.r){s.r=new J(t,[n]),o.push({parent:s,node:s.r});break}i=s,s=s.r}let a=!1;this.insertCount++%r==0&&(a=!0);for(let t=o.length-1;t>=0;t--){const{parent:n,node:r}=o[t];if(r.updateHeight(),a){const t=this.rebalanceNode(r);n?n.l===r?n.l=t:n.r===r&&(n.r=t):e=t}}return e}rebalanceNode(e){const t=e.getBalanceFactor();if(t>1){if(e.l&&e.l.getBalanceFactor()>=0)return e.rotateRight();if(e.l)return e.l=e.l.rotateLeft(),e.rotateRight()}if(t<-1){if(e.r&&e.r.getBalanceFactor()<=0)return e.rotateLeft();if(e.r)return e.r=e.r.rotateRight(),e.rotateLeft()}return e}find(e){const t=this.findNodeByKey(e);return t?t.v:null}contains(e){return null!==this.find(e)}getSize(){let e=0;const t=[];let n=this.root;for(;n||t.length>0;){for(;n;)t.push(n),n=n.l;n=t.pop(),e++,n=n.r}return e}isBalanced(){if(!this.root)return!0;const e=[this.root];for(;e.length>0;){const t=e.pop(),n=t.getBalanceFactor();if(Math.abs(n)>1)return!1;t.l&&e.push(t.l),t.r&&e.push(t.r)}return!0}remove(e){this.root=this.removeNode(this.root,e)}removeDocument(e,t){const n=this.findNodeByKey(e);n&&(1===n.v.size?this.root=this.removeNode(this.root,e):n.v=new Set([...n.v.values()].filter((e=>e!==t))))}findNodeByKey(e){let t=this.root;for(;t;)if(e<t.k)t=t.l;else{if(!(e>t.k))return t;t=t.r}return null}removeNode(e,t){if(null===e)return null;const n=[];let r=e;for(;null!==r&&r.k!==t;)n.push(r),r=t<r.k?r.l:r.r;if(null===r)return e;if(null===r.l||null===r.r){const t=r.l?r.l:r.r;if(0===n.length)e=t;else{const e=n[n.length-1];e.l===r?e.l=t:e.r=t}}else{let e=r,t=r.r;for(;null!==t.l;)e=t,t=t.l;r.k=t.k,r.v=t.v,e.l===t?e.l=t.r:e.r=t.r,r=e}n.push(r);for(let t=n.length-1;t>=0;t--){const r=n[t];r.updateHeight();const o=this.rebalanceNode(r);if(t>0){const e=n[t-1];e.l===r?e.l=o:e.r===r&&(e.r=o)}else e=o}return e}rangeSearch(e,t){let n=new Set;const r=[];let o=this.root;for(;o||r.length>0;){for(;o;)r.push(o),o=o.l;if(o=r.pop(),o.k>=e&&o.k<=t&&(n=m(n,o.v)),o.k>t)break;o=o.r}return n}greaterThan(e,t=!1){let n=new Set;const r=[];let o=this.root;for(;o||r.length>0;){for(;o;)r.push(o),o=o.r;if(o=r.pop(),t&&o.k>=e||!t&&o.k>e)n=m(n,o.v);else if(o.k<=e)break;o=o.l}return n}lessThan(e,t=!1){let n=new Set;const r=[];let o=this.root;for(;o||r.length>0;){for(;o;)r.push(o),o=o.l;if(o=r.pop(),t&&o.k<=e||!t&&o.k<e)n=m(n,o.v);else if(o.k>e)break;o=o.r}return n}}class j{numberToDocumentId;constructor(){this.numberToDocumentId=new Map}insert(e,t){this.numberToDocumentId.has(e)?this.numberToDocumentId.get(e).add(t):this.numberToDocumentId.set(e,new Set([t]))}find(e){const t=this.numberToDocumentId.get(e);return t?Array.from(t):null}remove(e){this.numberToDocumentId.delete(e)}removeDocument(e,t){const n=this.numberToDocumentId.get(t);n&&(n.delete(e),0===n.size&&this.numberToDocumentId.delete(t))}contains(e){return this.numberToDocumentId.has(e)}getSize(){let e=0;for(const t of this.numberToDocumentId.values())e+=t.size;return e}filter(e){const t=Object.keys(e);if(1!==t.length)throw new Error("Invalid operation");const n=t[0];switch(n){case"eq":{const t=e[n],r=this.numberToDocumentId.get(t);return r?Array.from(r):[]}case"in":{const t=e[n],r=new Set;for(const e of t){const t=this.numberToDocumentId.get(e);if(t)for(const e of t)r.add(e)}return Array.from(r)}case"nin":{const t=new Set(e[n]),r=new Set;for(const[e,n]of this.numberToDocumentId.entries())if(!t.has(e))for(const e of n)r.add(e);return Array.from(r)}default:throw new Error("Invalid operation")}}filterArr(e){const t=Object.keys(e);if(1!==t.length)throw new Error("Invalid operation");const n=t[0];switch(n){case"containsAll":{const t=e[n].map((e=>this.numberToDocumentId.get(e)??new Set));if(0===t.length)return[];const r=t.reduce(((e,t)=>new Set([...e].filter((e=>t.has(e))))));return Array.from(r)}case"containsAny":{const t=e[n].map((e=>this.numberToDocumentId.get(e)??new Set));if(0===t.length)return[];const r=t.reduce(((e,t)=>new Set([...e,...t])));return Array.from(r)}default:throw new Error("Invalid operation")}}static fromJSON(e){if(!e.numberToDocumentId)throw new Error("Invalid Flat Tree JSON");const t=new j;for(const[n,r]of e.numberToDocumentId)t.numberToDocumentId.set(n,new Set(r));return t}toJSON(){return{numberToDocumentId:Array.from(this.numberToDocumentId.entries()).map((([e,t])=>[e,Array.from(t)]))}}}function Y(e,t,n){const r=function(e,t,n){if(n<0)return-1;if(e===t)return 0;const r=e.length,o=t.length;if(0===r)return o<=n?o:-1;if(0===o)return r<=n?r:-1;const s=Math.abs(r-o);if(e.startsWith(t))return s<=n?s:-1;if(t.startsWith(e))return 0;if(s>n)return-1;const i=[];for(let e=0;e<=r;e++){i[e]=[e];for(let t=1;t<=o;t++)i[e][t]=0===e?t:0}for(let s=1;s<=r;s++){let r=1/0;for(let n=1;n<=o;n++)e[s-1]===t[n-1]?i[s][n]=i[s-1][n-1]:i[s][n]=Math.min(i[s-1][n]+1,i[s][n-1]+1,i[s-1][n-1]+1),r=Math.min(r,i[s][n]);if(r>n)return-1}return i[r][o]<=n?i[r][o]:-1}(e,t,n);return{distance:r,isBounded:r>=0}}class G{k;s;c=new Map;d=new Set;e;w="";constructor(e,t,n){this.k=e,this.s=t,this.e=n}updateParent(e){this.w=e.w+this.s}addDocument(e){this.d.add(e)}removeDocument(e){return this.d.delete(e)}findAllWords(e,t,n,r){const o=[this];for(;o.length>0;){const s=o.pop();if(s.e){const{w:o,d:i}=s;if(n&&o!==t)continue;if(null!==u(e,o))if(r){if(!(Math.abs(t.length-o.length)<=r&&Y(t,o,r).isBounded))continue;e[o]=[]}else e[o]=[];if(null!=u(e,o)&&i.size>0){const t=e[o];for(const e of i)t.includes(e)||t.push(e)}}s.c.size>0&&o.push(...s.c.values())}return e}insert(e,t){let n=this,r=0;const o=e.length;for(;r<o;){const s=e[r],i=n.c.get(s);if(i){const s=i.s,a=s.length;let c=0;for(;c<a&&r+c<o&&s[c]===e[r+c];)c++;if(c===a){if(n=i,r+=c,r===o)return i.e||(i.e=!0),void i.addDocument(t);continue}const l=s.slice(0,c),u=s.slice(c),d=e.slice(r+c),f=new G(l[0],l,!1);if(n.c.set(l[0],f),f.updateParent(n),i.s=u,i.k=u[0],f.c.set(u[0],i),i.updateParent(f),d){const e=new G(d[0],d,!0);e.addDocument(t),f.c.set(d[0],e),e.updateParent(f)}else f.e=!0,f.addDocument(t);return}{const o=new G(s,e.slice(r),!0);return o.addDocument(t),n.c.set(s,o),void o.updateParent(n)}}n.e||(n.e=!0),n.addDocument(t)}_findLevenshtein(e,t,n,r,o){const s=[{node:this,index:t,tolerance:n}];for(;s.length>0;){const{node:t,index:n,tolerance:i}=s.pop();if(t.w.startsWith(e)){t.findAllWords(o,e,!1,0);continue}if(i<0)continue;if(t.e){const{w:n,d:s}=t;if(n&&(Y(e,n,r).isBounded&&(o[n]=[]),void 0!==u(o,n)&&s.size>0)){const e=new Set(o[n]);for(const t of s)e.add(t);o[n]=Array.from(e)}}if(n>=e.length)continue;const a=e[n];if(t.c.has(a)){const e=t.c.get(a);s.push({node:e,index:n+1,tolerance:i})}s.push({node:t,index:n+1,tolerance:i-1});for(const[e,r]of t.c)s.push({node:r,index:n,tolerance:i-1}),e!==a&&s.push({node:r,index:n+1,tolerance:i-1})}}find(e){const{term:t,exact:n,tolerance:r}=e;if(r&&!n){const e={};return this._findLevenshtein(t,0,r,r,e),e}{let e=this,o=0;const s=t.length;for(;o<s;){const i=t[o],a=e.c.get(i);if(!a)return{};{const i=a.s,c=i.length;let l=0;for(;l<c&&o+l<s&&i[l]===t[o+l];)l++;if(l!==c){if(o+l===s){if(n)return{};{const e={};return a.findAllWords(e,t,n,r),e}}return{}}e=a,o+=l}}const i={};return e.findAllWords(i,t,n,r),i}}contains(e){let t=this,n=0;const r=e.length;for(;n<r;){const o=e[n],s=t.c.get(o);if(!s)return!1;{const o=s.s,i=o.length;let a=0;for(;a<i&&n+a<r&&o[a]===e[n+a];)a++;if(a<i)return!1;n+=i,t=s}}return!0}removeWord(e){if(!e)return!1;let t=this;const n=e.length,r=[];for(let o=0;o<n;o++){const n=e[o];if(!t.c.has(n))return!1;{const e=t.c.get(n);r.push({parent:t,character:n}),o+=e.s.length-1,t=e}}for(t.d.clear(),t.e=!1;r.length>0&&0===t.c.size&&!t.e&&0===t.d.size;){const{parent:e,character:n}=r.pop();e.c.delete(n),t=e}return!0}removeDocumentByWord(e,t,n=!0){if(!e)return!0;let r=this;const o=e.length;for(let s=0;s<o;s++){const o=e[s];if(!r.c.has(o))return!1;{const i=r.c.get(o);s+=i.s.length-1,r=i,n&&r.w!==e||r.removeDocument(t)}}return!0}static getCommonPrefix(e,t){const n=Math.min(e.length,t.length);let r=0;for(;r<n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return e.slice(0,r)}toJSON(){return{w:this.w,s:this.s,e:this.e,k:this.k,d:Array.from(this.d),c:Array.from(this.c?.entries())?.map((([e,t])=>[e,t.toJSON()]))}}static fromJSON(e){const t=new G(e.k,e.s,e.e);return t.w=e.w,t.d=new Set(e.d),t.c=new Map(e?.c?.map((([e,t])=>[e,G.fromJSON(t)]))),t}}class H extends G{constructor(){super("","",!1)}static fromJSON(e){const t=new H;return t.w=e.w,t.s=e.s,t.e=e.e,t.k=e.k,t.d=new Set(e.d),t.c=new Map(e.c?.map((([e,t])=>[e,G.fromJSON(t)]))),t}toJSON(){return super.toJSON()}}class K{point;docIDs;left;right;parent;constructor(e,t){this.point=e,this.docIDs=new Set(t),this.left=null,this.right=null,this.parent=null}toJSON(){return{point:this.point,docIDs:Array.from(this.docIDs),left:this.left?this.left.toJSON():null,right:this.right?this.right.toJSON():null}}static fromJSON(e,t=null){const n=new K(e.point,e.docIDs);return n.parent=t,e.left&&(n.left=K.fromJSON(e.left,n)),e.right&&(n.right=K.fromJSON(e.right,n)),n}}class q{root;nodeMap;constructor(){this.root=null,this.nodeMap=new Map}getPointKey(e){return`${e.lon},${e.lat}`}insert(e,t){const n=this.getPointKey(e),r=this.nodeMap.get(n);if(r)return void t.forEach((e=>r.docIDs.add(e)));const o=new K(e,t);if(this.nodeMap.set(n,o),null==this.root)return void(this.root=o);let s=this.root,i=0;for(;;){if(0===i%2)if(e.lon<s.point.lon){if(null==s.left)return s.left=o,void(o.parent=s);s=s.left}else{if(null==s.right)return s.right=o,void(o.parent=s);s=s.right}else if(e.lat<s.point.lat){if(null==s.left)return s.left=o,void(o.parent=s);s=s.left}else{if(null==s.right)return s.right=o,void(o.parent=s);s=s.right}i++}}contains(e){const t=this.getPointKey(e);return this.nodeMap.has(t)}getDocIDsByCoordinates(e){const t=this.getPointKey(e),n=this.nodeMap.get(t);return n?Array.from(n.docIDs):null}removeDocByID(e,t){const n=this.getPointKey(e),r=this.nodeMap.get(n);r&&(r.docIDs.delete(t),0===r.docIDs.size&&(this.nodeMap.delete(n),this.deleteNode(r)))}deleteNode(e){const t=e.parent,n=e.left?e.left:e.right;n&&(n.parent=t),t?t.left===e?t.left=n:t.right===e&&(t.right=n):(this.root=n,this.root&&(this.root.parent=null))}searchByRadius(e,t,n=!0,r="asc",o=!1){const s=o?q.vincentyDistance:q.haversineDistance,i=[{node:this.root,depth:0}],a=[];for(;i.length>0;){const{node:r,depth:o}=i.pop();if(null==r)continue;const c=s(e,r.point);(n?c<=t:c>t)&&a.push({point:r.point,docIDs:Array.from(r.docIDs)}),null!=r.left&&i.push({node:r.left,depth:o+1}),null!=r.right&&i.push({node:r.right,depth:o+1})}return r&&a.sort(((t,n)=>{const o=s(e,t.point),i=s(e,n.point);return"asc"===r.toLowerCase()?o-i:i-o})),a}searchByPolygon(e,t=!0,n=null,r=!1){const o=[{node:this.root,depth:0}],s=[];for(;o.length>0;){const{node:n,depth:r}=o.pop();if(null==n)continue;null!=n.left&&o.push({node:n.left,depth:r+1}),null!=n.right&&o.push({node:n.right,depth:r+1});const i=q.isPointInPolygon(e,n.point);(i&&t||!i&&!t)&&s.push({point:n.point,docIDs:Array.from(n.docIDs)})}const i=q.calculatePolygonCentroid(e);if(n){const e=r?q.vincentyDistance:q.haversineDistance;s.sort(((t,r)=>{const o=e(i,t.point),s=e(i,r.point);return"asc"===n.toLowerCase()?o-s:s-o}))}return s}toJSON(){return{root:this.root?this.root.toJSON():null}}static fromJSON(e){const t=new q;return e.root&&(t.root=K.fromJSON(e.root),t.buildNodeMap(t.root)),t}buildNodeMap(e){if(null==e)return;const t=this.getPointKey(e.point);this.nodeMap.set(t,e),e.left&&this.buildNodeMap(e.left),e.right&&this.buildNodeMap(e.right)}static calculatePolygonCentroid(e){let t=0,n=0,r=0;const o=e.length;for(let s=0,i=o-1;s<o;i=s++){const o=e[s].lon,a=e[s].lat,c=e[i].lon,l=e[i].lat,u=o*l-c*a;t+=u,n+=(o+c)*u,r+=(a+l)*u}t/=2;const s=6*t;return n/=s,r/=s,{lon:n,lat:r}}static isPointInPolygon(e,t){let n=!1;const r=t.lon,o=t.lat,s=e.length;for(let t=0,i=s-1;t<s;i=t++){const s=e[t].lon,a=e[t].lat,c=e[i].lon,l=e[i].lat;a>o!=l>o&&r<(c-s)*(o-a)/(l-a)+s&&(n=!n)}return n}static haversineDistance(e,t){const n=Math.PI/180,r=e.lat*n,o=t.lat*n,s=(t.lat-e.lat)*n,i=(t.lon-e.lon)*n,a=Math.sin(s/2)*Math.sin(s/2)+Math.cos(r)*Math.cos(o)*Math.sin(i/2)*Math.sin(i/2);return 6371e3*(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)))}static vincentyDistance(e,t){const n=6378137,r=1/298.257223563,o=(1-r)*n,s=Math.PI/180,i=e.lat*s,a=t.lat*s,c=(t.lon-e.lon)*s,l=Math.atan((1-r)*Math.tan(i)),u=Math.atan((1-r)*Math.tan(a)),d=Math.sin(l),f=Math.cos(l),h=Math.sin(u),p=Math.cos(u);let g,m,y,S,b,I,T,O=c,_=1e3;do{const e=Math.sin(O),t=Math.cos(O);if(m=Math.sqrt(p*e*(p*e)+(f*h-d*p*t)*(f*h-d*p*t)),0===m)return 0;y=d*h+f*p*t,S=Math.atan2(m,y),b=f*p*e/m,I=1-b*b,T=y-2*d*h/I,isNaN(T)&&(T=0);const n=r/16*I*(4+r*(4-3*I));g=O,O=c+(1-n)*r*b*(S+n*m*(T+n*y*(2*T*T-1)))}while(Math.abs(O-g)>1e-12&&--_>0);if(0===_)return NaN;const N=I*(n*n-o*o)/(o*o),w=N/1024*(256+N*(N*(74-47*N)-128));return o*(1+N/16384*(4096+N*(N*(320-175*N)-768)))*(S-w*m*(T+w/4*(y*(2*T*T-1)-w/6*T*(4*m*m-3)*(4*T*T-3))))}}class Z{true;false;constructor(){this.true=new Set,this.false=new Set}insert(e,t){t?this.true.add(e):this.false.add(e)}delete(e,t){t?this.true.delete(e):this.false.delete(e)}getSize(){return this.true.size+this.false.size}toJSON(){return{true:Array.from(this.true),false:Array.from(this.false)}}static fromJSON(e){const t=new Z;return t.true=new Set(e.true),t.false=new Set(e.false),t}}function X(e,t,n,r,o,{k:s,b:i,d:a}){return Math.log(1+(n-t+.5)/(t+.5))*(a+e*(s+1))/(e+s*(1-i+i*r/o))}class Q{size;vectors=new Map;constructor(e){this.size=e}add(e,t){t instanceof Float32Array||(t=new Float32Array(t));const n=ee(t,this.size);this.vectors.set(e,[n,t])}remove(e){this.vectors.delete(e)}find(e,t,n){e instanceof Float32Array||(e=new Float32Array(e));const r=function(e,t,n,r,o){const s=ee(e,r),i=[],a=t||n.keys();for(const t of a){const a=n.get(t);if(!a)continue;const c=a[0],l=a[1];let u=0;for(let t=0;t<r;t++)u+=e[t]*l[t];const d=u/(s*c);d>=o&&i.push([t,d])}return i}(e,n,this.vectors,this.size,t);return r}toJSON(){const e=[];for(const[t,[n,r]]of this.vectors)e.push([t,[n,Array.from(r)]]);return{size:this.size,vectors:e}}static fromJSON(e){const t=e,n=new Q(t.size);for(const[e,[r,o]]of t.vectors)n.vectors.set(e,[r,new Float32Array(o)]);return n}}function ee(e,t){let n=0;for(let r=0;r<t;r++)n+=e[r]*e[r];return Math.sqrt(n)}function te(e,t,n,r,o){const s=k(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=((e.avgFieldLength[t]??0)*(o-1)+r.length)/o,e.fieldLengths[t][s]=r.length,e.frequencies[t][s]={}}function ne(e,t,n,r,o){let s=0;for(const e of r)e===o&&s++;const i=k(e.sharedInternalDocumentStore,n),a=s/r.length;e.frequencies[t][i][o]=a,o in e.tokenOccurrences[t]||(e.tokenOccurrences[t][o]=0),e.tokenOccurrences[t][o]=(e.tokenOccurrences[t][o]??0)+1}function re(e,t,n,r){const o=k(e.sharedInternalDocumentStore,n);e.avgFieldLength[t]=r>1?(e.avgFieldLength[t]*r-e.fieldLengths[t][o])/(r-1):void 0,e.fieldLengths[t][o]=void 0,e.frequencies[t][o]=void 0}function oe(e,t,n){e.tokenOccurrences[t][n]--}function se(e,t,n,r,o=""){r||(r={sharedInternalDocumentStore:t,indexes:{},vectorIndexes:{},searchableProperties:[],searchablePropertiesWithTypes:{},frequencies:{},tokenOccurrences:{},avgFieldLength:{},fieldLengths:{}});for(const[s,i]of Object.entries(n)){const n=`${o}${o?".":""}${s}`;if("object"!=typeof i||Array.isArray(i))if(w(i))r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=i,r.vectorIndexes[n]={type:"Vector",node:new Q(A(i)),isArray:!1};else{const e=/\[/.test(i);switch(i){case"boolean":case"boolean[]":r.indexes[n]={type:"Bool",node:new Z,isArray:e};break;case"number":case"number[]":r.indexes[n]={type:"AVL",node:new $(0,[]),isArray:e};break;case"string":case"string[]":r.indexes[n]={type:"Radix",node:new H,isArray:e},r.avgFieldLength[n]=0,r.frequencies[n]={},r.tokenOccurrences[n]={},r.fieldLengths[n]={};break;case"enum":case"enum[]":r.indexes[n]={type:"Flat",node:new j,isArray:e};break;case"geopoint":r.indexes[n]={type:"BKD",node:new q,isArray:e};break;default:throw S("INVALID_SCHEMA_TYPE",Array.isArray(i)?"array":i,n)}r.searchableProperties.push(n),r.searchablePropertiesWithTypes[n]=i}else se(e,t,i,r,n)}return r}function ie(e,t,n,r,o,s,i,a,c,l,u){if(w(i))return ae(t,n,s,r,o);const d=function(e,t,n,r,o,s,i,a){return c=>{const{type:l,node:u}=t.indexes[n];switch(l){case"Bool":u[c?"true":"false"].add(r);break;case"AVL":{const e=a?.avlRebalanceThreshold??1;u.insert(c,r,e);break}case"Radix":{const a=s.tokenize(c,o,n,!1);e.insertDocumentScoreParameters(t,n,r,a,i);for(const o of a)e.insertTokenScoreParameters(t,n,r,a,o),u.insert(o,r);break}case"Flat":u.insert(c,r);break;case"BKD":u.insert(c,[r])}}}(e,t,n,o,a,c,l,u);if(!D(i))return d(s);const f=s,h=f.length;for(let e=0;e<h;e++)d(f[e])}function ae(e,t,n,r,o){e.vectorIndexes[t].node.add(o,n)}function ce(e,t,n,r,o,s,i,a,c,l){if(w(i))return t.vectorIndexes[n].node.remove(o),!0;const{type:u,node:d}=t.indexes[n];switch(u){case"AVL":return d.removeDocument(s,o),!0;case"Bool":return d[s?"true":"false"].delete(o),!0;case"Radix":{const i=c.tokenize(s,a,n);e.removeDocumentScoreParameters(t,n,r,l);for(const r of i)e.removeTokenScoreParameters(t,n,r),d.removeDocumentByWord(r,o);return!0}case"Flat":return d.removeDocument(o,s),!0;case"BKD":return d.removeDocByID(s,o),!1}}function le(e,t,n,r,o,s,i,a,c,l){if(!D(i))return ce(e,t,n,r,o,s,i,a,c,l);const u=v(i),d=s,f=d.length;for(let s=0;s<f;s++)ce(e,t,n,r,o,d[s],u,a,c,l);return!0}function ue(e,t,n,r,o,s,i,a,c,l){const u=Array.from(r),d=e.avgFieldLength[t],f=e.fieldLengths[t],h=e.tokenOccurrences[t],p=e.frequencies[t],g="number"==typeof h[n]?h[n]??0:0,m=u.length;for(let e=0;e<m;e++){const r=u[e];if(c&&!c.has(r))continue;l.has(r)||l.set(r,new Map);const h=l.get(r);h.set(t,(h.get(t)||0)+1);const m=X(p?.[r]?.[n]??0,g,o,f[r],d,s);i.has(r)?i.set(r,i.get(r)+m*a):i.set(r,m*a)}}function de(e,t,n,r,o,s,i,a,c,l,u,d){const f=r.length;for(let h=0;h<f;h++){const f=r[h],p=t.find({term:f,exact:o,tolerance:s}),g=Object.keys(p),m=g.length;for(let t=0;t<m;t++){const r=g[t];ue(e,n,r,p[r],l,c,i,a,u,d)}}}function fe(e,t,n,r,o,s,i,a,c,l,u,d=0){const f=n.tokenize(t,r),h=f.length||1,p=new Map,g=new Map;for(const n of o){if(!(n in e.indexes))continue;const r=e.indexes[n],{type:o}=r;if("Radix"!==o)throw S("WRONG_SEARCH_PROPERTY_TYPE",n);const d=a[n]??1;if(d<=0)throw S("INVALID_BOOST_VALUE",d);0!==f.length||t||f.push(""),de(e,r.node,n,f,s,i,g,d,c,l,u,p)}const m=Array.from(g.entries()).map((([e,t])=>[e,t])).sort(((e,t)=>t[1]-e[1]));if(0===m.length)return[];if(1===d)return m;const y=m.filter((([e])=>{const t=p.get(e);return!!t&&Array.from(t.values()).some((e=>e===h))}));if(0===d)return y;if(y.length>0){const e=m.filter((([e])=>!y.some((([t])=>t===e)))),t=Math.ceil(e.length*d);return[...y,...e.slice(0,t)]}return m}function he(e,t,n,r){const o=Object.keys(n),s=o.reduce(((e,t)=>({[t]:new Set,...e})),{});for(const i of o){const o=n[i];if(void 0===e.indexes[i])throw S("UNKNOWN_FILTER_PROPERTY",i);const{node:a,type:c,isArray:l}=e.indexes[i];if("Bool"===c){const e=a,t=o?e.true:e.false;s[i]=m(s[i],t);continue}if("BKD"===c){let e;if("radius"in o)e="radius";else{if(!("polygon"in o))throw new Error(`Invalid operation ${o}`);e="polygon"}if("radius"===e){const{value:t,coordinates:n,unit:r="m",inside:c=!0,highPrecision:l=!1}=o[e],u=h(t,r),d=a.searchByRadius(n,u,c,void 0,l);s[i]=Se(s[i],d)}else{const{coordinates:t,inside:n=!0,highPrecision:r=!1}=o[e],c=a.searchByPolygon(t,n,void 0,r);s[i]=Se(s[i],c)}continue}if("Radix"===c&&("string"==typeof o||Array.isArray(o))){for(const e of[o].flat()){const n=t.tokenize(e,r,i);for(const e of n){const t=a.find({term:e,exact:!0});s[i]=be(s[i],t)}}continue}const u=Object.keys(o);if(u.length>1)throw S("INVALID_FILTER_OPERATION",u.length);if("Flat"!==c){if("AVL"===c){const e=u[0],t=o[e];let n;switch(e){case"gt":n=a.greaterThan(t,!1);break;case"gte":n=a.greaterThan(t,!0);break;case"lt":n=a.lessThan(t,!1);break;case"lte":n=a.lessThan(t,!0);break;case"eq":n=a.find(t)??new Set;break;case"between":{const[e,r]=t;n=a.rangeSearch(e,r);break}default:throw S("INVALID_FILTER_OPERATION",e)}s[i]=m(s[i],n)}}else{const e=new Set(l?a.filterArr(o):a.filter(o));s[i]=m(s[i],e)}}return function(...e){if(0===e.length)return new Set;if(1===e.length)return e[0];if(2===e.length){const t=e[0],n=e[1];if(p)return t.intersection(n);const r=new Set,o=t.size<n.size?t:n,s=o===t?n:t;for(const e of o)s.has(e)&&r.add(e);return r}const t={index:0,size:e[0].size};for(let n=1;n<e.length;n++)e[n].size<t.size&&(t.index=n,t.size=e[n].size);if(p){let n=e[t.index];for(let r=0;r<e.length;r++)r!==t.index&&(n=n.intersection(e[r]));return n}const n=e[t.index];for(let r=0;r<e.length;r++){if(r===t.index)continue;const o=e[r];for(const e of n)o.has(e)||n.delete(e)}return n}(...Object.values(s))}function pe(e){return e.searchableProperties}function ge(e){return e.searchablePropertiesWithTypes}function me(e,t){const{indexes:n,vectorIndexes:r,searchableProperties:o,searchablePropertiesWithTypes:s,frequencies:i,tokenOccurrences:a,avgFieldLength:c,fieldLengths:l}=t,u={},d={};for(const e of Object.keys(n)){const{node:t,type:r,isArray:o}=n[e];switch(r){case"Radix":u[e]={type:"Radix",node:H.fromJSON(t),isArray:o};break;case"Flat":u[e]={type:"Flat",node:j.fromJSON(t),isArray:o};break;case"AVL":u[e]={type:"AVL",node:$.fromJSON(t),isArray:o};break;case"BKD":u[e]={type:"BKD",node:q.fromJSON(t),isArray:o};break;case"Bool":u[e]={type:"Bool",node:Z.fromJSON(t),isArray:o};break;default:u[e]=n[e]}}for(const e of Object.keys(r))d[e]={type:"Vector",isArray:!1,node:Q.fromJSON(r[e])};return{sharedInternalDocumentStore:e,indexes:u,vectorIndexes:d,searchableProperties:o,searchablePropertiesWithTypes:s,frequencies:i,tokenOccurrences:a,avgFieldLength:c,fieldLengths:l}}function ye(e){const{indexes:t,vectorIndexes:n,searchableProperties:r,searchablePropertiesWithTypes:o,frequencies:s,tokenOccurrences:i,avgFieldLength:a,fieldLengths:c}=e,l={};for(const e of Object.keys(n))l[e]=n[e].node.toJSON();const u={};for(const e of Object.keys(t)){const{type:n,node:r,isArray:o}=t[e];"Flat"===n||"Radix"===n||"AVL"===n||"BKD"===n||"Bool"===n?u[e]={type:n,node:r.toJSON(),isArray:o}:(u[e]=t[e],u[e].node=u[e].node.toJSON())}return{indexes:u,vectorIndexes:l,searchableProperties:r,searchablePropertiesWithTypes:o,frequencies:s,tokenOccurrences:i,avgFieldLength:a,fieldLengths:c}}function Se(e,t){e||(e=new Set);const n=t.length;for(let r=0;r<n;r++){const n=t[r].docIDs,o=n.length;for(let t=0;t<o;t++)e.add(n[t])}return e}function be(e,t){e||(e=new Set);const n=Object.keys(t),r=n.length;for(let o=0;o<r;o++){const r=t[n[o]],s=r.length;for(let t=0;t<s;t++)e.add(r[t])}return e}var Ie=Object.freeze({__proto__:null,insertDocumentScoreParameters:te,insertTokenScoreParameters:ne,removeDocumentScoreParameters:re,removeTokenScoreParameters:oe,create:se,insert:ie,insertVector:ae,remove:le,calculateResultScores:ue,search:fe,searchByWhereClause:he,getSearchableProperties:pe,getSearchablePropertiesWithTypes:ge,load:me,save:ye,createIndex:function(){return{create:se,insert:ie,remove:le,insertDocumentScoreParameters:te,insertTokenScoreParameters:ne,removeDocumentScoreParameters:re,removeTokenScoreParameters:oe,calculateResultScores:ue,search:fe,searchByWhereClause:he,getSearchableProperties:pe,getSearchablePropertiesWithTypes:ge,load:me,save:ye}}});const Te=[65,65,65,65,65,65,65,67,69,69,69,69,73,73,73,73,69,78,79,79,79,79,79,null,79,85,85,85,85,89,80,115,97,97,97,97,97,97,97,99,101,101,101,101,105,105,105,105,101,110,111,111,111,111,111,null,111,117,117,117,117,121,112,121,65,97,65,97,65,97,67,99,67,99,67,99,67,99,68,100,68,100,69,101,69,101,69,101,69,101,69,101,71,103,71,103,71,103,71,103,72,104,72,104,73,105,73,105,73,105,73,105,73,105,73,105,74,106,75,107,107,76,108,76,108,76,108,76,108,76,108,78,110,78,110,78,110,110,78,110,79,111,79,111,79,111,79,111,82,114,82,114,82,114,83,115,83,115,83,115,83,115,84,116,84,116,84,116,85,117,85,117,85,117,85,117,85,117,85,117,87,119,89,121,89,90,122,90,122,90,122,115];const Oe={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"},_e={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},Ne="[aeiouy]",we="[^aeiou][^aeiouy]*",De=Ne+"[aeiou]*",ve="^("+we+")?"+De+we,Ae="^("+we+")?"+De+we+"("+De+")?$",Pe="^("+we+")?"+De+we+De+we,Ee="^("+we+")?"+Ne;function ke(e){let t,n,r,o,s,i;if(e.length<3)return e;const a=e.substring(0,1);if("y"==a&&(e=a.toUpperCase()+e.substring(1)),r=/^(.+?)(ss|i)es$/,o=/^(.+?)([^s])s$/,r.test(e)?e=e.replace(r,"$1$2"):o.test(e)&&(e=e.replace(o,"$1$2")),r=/^(.+?)eed$/,o=/^(.+?)(ed|ing)$/,r.test(e)){const t=r.exec(e);r=new RegExp(ve),r.test(t[1])&&(r=/.$/,e=e.replace(r,""))}else if(o.test(e)){t=o.exec(e)[1],o=new RegExp(Ee),o.test(t)&&(e=t,o=/(at|bl|iz)$/,s=new RegExp("([^aeiouylsz])\\1$"),i=new RegExp("^"+we+Ne+"[^aeiouwxy]$"),o.test(e)?e+="e":s.test(e)?(r=/.$/,e=e.replace(r,"")):i.test(e)&&(e+="e"))}if(r=/^(.+?)y$/,r.test(e)){const n=r.exec(e);t=n?.[1],r=new RegExp(Ee),t&&r.test(t)&&(e=t+"i")}if(r=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,r.test(e)){const o=r.exec(e);t=o?.[1],n=o?.[2],r=new RegExp(ve),t&&r.test(t)&&(e=t+Oe[n])}if(r=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,r.test(e)){const o=r.exec(e);t=o?.[1],n=o?.[2],r=new RegExp(ve),t&&r.test(t)&&(e=t+_e[n])}if(r=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,o=/^(.+?)(s|t)(ion)$/,r.test(e)){const n=r.exec(e);t=n?.[1],r=new RegExp(Pe),t&&r.test(t)&&(e=t)}else if(o.test(e)){const n=o.exec(e);t=n?.[1]??""+n?.[2]??"",o=new RegExp(Pe),o.test(t)&&(e=t)}if(r=/^(.+?)e$/,r.test(e)){const n=r.exec(e);t=n?.[1],r=new RegExp(Pe),o=new RegExp(Ae),s=new RegExp("^"+we+Ne+"[^aeiouwxy]$"),t&&(r.test(t)||o.test(t)&&!s.test(t))&&(e=t)}return r=/ll$/,o=new RegExp(Pe),r.test(e)&&o.test(e)&&(r=/.$/,e=e.replace(r,"")),"y"==a&&(e=a.toLowerCase()+e.substring(1)),e}function Re(e,t,n=!0){const r=`${this.language}:${e}:${t}`;return n&&this.normalizationCache.has(r)?this.normalizationCache.get(r):this.stopWords?.includes(t)?(n&&this.normalizationCache.set(r,""),""):(this.stemmer&&!this.stemmerSkipProperties.has(e)&&(t=this.stemmer(t)),t=function(e){const t=[];for(let r=0;r<e.length;r++)t[r]=(n=e.charCodeAt(r))<192||n>383?n:Te[n-192]||n;var n;return String.fromCharCode(...t)}(t),n&&this.normalizationCache.set(r,t),t)}function Me(e,n,r,o=!0){if(n&&n!==this.language)throw S("LANGUAGE_NOT_SUPPORTED",n);if("string"!=typeof e)return[e];const s=this.normalizeToken.bind(this,r??"");let i;if(r&&this.tokenizeSkipProperties.has(r))i=[s(e,o)];else{const n=t[this.language];i=e.toLowerCase().split(n).map((e=>s(e,o))).filter(Boolean)}const a=function(e){for(;""===e[e.length-1];)e.pop();for(;""===e[0];)e.shift();return e}(i);return this.allowDuplicates?a:Array.from(new Set(a))}var ze=Object.freeze({__proto__:null,normalizeToken:Re,createTokenizer:function(e={}){if(e.language){if(!n.includes(e.language))throw S("LANGUAGE_NOT_SUPPORTED",e.language)}else e.language="english";let t,r;if(e.stemming||e.stemmer&&!("stemming"in e))if(e.stemmer){if("function"!=typeof e.stemmer)throw S("INVALID_STEMMER_FUNCTION_TYPE");t=e.stemmer}else{if("english"!==e.language)throw S("MISSING_STEMMER",e.language);t=ke}if(!1!==e.stopWords){if(r=[],Array.isArray(e.stopWords))r=e.stopWords;else if("function"==typeof e.stopWords)r=e.stopWords(r);else if(e.stopWords)throw S("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");if(!Array.isArray(r))throw S("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY");for(const e of r)if("string"!=typeof e)throw S("CUSTOM_STOP_WORDS_MUST_BE_FUNCTION_OR_ARRAY")}const o={tokenize:Me,language:e.language,stemmer:t,stemmerSkipProperties:new Set(e.stemmerSkipProperties?[e.stemmerSkipProperties].flat():[]),tokenizeSkipProperties:new Set(e.tokenizeSkipProperties?[e.tokenizeSkipProperties].flat():[]),stopWords:r,allowDuplicates:Boolean(e.allowDuplicates),normalizeToken:Re,normalizationCache:new Map};return o.tokenize=Me.bind(o),o.normalizeToken=Re,o}});function xe(e,t,n,r,o){const s={language:e.tokenizer.language,sharedInternalDocumentStore:t,enabled:!0,isSorted:!0,sortableProperties:[],sortablePropertiesWithTypes:{},sorts:{}};for(const[i,a]of Object.entries(n)){const n=`${o}${o?".":""}${i}`;if(!r.includes(n))if("object"!=typeof a||Array.isArray(a)){if(!w(a))switch(a){case"boolean":case"number":case"string":s.sortableProperties.push(n),s.sortablePropertiesWithTypes[n]=a,s.sorts[n]={docs:new Map,orderedDocsToRemove:new Map,orderedDocs:[],type:a};break;case"geopoint":case"enum":case"enum[]":case"boolean[]":case"number[]":case"string[]":continue;default:throw S("INVALID_SORT_SCHEMA_TYPE",Array.isArray(a)?"array":a,n)}}else{const o=xe(e,t,a,r,n);l(s.sortableProperties,o.sortableProperties),s.sorts={...s.sorts,...o.sorts},s.sortablePropertiesWithTypes={...s.sortablePropertiesWithTypes,...o.sortablePropertiesWithTypes}}}return s}function Le(e,t,n,r){return!1!==r?.enabled?xe(e,t,n,(r||{}).unsortableProperties||[],""):{disabled:!0}}function Ce(e,t,n,r){if(!e.enabled)return;e.isSorted=!1;const o=k(e.sharedInternalDocumentStore,n),s=e.sorts[t];s.orderedDocsToRemove.has(o)&&Je(e,t),s.docs.set(o,s.orderedDocs.length),s.orderedDocs.push([o,r])}function Ue(e){if(e.isSorted||!e.enabled)return;const t=Object.keys(e.sorts);for(const n of t)Ve(e,n);e.isSorted=!0}function Be(t,r,o){return r[1].localeCompare(o[1],function(t){return void 0!==t&&n.includes(t)?e[t]:void 0}(t))}function Fe(e,t){return e[1]-t[1]}function We(e,t){return t[1]?-1:1}function Ve(e,t){const n=e.sorts[t];let r;switch(n.type){case"string":r=Be.bind(null,e.language);break;case"number":r=Fe.bind(null);break;case"boolean":r=We.bind(null)}n.orderedDocs.sort(r);const o=n.orderedDocs.length;for(let e=0;e<o;e++){const t=n.orderedDocs[e][0];n.docs.set(t,e)}}function Je(e,t){const n=e.sorts[t];n.orderedDocsToRemove.size&&(n.orderedDocs=n.orderedDocs.filter((e=>!n.orderedDocsToRemove.has(e[0]))),n.orderedDocsToRemove.clear())}function $e(e,t,n){if(!e.enabled)return;const r=e.sorts[t],o=k(e.sharedInternalDocumentStore,n);r.docs.get(o)&&(r.docs.delete(o),r.orderedDocsToRemove.set(o,!0))}function je(e,t,n){if(!e.enabled)throw S("SORT_DISABLED");const r=n.property,o="DESC"===n.order,s=e.sorts[r];if(!s)throw S("UNABLE_TO_SORT_ON_UNKNOWN_FIELD",r,e.sortableProperties.join(", "));return Je(e,r),Ue(e),t.sort(((t,n)=>{const r=s.docs.get(k(e.sharedInternalDocumentStore,t[0])),i=s.docs.get(k(e.sharedInternalDocumentStore,n[0])),a=void 0!==r,c=void 0!==i;return a||c?a?c?o?i-r:r-i:-1:1:0})),t}function Ye(e){return e.enabled?e.sortableProperties:[]}function Ge(e){return e.enabled?e.sortablePropertiesWithTypes:{}}function He(e,t){const n=t;if(!n.enabled)return{enabled:!1};const r=Object.keys(n.sorts).reduce(((e,t)=>{const{docs:r,orderedDocs:o,type:s}=n.sorts[t];return e[t]={docs:new Map(Object.entries(r).map((([e,t])=>[+e,t]))),orderedDocsToRemove:new Map,orderedDocs:o,type:s},e}),{});return{sharedInternalDocumentStore:e,language:n.language,sortableProperties:n.sortableProperties,sortablePropertiesWithTypes:n.sortablePropertiesWithTypes,sorts:r,enabled:!0,isSorted:n.isSorted}}function Ke(e){if(!e.enabled)return{enabled:!1};!function(e){const t=Object.keys(e.sorts);for(const n of t)Je(e,n)}(e),Ue(e);const t=Object.keys(e.sorts).reduce(((t,n)=>{const{docs:r,orderedDocs:o,type:s}=e.sorts[n];return t[n]={docs:Object.fromEntries(r.entries()),orderedDocs:o,type:s},t}),{});return{language:e.language,sortableProperties:e.sortableProperties,sortablePropertiesWithTypes:e.sortablePropertiesWithTypes,sorts:t,enabled:e.enabled,isSorted:e.isSorted}}var qe=Object.freeze({__proto__:null,load:He,save:Ke,createSorter:function(){return{create:Le,insert:Ce,remove:$e,save:Ke,load:He,sortBy:je,getSortableProperties:Ye,getSortablePropertiesWithTypes:Ge}}});export{V as documentsStore,b as formatElapsedTime,I as getDocumentIndexId,d as getDocumentProperties,v as getInnerType,A as getVectorSize,Ie as index,R as internalDocumentIDStore,D as isArrayType,N as isGeoPointType,w as isVectorType,qe as sorter,ze as tokenizer,T as validateSchema};export default null;

Check warning

Code scanning / CodeQL

Overly permissive regular expression range Medium

Suspicious character range that overlaps with \u03b1-\u03c9 in the same character class.

Copilot Autofix

AI about 1 month ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

@@ -0,0 +1 @@
!function(){"use strict";var t,e,a,n={667:function(t,e){e.q=void 0,e.q="3.2.2"},376:function(t,e,a){var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.UnicodeConfiguration=e.UnicodeMethods=void 0;var o=a(251),i=n(a(402)),r=a(871),u=n(a(398)),l=n(a(748)),c=a(992);e.UnicodeMethods={};var p={};e.UnicodeMethods.Unicode=function(t,e){var a=t.GetBrackets(e),n=null,o=null;a&&(a.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)?(n=a.replace(/ /g,"").split(/,/),o=t.GetBrackets(e)):o=a);var r=u.default.trimSpaces(t.GetArgument(e)).replace(/^0x/,"x");if(!r.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/))throw new i.default("BadUnicode","Argument to \\unicode must be a number");var d=parseInt(r.match(/^x/)?"0"+r:r);p[d]?o||(o=p[d][2]):p[d]=[800,200,o,d],n&&(p[d][0]=Math.floor(1e3*parseFloat(n[0])),p[d][1]=Math.floor(1e3*parseFloat(n[1])));var M=t.stack.env.font,s={};o?(p[d][2]=s.fontfamily=o.replace(/'/g,"'"),M&&(M.match(/bold/)&&(s.fontweight="bold"),M.match(/italic|-mathit/)&&(s.fontstyle="italic"))):M&&(s.mathvariant=M);var x=t.create("token","mtext",s,(0,c.numeric)(r));l.default.setProperty(x,"unicode",!0),t.Push(x)},new r.CommandMap("unicode",{unicode:"Unicode"},e.UnicodeMethods),e.UnicodeConfiguration=o.Configuration.create("unicode",{handler:{macro:["unicode"]}})},955:function(t,e){MathJax._.components.global.isObject,MathJax._.components.global.combineConfig,MathJax._.components.global.combineDefaults,e.r8=MathJax._.components.global.combineWithMathJax,MathJax._.components.global.MathJax},992:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.options=MathJax._.util.Entities.options,e.entities=MathJax._.util.Entities.entities,e.add=MathJax._.util.Entities.add,e.remove=MathJax._.util.Entities.remove,e.translate=MathJax._.util.Entities.translate,e.numeric=MathJax._.util.Entities.numeric},251:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Configuration=MathJax._.input.tex.Configuration.Configuration,e.ConfigurationHandler=MathJax._.input.tex.Configuration.ConfigurationHandler,e.ParserConfiguration=MathJax._.input.tex.Configuration.ParserConfiguration},748:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=MathJax._.input.tex.NodeUtil.default},398:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=MathJax._.input.tex.ParseUtil.default},871:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseResult=MathJax._.input.tex.SymbolMap.parseResult,e.AbstractSymbolMap=MathJax._.input.tex.SymbolMap.AbstractSymbolMap,e.RegExpMap=MathJax._.input.tex.SymbolMap.RegExpMap,e.AbstractParseMap=MathJax._.input.tex.SymbolMap.AbstractParseMap,e.CharacterMap=MathJax._.input.tex.SymbolMap.CharacterMap,e.DelimiterMap=MathJax._.input.tex.SymbolMap.DelimiterMap,e.MacroMap=MathJax._.input.tex.SymbolMap.MacroMap,e.CommandMap=MathJax._.input.tex.SymbolMap.CommandMap,e.EnvironmentMap=MathJax._.input.tex.SymbolMap.EnvironmentMap},402:function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=MathJax._.input.tex.TexError.default}},o={};function i(t){var e=o[t];if(void 0!==e)return e.exports;var a=o[t]={exports:{}};return n[t].call(a.exports,a,a.exports,i),a.exports}t=i(955),e=i(667),a=i(376),MathJax.loader&&MathJax.loader.checkVersion("[tex]/unicode",e.q,"tex-extension"),(0,t.r8)({_:{input:{tex:{unicode:{UnicodeConfiguration:a}}}}})}();

Check warning

Code scanning / CodeQL

Replacement of a substring with itself Medium

This replaces ''' with itself.

Copilot Autofix

AI about 1 month ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

@briangann briangann moved this from 💡 Ideation to 🧑‍💻 In development in Plugins Platform / Grafana Community Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 🧑‍💻 In development

Development

Successfully merging this pull request may close these issues.

1 participant