avo 2.6.0 → 2.6.1.pre.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/Gemfile.lock +5 -1
- data/app/assets/builds/action_cable.js +2 -0
- data/app/assets/builds/action_cable.js.map +7 -0
- data/app/assets/builds/avo.css +9614 -0
- data/app/assets/builds/avo.js +512 -0
- data/app/assets/builds/avo.js.map +7 -0
- data/app/components/avo/fields/belongs_to_field/autocomplete_component.html.erb +2 -0
- data/app/components/avo/paginator_component.html.erb +2 -2
- data/app/components/avo/sidebar_component.html.erb +1 -1
- data/app/controllers/avo/search_controller.rb +11 -4
- data/app/javascript/js/controllers/search_controller.js +7 -1
- data/app/views/avo/partials/_global_search.html.erb +1 -1
- data/app/views/avo/partials/_resource_search.html.erb +1 -1
- data/lib/avo/hosts/association_scope_host.rb +1 -0
- data/lib/avo/hosts/base_host.rb +2 -0
- data/lib/avo/version.rb +1 -1
- data/public/avo-assets/avo.css +4 -8
- data/public/avo-assets/avo.js +1 -1
- data/public/avo-assets/avo.js.map +2 -2
- metadata +9 -4
@@ -7,6 +7,8 @@
|
|
7
7
|
data-via-association-id="<%= @field.id %>"
|
8
8
|
data-via-reflection-id="<%= @field.model.id %>"
|
9
9
|
data-via-reflection-class="<%= @field.model.class.to_s %>"
|
10
|
+
data-via-parent-resource-id="<%= params[:via_resource_id] %>"
|
11
|
+
data-via-parent-resource-class="<%= params[:via_relation_class] %>"
|
10
12
|
></div>
|
11
13
|
<div class="relative w-full" autocomplete="off">
|
12
14
|
<%= @form.text_field @foreign_key,
|
@@ -25,9 +25,9 @@
|
|
25
25
|
</div>
|
26
26
|
<% per_page_options.each do |option| %>
|
27
27
|
<% if parent_model.present? %>
|
28
|
-
<%= link_to "Change to #{option} items per page", helpers.related_resources_path(parent_model, parent_model, per_page: option, keep_query_params: true), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
28
|
+
<%= link_to "Change to #{option} items per page", helpers.related_resources_path(parent_model, parent_model, per_page: option, keep_query_params: true, page: 1), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
29
29
|
<% else %>
|
30
|
-
<%= link_to "Change to #{option} items per page", helpers.resources_path(resource: resource, per_page: option, keep_query_params: true), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
30
|
+
<%= link_to "Change to #{option} items per page", helpers.resources_path(resource: resource, per_page: option, keep_query_params: true, page: 1), class: 'hidden', 'data-per-page-option': option, 'data-turbo-frame': turbo_frame %>
|
31
31
|
<% end %>
|
32
32
|
<% end %>
|
33
33
|
</div>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div
|
2
|
-
class="fixed z-[60] t-0 application-sidebar hidden lg:flex flex-1 border-r lg:border-none bg-none
|
2
|
+
class="fixed z-[60] t-0 application-sidebar w-64 hidden lg:flex flex-1 border-r lg:border-none bg-none h-[calc(100vh-4rem)] bg-gray-25 lg:bg-transparent <%= 'print:hidden' if Avo.configuration.hide_layout_when_printing %>"
|
3
3
|
data-mobile-target="sidebar"
|
4
4
|
>
|
5
5
|
<div class="flex flex-col w-full h-full">
|
@@ -47,16 +47,23 @@ module Avo
|
|
47
47
|
query = resource.search_query.call(params: params).limit(8)
|
48
48
|
|
49
49
|
# Figure oute if this is a belongs_to search
|
50
|
-
if params[:via_reflection_class].present?
|
50
|
+
if params[:via_reflection_class].present?
|
51
51
|
# Fetch the field
|
52
52
|
field = belongs_to_field
|
53
53
|
|
54
54
|
if field.attach_scope.present?
|
55
|
-
#
|
56
|
-
|
55
|
+
# Try to fetch the parent.
|
56
|
+
if params[:via_reflection_id].present?
|
57
|
+
parent = params[:via_reflection_class].safe_constantize.find params[:via_reflection_id]
|
58
|
+
end
|
59
|
+
|
60
|
+
# Try to fetch the grandparent for the new views where the parent is nil.
|
61
|
+
if params[:via_parent_resource_id].present? && params[:via_parent_resource_class].present?
|
62
|
+
grandparent = params[:via_parent_resource_class].safe_constantize.find params[:via_parent_resource_id]
|
63
|
+
end
|
57
64
|
|
58
65
|
# Add to the query
|
59
|
-
query = Avo::Hosts::AssociationScopeHost.new(block: belongs_to_field.attach_scope, query: query, parent: parent).handle
|
66
|
+
query = Avo::Hosts::AssociationScopeHost.new(block: belongs_to_field.attach_scope, query: query, parent: parent, grandparent: grandparent).handle
|
60
67
|
end
|
61
68
|
end
|
62
69
|
|
@@ -76,6 +76,10 @@ export default class extends Controller {
|
|
76
76
|
via_reflection_class: this.dataset.viaReflectionClass,
|
77
77
|
// eslint-disable-next-line camelcase
|
78
78
|
via_reflection_id: this.dataset.viaReflectionId,
|
79
|
+
// eslint-disable-next-line camelcase
|
80
|
+
via_parent_resource_id: this.dataset.viaParentResourceId,
|
81
|
+
// eslint-disable-next-line camelcase
|
82
|
+
via_parent_resource_class: this.dataset.viaParentResourceClass,
|
79
83
|
}
|
80
84
|
}
|
81
85
|
|
@@ -193,7 +197,7 @@ export default class extends Controller {
|
|
193
197
|
Mousetrap.bind(['command+k', 'ctrl+k'], () => this.showSearchPanel())
|
194
198
|
}
|
195
199
|
|
196
|
-
autocomplete({
|
200
|
+
const { destroy } = autocomplete({
|
197
201
|
container: this.autocompleteTarget,
|
198
202
|
placeholder: this.translationKeys.placeholder,
|
199
203
|
translations: {
|
@@ -216,6 +220,8 @@ export default class extends Controller {
|
|
216
220
|
},
|
217
221
|
})
|
218
222
|
|
223
|
+
document.addEventListener('turbo:before-render', destroy)
|
224
|
+
|
219
225
|
// When using search for belongs-to
|
220
226
|
if (this.buttonTarget.dataset.shouldBeDisabled !== 'true') {
|
221
227
|
this.buttonTarget.removeAttribute('disabled')
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div data-controller="search" class="relative flex global-search rounded border border-gray-200 sm:min-w-[16rem]"
|
1
|
+
<div data-controller="search" class="relative flex global-search rounded border border-gray-200 sm:min-w-[16rem]">
|
2
2
|
<div class="flex-1 text-gray-500"
|
3
3
|
data-search-target="autocomplete"
|
4
4
|
data-search-resource="global"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<div data-controller="search" class="resource-search flex items-center h-full w-full"
|
1
|
+
<div data-controller="search" class="resource-search flex items-center h-full w-full">
|
2
2
|
<div class="w-full"
|
3
3
|
data-search-target="autocomplete"
|
4
4
|
data-search-resource="<%= resource %>"
|
data/lib/avo/hosts/base_host.rb
CHANGED
data/lib/avo/version.rb
CHANGED
data/public/avo-assets/avo.css
CHANGED
@@ -7277,14 +7277,14 @@ progress[value]::-moz-progress-bar{
|
|
7277
7277
|
width:4rem
|
7278
7278
|
}
|
7279
7279
|
|
7280
|
-
.w-10{
|
7281
|
-
width:2.5rem
|
7282
|
-
}
|
7283
|
-
|
7284
7280
|
.w-64{
|
7285
7281
|
width:16rem
|
7286
7282
|
}
|
7287
7283
|
|
7284
|
+
.w-10{
|
7285
|
+
width:2.5rem
|
7286
|
+
}
|
7287
|
+
|
7288
7288
|
.w-\[1\%\]{
|
7289
7289
|
width:1%
|
7290
7290
|
}
|
@@ -7297,10 +7297,6 @@ progress[value]::-moz-progress-bar{
|
|
7297
7297
|
min-width:300px
|
7298
7298
|
}
|
7299
7299
|
|
7300
|
-
.min-w-\[16rem\]{
|
7301
|
-
min-width:16rem
|
7302
|
-
}
|
7303
|
-
|
7304
7300
|
.min-w-full{
|
7305
7301
|
min-width:100%
|
7306
7302
|
}
|
data/public/avo-assets/avo.js
CHANGED
@@ -123,7 +123,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
123
123
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WXe(r,e){if(!!r){if(typeof r=="string")return CF(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return CF(r,e)}}function UXe(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function VXe(r){if(Array.isArray(r))return CF(r)}function CF(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Pse(r){var e=r.createElement,t=r.Fragment;return function(i){var o=i.hit,a=i.attribute,s=i.tagName,u=s===void 0?"mark":s;return e.apply(void 0,[t,{}].concat(zXe(_E({hit:o,attribute:a}).map(function(c,f){return c.isHighlighted?e(u,{key:f},c.value):c.value}))))}}var Lse=se(()=>{xm()});function $Xe(r){return XXe(r)||GXe(r)||KXe(r)||YXe()}function YXe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
124
124
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function KXe(r,e){if(!!r){if(typeof r=="string")return AF(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return AF(r,e)}}function GXe(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function XXe(r){if(Array.isArray(r))return AF(r)}function AF(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Rse(r){var e=r.createElement,t=r.Fragment;return function(i){var o=i.hit,a=i.attribute,s=i.tagName,u=s===void 0?"mark":s;return e.apply(void 0,[t,{}].concat($Xe(mse({hit:o,attribute:a}).map(function(c,f){return c.isHighlighted?e(u,{key:f},c.value):c.value}))))}}var qse=se(()=>{xm()});function QXe(r){return tQe(r)||eQe(r)||JXe(r)||ZXe()}function ZXe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
125
125
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JXe(r,e){if(!!r){if(typeof r=="string")return TF(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return TF(r,e)}}function eQe(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function tQe(r){if(Array.isArray(r))return TF(r)}function TF(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Fse(r){var e=r.createElement,t=r.Fragment;return function(i){var o=i.hit,a=i.attribute,s=i.tagName,u=s===void 0?"mark":s;return e.apply(void 0,[t,{}].concat(QXe(yse({hit:o,attribute:a}).map(function(c,f){return c.isHighlighted?e(u,{key:f},c.value):c.value}))))}}var Nse=se(()=>{xm()});function rQe(r){return aQe(r)||oQe(r)||iQe(r)||nQe()}function nQe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
126
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iQe(r,e){if(!!r){if(typeof r=="string")return DF(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return DF(r,e)}}function oQe(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function aQe(r){if(Array.isArray(r))return DF(r)}function DF(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Bse(r){var e=r.createElement,t=r.Fragment;return function(i){var o=i.hit,a=i.attribute,s=i.tagName,u=s===void 0?"mark":s;return e.apply(void 0,[t,{}].concat(rQe(EE({hit:o,attribute:a}).map(function(c,f){return c.isHighlighted?e(u,{key:f},c.value):c.value}))))}}var jse=se(()=>{xm()});var zse=se(()=>{Lse();qse();Nse();jse()});function Hse(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function TE(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hse(Object(t),!0).forEach(function(n){sQe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Hse(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sQe(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lQe(r,e){if(r==null)return{};var t=uQe(r,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(r,n)||(t[n]=r[n]))}return t}function uQe(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,o;for(o=0;o<n.length;o++)i=n[o],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Wse(r){var e,t=r.classNames,n=r.container,i=r.getEnvironmentProps,o=r.getFormProps,a=r.getInputProps,s=r.getItemProps,u=r.getLabelProps,c=r.getListProps,f=r.getPanelProps,p=r.getRootProps,g=r.panelContainer,m=r.panelPlacement,x=r.render,w=r.renderNoResults,T=r.renderer,k=r.detachedMediaQuery,A=r.components,D=lQe(r,["classNames","container","getEnvironmentProps","getFormProps","getInputProps","getItemProps","getLabelProps","getListProps","getPanelProps","getRootProps","panelContainer","panelPlacement","render","renderNoResults","renderer","detachedMediaQuery","components"]),M=iF(n);M.tagName;var L=typeof window<"u"?window:{},_=T??dQe,C={Highlight:Pse(_),ReverseHighlight:Rse(_),ReverseSnippet:Fse(_),Snippet:Bse(_)};return{renderer:{classNames:Eae(cQe,t??{}),container:M,getEnvironmentProps:i??function(O){var F=O.props;return F},getFormProps:o??function(O){var F=O.props;return F},getInputProps:a??function(O){var F=O.props;return F},getItemProps:s??function(O){var F=O.props;return F},getLabelProps:u??function(O){var F=O.props;return F},getListProps:c??function(O){var F=O.props;return F},getPanelProps:f??function(O){var F=O.props;return F},getRootProps:p??function(O){var F=O.props;return F},panelContainer:g?iF(g):document.body,panelPlacement:m??"input-wrapper-width",render:x??fQe,renderNoResults:w,renderer:_,detachedMediaQuery:k??getComputedStyle(L.document.documentElement).getPropertyValue("--aa-detached-media-query"),components:TE(TE({},C),A)},core:TE(TE({},D),{},{id:(e=D.id)!==null&&e!==void 0?e:sE(),environment:L})}}var cQe,fQe,dQe,Use=se(()=>{yh();cse();zse();ym();cQe={clearButton:"aa-ClearButton",detachedCancelButton:"aa-DetachedCancelButton",detachedContainer:"aa-DetachedContainer",detachedFormContainer:"aa-DetachedFormContainer",detachedOverlay:"aa-DetachedOverlay",detachedSearchButton:"aa-DetachedSearchButton",detachedSearchButtonIcon:"aa-DetachedSearchButtonIcon",detachedSearchButtonPlaceholder:"aa-DetachedSearchButtonPlaceholder",form:"aa-Form",input:"aa-Input",inputWrapper:"aa-InputWrapper",inputWrapperPrefix:"aa-InputWrapperPrefix",inputWrapperSuffix:"aa-InputWrapperSuffix",item:"aa-Item",label:"aa-Label",list:"aa-List",loadingIndicator:"aa-LoadingIndicator",panel:"aa-Panel",panelLayout:"aa-PanelLayout",root:"aa-Autocomplete",source:"aa-Source",sourceFooter:"aa-SourceFooter",sourceHeader:"aa-SourceHeader",sourceNoResults:"aa-SourceNoResults",submitButton:"aa-SubmitButton"},fQe=function(e,t){var n=e.children;use(n,t)},dQe={createElement:hF,Fragment:bm}});function Vse(r){var e=r.panelPlacement,t=r.container,n=r.form,i=r.environment,o=t.getBoundingClientRect(),a=o.top+o.height;switch(e){case"start":return{top:a,left:o.left};case"end":return{top:a,right:i.document.documentElement.clientWidth-(o.left+o.width)};case"full-width":return{top:a,left:0,right:0,width:"unset",maxWidth:"unset"};case"input-wrapper-width":{var s=n.getBoundingClientRect();return{top:a,left:s.left,right:i.document.documentElement.clientWidth-(s.left+s.width),width:"unset",maxWidth:"unset"}}default:throw new Error("[Autocomplete] The `panelPlacement` value ".concat(JSON.stringify(e)," is not valid."))}}var $se=se(()=>{});function DE(){return DE=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},DE.apply(this,arguments)}function Yse(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function OE(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yse(Object(t),!0).forEach(function(n){hQe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Yse(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hQe(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kse(r){var e=r.autocomplete,t=r.autocompleteScopeApi,n=r.dom,i=r.propGetters,o=r.state;sF(n.root,i.getRootProps(OE({state:o,props:e.getRootProps({})},t))),sF(n.input,i.getInputProps(OE({state:o,props:e.getInputProps({inputElement:n.input}),inputElement:n.input},t))),is(n.label,{hidden:o.status==="stalled"}),is(n.loadingIndicator,{hidden:o.status!=="stalled"}),is(n.clearButton,{hidden:!o.query})}function Gse(r,e){var t=e.autocomplete,n=e.autocompleteScopeApi,i=e.classNames,o=e.createElement,a=e.dom,s=e.Fragment,u=e.panelContainer,c=e.propGetters,f=e.state,p=e.components;if(!f.isOpen){u.contains(a.panel)&&u.removeChild(a.panel);return}!u.contains(a.panel)&&f.status!=="loading"&&u.appendChild(a.panel),a.panel.classList.toggle("aa-Panel--stalled",f.status==="stalled");var g=f.collections.map(function(w,T){var k=w.source,A=w.items;return o("section",{key:T,className:i.source,"data-autocomplete-source-id":k.sourceId},k.templates.header&&o("div",{className:i.sourceHeader},k.templates.header({components:p,createElement:o,Fragment:s,items:A,source:k,state:f})),A.length===0&&k.templates.noResults&&f.query?o("div",{className:i.sourceNoResults},k.templates.noResults({components:p,createElement:o,Fragment:s,source:k,state:f})):o("ul",DE({className:i.list},c.getListProps(OE({state:f,props:t.getListProps({})},n))),A.map(function(D){var M=t.getItemProps({item:D,source:k});return o("li",DE({key:M.id,className:i.item},c.getItemProps(OE({state:f,props:M},n))),k.templates.item({components:p,createElement:o,Fragment:s,item:D,state:f}))})),k.templates.footer&&o("div",{className:i.sourceFooter},k.templates.footer({components:p,createElement:o,Fragment:s,items:A,source:k,state:f})))}),m=o(s,null,o("div",{className:"aa-PanelLayout aa-Panel--scrollable"},g),o("div",{className:"aa-GradientBottom"})),x=g.reduce(function(w,T){return w[T.props["data-autocomplete-source-id"]]=T,w},{});r({children:m,state:f,sections:g,elements:x,createElement:o,Fragment:s,components:p},a.panel)}var Xse=se(()=>{ym()});function Qse(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qse(Object(t),!0).forEach(function(n){Zse(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qse(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Zse(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jse(r){var e=Vae(),t=e.runEffect,n=e.cleanupEffects,i=e.runEffects,o=Yae(),a=o.reactive,s=o.runReactives,u=y0(!1),c=y0(r),f=y0(void 0),p=a(function(){return Wse(c.current)}),g=a(function(){return p.value.core.environment.matchMedia(p.value.renderer.detachedMediaQuery).matches}),m=a(function(){return sae(xh(xh({},p.value.core),{},{onStateChange:function(C){var O,F,B;u.current=C.state.collections.some(function(V){return V.source.templates.noResults}),(O=f.current)===null||O===void 0||O.call(f,C),(F=(B=p.value.core).onStateChange)===null||F===void 0||F.call(B,C)},shouldPanelOpen:c.current.shouldPanelOpen||function(_){var C=_.state,O=Of(C)>0;if(!p.value.core.openOnFocus&&!C.query)return O;var F=Boolean(u.current||p.value.renderer.renderNoResults);return!O&&F||O}}))}),x=y0(xh({collections:[],completion:null,context:{},isOpen:!1,query:"",activeItemId:null,status:"idle"},p.value.core.initialState)),w={getEnvironmentProps:p.value.renderer.getEnvironmentProps,getFormProps:p.value.renderer.getFormProps,getInputProps:p.value.renderer.getInputProps,getItemProps:p.value.renderer.getItemProps,getLabelProps:p.value.renderer.getLabelProps,getListProps:p.value.renderer.getListProps,getPanelProps:p.value.renderer.getPanelProps,getRootProps:p.value.renderer.getRootProps},T={setActiveItemId:m.value.setActiveItemId,setQuery:m.value.setQuery,setCollections:m.value.setCollections,setIsOpen:m.value.setIsOpen,setStatus:m.value.setStatus,setContext:m.value.setContext,refresh:m.value.refresh},k=a(function(){return Wae({autocomplete:m.value,autocompleteScopeApi:T,classNames:p.value.renderer.classNames,isDetached:g.value,placeholder:p.value.core.placeholder,propGetters:w,state:x.current})});function A(){is(k.value.panel,{style:g.value?{}:Vse({panelPlacement:p.value.renderer.panelPlacement,container:k.value.root,form:k.value.form,environment:p.value.core.environment})})}function D(_){x.current=_;var C={autocomplete:m.value,autocompleteScopeApi:T,classNames:p.value.renderer.classNames,components:p.value.renderer.components,container:p.value.renderer.container,createElement:p.value.renderer.renderer.createElement,dom:k.value,Fragment:p.value.renderer.renderer.Fragment,panelContainer:g.value?k.value.detachedContainer:p.value.renderer.panelContainer,propGetters:w,state:x.current},O=!Of(_)&&!u.current&&p.value.renderer.renderNoResults||p.value.renderer.render;Kse(C),Gse(O,C)}t(function(){var _=m.value.getEnvironmentProps({formElement:k.value.form,panelElement:k.value.panel,inputElement:k.value.input});return is(p.value.core.environment,_),function(){is(p.value.core.environment,Object.keys(_).reduce(function(C,O){return xh(xh({},C),{},Zse({},O,void 0))},{}))}}),t(function(){var _=g.value?p.value.core.environment.document.body:p.value.renderer.panelContainer,C=g.value?k.value.detachedOverlay:k.value.panel;return g.value&&x.current.isOpen&&k.value.openDetachedOverlay(),D(x.current),function(){_.contains(C)&&_.removeChild(C)}}),t(function(){var _=p.value.renderer.container;return _.appendChild(k.value.root),function(){_.removeChild(k.value.root)}}),t(function(){var _=Xq(function(C){var O=C.state;D(O)},0);return f.current=function(C){var O=C.state,F=C.prevState;if(O.isOpen&&!F.isOpen&&A(),O.query!==F.query){var B=document.querySelectorAll(".aa-Panel--scrollable");B.forEach(function(V){V.scrollTop!==0&&(V.scrollTop=0)})}_({state:O})},function(){f.current=void 0}}),t(function(){var _=Xq(function(){var C=g.value;g.value=p.value.core.environment.matchMedia(p.value.renderer.detachedMediaQuery).matches,C!==g.value?L({}):requestAnimationFrame(A)},20);return p.value.core.environment.addEventListener("resize",_),function(){p.value.core.environment.removeEventListener("resize",_)}}),t(function(){if(!g.value)return function(){};function _(F){k.value.detachedContainer.classList.toggle("aa-DetachedContainer--modal",F)}function C(F){_(F.matches)}var O=p.value.core.environment.matchMedia(getComputedStyle(p.value.core.environment.document.documentElement).getPropertyValue("--aa-detached-modal-media-query"));return _(O.matches),O.addEventListener("change",C),function(){O.removeEventListener("change",C)}}),t(function(){return requestAnimationFrame(A),function(){}});function M(){n()}function L(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n(),c.current=aF(p.value.renderer,p.value.core,{initialState:x.current},_),s(),i(),m.value.refresh().then(function(){D(x.current)})}return xh(xh({},T),{},{update:L,destroy:M})}var ele=se(()=>{Sae();yh();Uae();$ae();Kae();Use();$se();Xse();ym()});var tle,rle=se(()=>{tle="1.0.0-alpha.46"});function nle(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ile(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?nle(Object(t),!0).forEach(function(n){pQe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):nle(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pQe(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var ole,ale=se(()=>{xm();rle();ole=CE(function(r){return AE(ile(ile({},r),{},{userAgents:[{segment:"autocomplete-js",version:tle}]}))})});var sle=se(()=>{});var BEt,lle=se(()=>{ale();BEt=ole({transformResponse:function(e){return e.hits}})});var ule=se(()=>{sle();lle()});var cle=se(()=>{});var fle=se(()=>{});var dle=se(()=>{});var hle=se(()=>{});var ple=se(()=>{});var gle=se(()=>{});var mle=se(()=>{});var vle=se(()=>{});var yle=se(()=>{});var ble=se(()=>{});var xle=se(()=>{});var wle=se(()=>{});var _le=se(()=>{});var Sle=se(()=>{cle();fle();dle();hle();ple();gle();mle();vle();yle();ble();xle();wle();_le()});var kle=se(()=>{ele();ule();Sle()});var Ele,Cle=se(()=>{Ele=(r,e)=>{let t;return(...n)=>(t&&clearTimeout(t),new Promise(i=>{t=setTimeout(()=>i(r(...n)),e)}))}});var Ale,Tle,ME,Dle=se(()=>{Ale=Zr(tP());nn();wP();kle();Tle=Zr(S1());Cle();ME=class extends Ot{constructor(){super(...arguments);Tt(this,"debouncedFetch",Ele(fetch,this.searchDebounce))}get dataset(){return this.autocompleteTarget.dataset}get searchDebounce(){return window.Avo.configuration.search_debounce}get translationKeys(){let r;try{r=JSON.parse(this.dataset.translationKeys)}catch(e){r={}}return r}get isBelongsToSearch(){return this.dataset.viaAssociation==="belongs_to"}get isGlobalSearch(){return this.dataset.searchResource==="global"}searchUrl(r){let e=(0,Tle.default)(),t={q:r},n=[window.Avo.configuration.root_path,"avo_api",this.dataset.searchResource,"search"];return this.isGlobalSearch&&(n=[window.Avo.configuration.root_path,"avo_api","search"]),this.isBelongsToSearch&&(t=hp(Bc({},t),{via_association_id:this.dataset.viaAssociationId,via_reflection_class:this.dataset.viaReflectionClass,via_reflection_id:this.dataset.viaReflectionId})),e.segment(n).search(t).toString()}handleOnSelect({item:r}){this.isBelongsToSearch?(this.hiddenIdTarget.setAttribute("value",r._id),this.buttonTarget.setAttribute("value",r._label),document.querySelector(".aa-DetachedOverlay").remove(),this.hasClearButtonTarget&&this.clearButtonTarget.classList.remove("hidden")):Vd.visit(r._url,{action:"advance"}),document.body.classList.remove("aa-Detached")}addSource(r,e){let t=this;return{sourceId:r,getItems:()=>e.results,onSelect:t.handleOnSelect.bind(t),templates:{header(){return`${e.header.toUpperCase()} ${e.help}`},item({item:n,createElement:i}){let o=[];if(n._avatar){let s;switch(n._avatar_type){default:case"circle":s="rounded-full";break;case"rounded":s="rounded";break}o.push(i("img",{src:n._avatar,alt:n._label,class:`flex-shrink-0 w-8 h-8 my-[2px] inline mr-2 ${s}`}))}let a=[n._label];return n._description&&a.push(i("div",{class:"aa-ItemDescription"},n._description)),o.push(i("div",null,a)),i("div",{class:"flex"},o)},noResults(){return t.translationKeys.no_item_found.replace("%{item}",r)}}}}showSearchPanel(){this.autocompleteTarget.querySelector("button").click()}clearValue(){this.clearValueTargets.map(r=>r.setAttribute("value","")),this.clearButtonTarget.classList.add("hidden")}connect(){let r=this;this.buttonTarget.onclick=()=>this.showSearchPanel(),this.clearValueTargets.forEach(e=>{e.getAttribute("value")&&this.hasClearButtonTarget&&this.clearButtonTarget.classList.remove("hidden")}),this.isGlobalSearch&&Ale.bind(["command+k","ctrl+k"],()=>this.showSearchPanel()),Jse({container:this.autocompleteTarget,placeholder:this.translationKeys.placeholder,translations:{detachedCancelButtonText:this.translationKeys.cancel_button},openOnFocus:!0,detachedMediaQuery:"",getSources:({query:e})=>{document.body.classList.add("search-loading");let t=r.searchUrl(e);return r.debouncedFetch(t).then(n=>(document.body.classList.remove("search-loading"),n.json())).then(n=>Object.keys(n).map(i=>r.addSource(i,n[i])))}}),this.buttonTarget.dataset.shouldBeDisabled!=="true"&&this.buttonTarget.removeAttribute("disabled")}};Tt(ME,"targets",["autocomplete","button","hiddenId","visibleLabel","clearValue","clearButton"])});var Ole,IE,Mle=se(()=>{nn();Ole=Zr(S1()),IE=class extends Ot{get parentTurboFrame(){return this.context.scope.element.closest("turbo-frame")}onChange(r){if(!this.parentTurboFrame.src)return;let e=new Ole.default(this.parentTurboFrame.src);e.search(hp(Bc({},e.query(!0)),{range:r.currentTarget.value})),this.parentTurboFrame.src=e.toString(),this.parentTurboFrame.reload()}};Tt(IE,"targets",["select"])});var PE,Ile=se(()=>{em();PE=class extends Ca{getFilterValue(){return this.selectorTarget.value===""?null:this.selectorTarget.value}getFilterClass(){let{filterClass:r}=this.selectorTarget.dataset;return r}};Tt(PE,"targets",["selector"])});var Rle=Z((Ple,Lle)=>{(function(r){typeof Ple=="object"&&typeof Lle=="object"?r(Nr()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";var e=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,n=/[*+-]\s/;r.commands.newlineAndIndentContinueMarkdownList=function(o){if(o.getOption("disableInput"))return r.Pass;for(var a=o.listSelections(),s=[],u=0;u<a.length;u++){var c=a[u].head,f=o.getStateAfter(c.line),p=r.innerMode(o.getMode(),f);if(p.mode.name!=="markdown"){o.execCommand("newlineAndIndent");return}else f=p.state;var g=f.list!==!1,m=f.quote!==0,x=o.getLine(c.line),w=e.exec(x),T=/^\s*$/.test(x.slice(0,c.ch));if(!a[u].empty()||!g&&!m||!w||T){o.execCommand("newlineAndIndent");return}if(t.test(x)){var k=m&&/>\s*$/.test(x),A=!/>\s*$/.test(x);(k||A)&&o.replaceRange("",{line:c.line,ch:0},{line:c.line,ch:c.ch+1}),s[u]=`
|
126
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iQe(r,e){if(!!r){if(typeof r=="string")return DF(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return DF(r,e)}}function oQe(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function aQe(r){if(Array.isArray(r))return DF(r)}function DF(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Bse(r){var e=r.createElement,t=r.Fragment;return function(i){var o=i.hit,a=i.attribute,s=i.tagName,u=s===void 0?"mark":s;return e.apply(void 0,[t,{}].concat(rQe(EE({hit:o,attribute:a}).map(function(c,f){return c.isHighlighted?e(u,{key:f},c.value):c.value}))))}}var jse=se(()=>{xm()});var zse=se(()=>{Lse();qse();Nse();jse()});function Hse(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function TE(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hse(Object(t),!0).forEach(function(n){sQe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Hse(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function sQe(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function lQe(r,e){if(r==null)return{};var t=uQe(r,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(i=0;i<o.length;i++)n=o[i],!(e.indexOf(n)>=0)&&(!Object.prototype.propertyIsEnumerable.call(r,n)||(t[n]=r[n]))}return t}function uQe(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,o;for(o=0;o<n.length;o++)i=n[o],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}function Wse(r){var e,t=r.classNames,n=r.container,i=r.getEnvironmentProps,o=r.getFormProps,a=r.getInputProps,s=r.getItemProps,u=r.getLabelProps,c=r.getListProps,f=r.getPanelProps,p=r.getRootProps,g=r.panelContainer,m=r.panelPlacement,x=r.render,w=r.renderNoResults,T=r.renderer,k=r.detachedMediaQuery,A=r.components,D=lQe(r,["classNames","container","getEnvironmentProps","getFormProps","getInputProps","getItemProps","getLabelProps","getListProps","getPanelProps","getRootProps","panelContainer","panelPlacement","render","renderNoResults","renderer","detachedMediaQuery","components"]),M=iF(n);M.tagName;var L=typeof window<"u"?window:{},_=T??dQe,C={Highlight:Pse(_),ReverseHighlight:Rse(_),ReverseSnippet:Fse(_),Snippet:Bse(_)};return{renderer:{classNames:Eae(cQe,t??{}),container:M,getEnvironmentProps:i??function(O){var F=O.props;return F},getFormProps:o??function(O){var F=O.props;return F},getInputProps:a??function(O){var F=O.props;return F},getItemProps:s??function(O){var F=O.props;return F},getLabelProps:u??function(O){var F=O.props;return F},getListProps:c??function(O){var F=O.props;return F},getPanelProps:f??function(O){var F=O.props;return F},getRootProps:p??function(O){var F=O.props;return F},panelContainer:g?iF(g):document.body,panelPlacement:m??"input-wrapper-width",render:x??fQe,renderNoResults:w,renderer:_,detachedMediaQuery:k??getComputedStyle(L.document.documentElement).getPropertyValue("--aa-detached-media-query"),components:TE(TE({},C),A)},core:TE(TE({},D),{},{id:(e=D.id)!==null&&e!==void 0?e:sE(),environment:L})}}var cQe,fQe,dQe,Use=se(()=>{yh();cse();zse();ym();cQe={clearButton:"aa-ClearButton",detachedCancelButton:"aa-DetachedCancelButton",detachedContainer:"aa-DetachedContainer",detachedFormContainer:"aa-DetachedFormContainer",detachedOverlay:"aa-DetachedOverlay",detachedSearchButton:"aa-DetachedSearchButton",detachedSearchButtonIcon:"aa-DetachedSearchButtonIcon",detachedSearchButtonPlaceholder:"aa-DetachedSearchButtonPlaceholder",form:"aa-Form",input:"aa-Input",inputWrapper:"aa-InputWrapper",inputWrapperPrefix:"aa-InputWrapperPrefix",inputWrapperSuffix:"aa-InputWrapperSuffix",item:"aa-Item",label:"aa-Label",list:"aa-List",loadingIndicator:"aa-LoadingIndicator",panel:"aa-Panel",panelLayout:"aa-PanelLayout",root:"aa-Autocomplete",source:"aa-Source",sourceFooter:"aa-SourceFooter",sourceHeader:"aa-SourceHeader",sourceNoResults:"aa-SourceNoResults",submitButton:"aa-SubmitButton"},fQe=function(e,t){var n=e.children;use(n,t)},dQe={createElement:hF,Fragment:bm}});function Vse(r){var e=r.panelPlacement,t=r.container,n=r.form,i=r.environment,o=t.getBoundingClientRect(),a=o.top+o.height;switch(e){case"start":return{top:a,left:o.left};case"end":return{top:a,right:i.document.documentElement.clientWidth-(o.left+o.width)};case"full-width":return{top:a,left:0,right:0,width:"unset",maxWidth:"unset"};case"input-wrapper-width":{var s=n.getBoundingClientRect();return{top:a,left:s.left,right:i.document.documentElement.clientWidth-(s.left+s.width),width:"unset",maxWidth:"unset"}}default:throw new Error("[Autocomplete] The `panelPlacement` value ".concat(JSON.stringify(e)," is not valid."))}}var $se=se(()=>{});function DE(){return DE=Object.assign||function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},DE.apply(this,arguments)}function Yse(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function OE(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yse(Object(t),!0).forEach(function(n){hQe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Yse(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hQe(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Kse(r){var e=r.autocomplete,t=r.autocompleteScopeApi,n=r.dom,i=r.propGetters,o=r.state;sF(n.root,i.getRootProps(OE({state:o,props:e.getRootProps({})},t))),sF(n.input,i.getInputProps(OE({state:o,props:e.getInputProps({inputElement:n.input}),inputElement:n.input},t))),is(n.label,{hidden:o.status==="stalled"}),is(n.loadingIndicator,{hidden:o.status!=="stalled"}),is(n.clearButton,{hidden:!o.query})}function Gse(r,e){var t=e.autocomplete,n=e.autocompleteScopeApi,i=e.classNames,o=e.createElement,a=e.dom,s=e.Fragment,u=e.panelContainer,c=e.propGetters,f=e.state,p=e.components;if(!f.isOpen){u.contains(a.panel)&&u.removeChild(a.panel);return}!u.contains(a.panel)&&f.status!=="loading"&&u.appendChild(a.panel),a.panel.classList.toggle("aa-Panel--stalled",f.status==="stalled");var g=f.collections.map(function(w,T){var k=w.source,A=w.items;return o("section",{key:T,className:i.source,"data-autocomplete-source-id":k.sourceId},k.templates.header&&o("div",{className:i.sourceHeader},k.templates.header({components:p,createElement:o,Fragment:s,items:A,source:k,state:f})),A.length===0&&k.templates.noResults&&f.query?o("div",{className:i.sourceNoResults},k.templates.noResults({components:p,createElement:o,Fragment:s,source:k,state:f})):o("ul",DE({className:i.list},c.getListProps(OE({state:f,props:t.getListProps({})},n))),A.map(function(D){var M=t.getItemProps({item:D,source:k});return o("li",DE({key:M.id,className:i.item},c.getItemProps(OE({state:f,props:M},n))),k.templates.item({components:p,createElement:o,Fragment:s,item:D,state:f}))})),k.templates.footer&&o("div",{className:i.sourceFooter},k.templates.footer({components:p,createElement:o,Fragment:s,items:A,source:k,state:f})))}),m=o(s,null,o("div",{className:"aa-PanelLayout aa-Panel--scrollable"},g),o("div",{className:"aa-GradientBottom"})),x=g.reduce(function(w,T){return w[T.props["data-autocomplete-source-id"]]=T,w},{});r({children:m,state:f,sections:g,elements:x,createElement:o,Fragment:s,components:p},a.panel)}var Xse=se(()=>{ym()});function Qse(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function xh(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Qse(Object(t),!0).forEach(function(n){Zse(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Qse(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Zse(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Jse(r){var e=Vae(),t=e.runEffect,n=e.cleanupEffects,i=e.runEffects,o=Yae(),a=o.reactive,s=o.runReactives,u=y0(!1),c=y0(r),f=y0(void 0),p=a(function(){return Wse(c.current)}),g=a(function(){return p.value.core.environment.matchMedia(p.value.renderer.detachedMediaQuery).matches}),m=a(function(){return sae(xh(xh({},p.value.core),{},{onStateChange:function(C){var O,F,B;u.current=C.state.collections.some(function(V){return V.source.templates.noResults}),(O=f.current)===null||O===void 0||O.call(f,C),(F=(B=p.value.core).onStateChange)===null||F===void 0||F.call(B,C)},shouldPanelOpen:c.current.shouldPanelOpen||function(_){var C=_.state,O=Of(C)>0;if(!p.value.core.openOnFocus&&!C.query)return O;var F=Boolean(u.current||p.value.renderer.renderNoResults);return!O&&F||O}}))}),x=y0(xh({collections:[],completion:null,context:{},isOpen:!1,query:"",activeItemId:null,status:"idle"},p.value.core.initialState)),w={getEnvironmentProps:p.value.renderer.getEnvironmentProps,getFormProps:p.value.renderer.getFormProps,getInputProps:p.value.renderer.getInputProps,getItemProps:p.value.renderer.getItemProps,getLabelProps:p.value.renderer.getLabelProps,getListProps:p.value.renderer.getListProps,getPanelProps:p.value.renderer.getPanelProps,getRootProps:p.value.renderer.getRootProps},T={setActiveItemId:m.value.setActiveItemId,setQuery:m.value.setQuery,setCollections:m.value.setCollections,setIsOpen:m.value.setIsOpen,setStatus:m.value.setStatus,setContext:m.value.setContext,refresh:m.value.refresh},k=a(function(){return Wae({autocomplete:m.value,autocompleteScopeApi:T,classNames:p.value.renderer.classNames,isDetached:g.value,placeholder:p.value.core.placeholder,propGetters:w,state:x.current})});function A(){is(k.value.panel,{style:g.value?{}:Vse({panelPlacement:p.value.renderer.panelPlacement,container:k.value.root,form:k.value.form,environment:p.value.core.environment})})}function D(_){x.current=_;var C={autocomplete:m.value,autocompleteScopeApi:T,classNames:p.value.renderer.classNames,components:p.value.renderer.components,container:p.value.renderer.container,createElement:p.value.renderer.renderer.createElement,dom:k.value,Fragment:p.value.renderer.renderer.Fragment,panelContainer:g.value?k.value.detachedContainer:p.value.renderer.panelContainer,propGetters:w,state:x.current},O=!Of(_)&&!u.current&&p.value.renderer.renderNoResults||p.value.renderer.render;Kse(C),Gse(O,C)}t(function(){var _=m.value.getEnvironmentProps({formElement:k.value.form,panelElement:k.value.panel,inputElement:k.value.input});return is(p.value.core.environment,_),function(){is(p.value.core.environment,Object.keys(_).reduce(function(C,O){return xh(xh({},C),{},Zse({},O,void 0))},{}))}}),t(function(){var _=g.value?p.value.core.environment.document.body:p.value.renderer.panelContainer,C=g.value?k.value.detachedOverlay:k.value.panel;return g.value&&x.current.isOpen&&k.value.openDetachedOverlay(),D(x.current),function(){_.contains(C)&&_.removeChild(C)}}),t(function(){var _=p.value.renderer.container;return _.appendChild(k.value.root),function(){_.removeChild(k.value.root)}}),t(function(){var _=Xq(function(C){var O=C.state;D(O)},0);return f.current=function(C){var O=C.state,F=C.prevState;if(O.isOpen&&!F.isOpen&&A(),O.query!==F.query){var B=document.querySelectorAll(".aa-Panel--scrollable");B.forEach(function(V){V.scrollTop!==0&&(V.scrollTop=0)})}_({state:O})},function(){f.current=void 0}}),t(function(){var _=Xq(function(){var C=g.value;g.value=p.value.core.environment.matchMedia(p.value.renderer.detachedMediaQuery).matches,C!==g.value?L({}):requestAnimationFrame(A)},20);return p.value.core.environment.addEventListener("resize",_),function(){p.value.core.environment.removeEventListener("resize",_)}}),t(function(){if(!g.value)return function(){};function _(F){k.value.detachedContainer.classList.toggle("aa-DetachedContainer--modal",F)}function C(F){_(F.matches)}var O=p.value.core.environment.matchMedia(getComputedStyle(p.value.core.environment.document.documentElement).getPropertyValue("--aa-detached-modal-media-query"));return _(O.matches),O.addEventListener("change",C),function(){O.removeEventListener("change",C)}}),t(function(){return requestAnimationFrame(A),function(){}});function M(){n()}function L(){var _=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};n(),c.current=aF(p.value.renderer,p.value.core,{initialState:x.current},_),s(),i(),m.value.refresh().then(function(){D(x.current)})}return xh(xh({},T),{},{update:L,destroy:M})}var ele=se(()=>{Sae();yh();Uae();$ae();Kae();Use();$se();Xse();ym()});var tle,rle=se(()=>{tle="1.0.0-alpha.46"});function nle(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function ile(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?nle(Object(t),!0).forEach(function(n){pQe(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):nle(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pQe(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var ole,ale=se(()=>{xm();rle();ole=CE(function(r){return AE(ile(ile({},r),{},{userAgents:[{segment:"autocomplete-js",version:tle}]}))})});var sle=se(()=>{});var BEt,lle=se(()=>{ale();BEt=ole({transformResponse:function(e){return e.hits}})});var ule=se(()=>{sle();lle()});var cle=se(()=>{});var fle=se(()=>{});var dle=se(()=>{});var hle=se(()=>{});var ple=se(()=>{});var gle=se(()=>{});var mle=se(()=>{});var vle=se(()=>{});var yle=se(()=>{});var ble=se(()=>{});var xle=se(()=>{});var wle=se(()=>{});var _le=se(()=>{});var Sle=se(()=>{cle();fle();dle();hle();ple();gle();mle();vle();yle();ble();xle();wle();_le()});var kle=se(()=>{ele();ule();Sle()});var Ele,Cle=se(()=>{Ele=(r,e)=>{let t;return(...n)=>(t&&clearTimeout(t),new Promise(i=>{t=setTimeout(()=>i(r(...n)),e)}))}});var Ale,Tle,ME,Dle=se(()=>{Ale=Zr(tP());nn();wP();kle();Tle=Zr(S1());Cle();ME=class extends Ot{constructor(){super(...arguments);Tt(this,"debouncedFetch",Ele(fetch,this.searchDebounce))}get dataset(){return this.autocompleteTarget.dataset}get searchDebounce(){return window.Avo.configuration.search_debounce}get translationKeys(){let r;try{r=JSON.parse(this.dataset.translationKeys)}catch(e){r={}}return r}get isBelongsToSearch(){return this.dataset.viaAssociation==="belongs_to"}get isGlobalSearch(){return this.dataset.searchResource==="global"}searchUrl(r){let e=(0,Tle.default)(),t={q:r},n=[window.Avo.configuration.root_path,"avo_api",this.dataset.searchResource,"search"];return this.isGlobalSearch&&(n=[window.Avo.configuration.root_path,"avo_api","search"]),this.isBelongsToSearch&&(t=hp(Bc({},t),{via_association_id:this.dataset.viaAssociationId,via_reflection_class:this.dataset.viaReflectionClass,via_reflection_id:this.dataset.viaReflectionId,via_parent_resource_id:this.dataset.viaParentResourceId,via_parent_resource_class:this.dataset.viaParentResourceClass})),e.segment(n).search(t).toString()}handleOnSelect({item:r}){this.isBelongsToSearch?(this.hiddenIdTarget.setAttribute("value",r._id),this.buttonTarget.setAttribute("value",r._label),document.querySelector(".aa-DetachedOverlay").remove(),this.hasClearButtonTarget&&this.clearButtonTarget.classList.remove("hidden")):Vd.visit(r._url,{action:"advance"}),document.body.classList.remove("aa-Detached")}addSource(r,e){let t=this;return{sourceId:r,getItems:()=>e.results,onSelect:t.handleOnSelect.bind(t),templates:{header(){return`${e.header.toUpperCase()} ${e.help}`},item({item:n,createElement:i}){let o=[];if(n._avatar){let s;switch(n._avatar_type){default:case"circle":s="rounded-full";break;case"rounded":s="rounded";break}o.push(i("img",{src:n._avatar,alt:n._label,class:`flex-shrink-0 w-8 h-8 my-[2px] inline mr-2 ${s}`}))}let a=[n._label];return n._description&&a.push(i("div",{class:"aa-ItemDescription"},n._description)),o.push(i("div",null,a)),i("div",{class:"flex"},o)},noResults(){return t.translationKeys.no_item_found.replace("%{item}",r)}}}}showSearchPanel(){this.autocompleteTarget.querySelector("button").click()}clearValue(){this.clearValueTargets.map(r=>r.setAttribute("value","")),this.clearButtonTarget.classList.add("hidden")}connect(){let r=this;this.buttonTarget.onclick=()=>this.showSearchPanel(),this.clearValueTargets.forEach(t=>{t.getAttribute("value")&&this.hasClearButtonTarget&&this.clearButtonTarget.classList.remove("hidden")}),this.isGlobalSearch&&Ale.bind(["command+k","ctrl+k"],()=>this.showSearchPanel());let{destroy:e}=Jse({container:this.autocompleteTarget,placeholder:this.translationKeys.placeholder,translations:{detachedCancelButtonText:this.translationKeys.cancel_button},openOnFocus:!0,detachedMediaQuery:"",getSources:({query:t})=>{document.body.classList.add("search-loading");let n=r.searchUrl(t);return r.debouncedFetch(n).then(i=>(document.body.classList.remove("search-loading"),i.json())).then(i=>Object.keys(i).map(o=>r.addSource(o,i[o])))}});document.addEventListener("turbo:before-render",e),this.buttonTarget.dataset.shouldBeDisabled!=="true"&&this.buttonTarget.removeAttribute("disabled")}};Tt(ME,"targets",["autocomplete","button","hiddenId","visibleLabel","clearValue","clearButton"])});var Ole,IE,Mle=se(()=>{nn();Ole=Zr(S1()),IE=class extends Ot{get parentTurboFrame(){return this.context.scope.element.closest("turbo-frame")}onChange(r){if(!this.parentTurboFrame.src)return;let e=new Ole.default(this.parentTurboFrame.src);e.search(hp(Bc({},e.query(!0)),{range:r.currentTarget.value})),this.parentTurboFrame.src=e.toString(),this.parentTurboFrame.reload()}};Tt(IE,"targets",["select"])});var PE,Ile=se(()=>{em();PE=class extends Ca{getFilterValue(){return this.selectorTarget.value===""?null:this.selectorTarget.value}getFilterClass(){let{filterClass:r}=this.selectorTarget.dataset;return r}};Tt(PE,"targets",["selector"])});var Rle=Z((Ple,Lle)=>{(function(r){typeof Ple=="object"&&typeof Lle=="object"?r(Nr()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";var e=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,n=/[*+-]\s/;r.commands.newlineAndIndentContinueMarkdownList=function(o){if(o.getOption("disableInput"))return r.Pass;for(var a=o.listSelections(),s=[],u=0;u<a.length;u++){var c=a[u].head,f=o.getStateAfter(c.line),p=r.innerMode(o.getMode(),f);if(p.mode.name!=="markdown"){o.execCommand("newlineAndIndent");return}else f=p.state;var g=f.list!==!1,m=f.quote!==0,x=o.getLine(c.line),w=e.exec(x),T=/^\s*$/.test(x.slice(0,c.ch));if(!a[u].empty()||!g&&!m||!w||T){o.execCommand("newlineAndIndent");return}if(t.test(x)){var k=m&&/>\s*$/.test(x),A=!/>\s*$/.test(x);(k||A)&&o.replaceRange("",{line:c.line,ch:0},{line:c.line,ch:c.ch+1}),s[u]=`
|
127
127
|
`}else{var D=w[1],M=w[5],L=!(n.test(w[2])||w[2].indexOf(">")>=0),_=L?parseInt(w[3],10)+1+w[4]:w[2].replace("x"," ");s[u]=`
|
128
128
|
`+D+_+M,L&&i(o,c)}}o.replaceSelections(s)};function i(o,a){var s=a.line,u=0,c=0,f=e.exec(o.getLine(s)),p=f[1];do{u+=1;var g=s+u,m=o.getLine(g),x=e.exec(m);if(x){var w=x[1],T=parseInt(f[3],10)+u-c,k=parseInt(x[3],10),A=k;if(p===w&&!isNaN(k))T===k&&(A=k+1),T>k&&(A=T+1),o.replaceRange(m.replace(e,w+A+x[4]+x[5]),{line:g,ch:0},{line:g,ch:m.length});else{if(p.length>w.length||p.length<w.length&&u===1)return;c+=1}}}while(x)}})});var Fle=Z(()=>{var qle=Nr();qle.commands.tabAndIndentMarkdownList=function(r){var e=r.listSelections(),t=e[0].head,n=r.getStateAfter(t.line),i=n.list!==!1;if(i){r.execCommand("indentMore");return}if(r.options.indentWithTabs)r.execCommand("insertTab");else{var o=Array(r.options.tabSize+1).join(" ");r.replaceSelection(o)}};qle.commands.shiftTabAndUnindentMarkdownList=function(r){var e=r.listSelections(),t=e[0].head,n=r.getStateAfter(t.line),i=n.list!==!1;if(i){r.execCommand("indentLess");return}if(r.options.indentWithTabs)r.execCommand("insertTab");else{var o=Array(r.options.tabSize+1).join(" ");r.replaceSelection(o)}}});var jle=Z((Nle,Ble)=>{(function(r){typeof Nle=="object"&&typeof Ble=="object"?r(Nr()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";r.defineOption("fullScreen",!1,function(n,i,o){o==r.Init&&(o=!1),!o!=!i&&(i?e(n):t(n))});function e(n){var i=n.getWrapperElement();n.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:i.style.width,height:i.style.height},i.style.width="",i.style.height="auto",i.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",n.refresh()}function t(n){var i=n.getWrapperElement();i.className=i.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var o=n.state.fullScreenRestore;i.style.width=o.width,i.style.height=o.height,window.scrollTo(o.scrollLeft,o.scrollTop),n.refresh()}})});var Wle=Z((zle,Hle)=>{(function(r){typeof zle=="object"&&typeof Hle=="object"?r(Nr()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){r.defineOption("placeholder","",function(s,u,c){var f=c&&c!=r.Init;if(u&&!f)s.on("blur",i),s.on("change",o),s.on("swapDoc",o),r.on(s.getInputField(),"compositionupdate",s.state.placeholderCompose=function(){n(s)}),o(s);else if(!u&&f){s.off("blur",i),s.off("change",o),s.off("swapDoc",o),r.off(s.getInputField(),"compositionupdate",s.state.placeholderCompose),e(s);var p=s.getWrapperElement();p.className=p.className.replace(" CodeMirror-empty","")}u&&!s.hasFocus()&&i(s)});function e(s){s.state.placeholder&&(s.state.placeholder.parentNode.removeChild(s.state.placeholder),s.state.placeholder=null)}function t(s){e(s);var u=s.state.placeholder=document.createElement("pre");u.style.cssText="height: 0; overflow: visible",u.style.direction=s.getOption("direction"),u.className="CodeMirror-placeholder CodeMirror-line-like";var c=s.getOption("placeholder");typeof c=="string"&&(c=document.createTextNode(c)),u.appendChild(c),s.display.lineSpace.insertBefore(u,s.display.lineSpace.firstChild)}function n(s){setTimeout(function(){var u=!1;if(s.lineCount()==1){var c=s.getInputField();u=c.nodeName=="TEXTAREA"?!s.getLine(0).length:!/[^\u200b]/.test(c.querySelector(".CodeMirror-line").textContent)}u?t(s):e(s)},20)}function i(s){a(s)&&t(s)}function o(s){var u=s.getWrapperElement(),c=a(s);u.className=u.className.replace(" CodeMirror-empty","")+(c?" CodeMirror-empty":""),c?t(s):e(s)}function a(s){return s.lineCount()===1&&s.getLine(0)===""}})});var $le=Z((Ule,Vle)=>{(function(r){typeof Ule=="object"&&typeof Vle=="object"?r(Nr()):typeof define=="function"&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)})(function(r){"use strict";r.defineOption("styleSelectedText",!1,function(f,p,g){var m=g&&g!=r.Init;p&&!m?(f.state.markedSelection=[],f.state.markedSelectionStyle=typeof p=="string"?p:"CodeMirror-selectedtext",u(f),f.on("cursorActivity",e),f.on("change",t)):!p&&m&&(f.off("cursorActivity",e),f.off("change",t),s(f),f.state.markedSelection=f.state.markedSelectionStyle=null)});function e(f){f.state.markedSelection&&f.operation(function(){c(f)})}function t(f){f.state.markedSelection&&f.state.markedSelection.length&&f.operation(function(){s(f)})}var n=8,i=r.Pos,o=r.cmpPos;function a(f,p,g,m){if(o(p,g)!=0)for(var x=f.state.markedSelection,w=f.state.markedSelectionStyle,T=p.line;;){var k=T==p.line?p:i(T,0),A=T+n,D=A>=g.line,M=D?g:i(A,0),L=f.markText(k,M,{className:w});if(m==null?x.push(L):x.splice(m++,0,L),D)break;T=A}}function s(f){for(var p=f.state.markedSelection,g=0;g<p.length;++g)p[g].clear();p.length=0}function u(f){s(f);for(var p=f.listSelections(),g=0;g<p.length;g++)a(f,p[g].from(),p[g].to())}function c(f){if(!f.somethingSelected())return s(f);if(f.listSelections().length>1)return u(f);var p=f.getCursor("start"),g=f.getCursor("end"),m=f.state.markedSelection;if(!m.length)return a(f,p,g);var x=m[0].find(),w=m[m.length-1].find();if(!x||!w||g.line-p.line<=n||o(p,w.to)>=0||o(g,x.from)<=0)return u(f);for(;o(p,x.from)>0;)m.shift().clear(),x=m[0].find();for(o(p,x.from)<0&&(x.to.line-p.line<n?(m.shift().clear(),a(f,p,x.to,0)):a(f,p,x.from,0));o(g,w.to)<0;)m.pop().clear(),w=m[m.length-1].find();o(g,w.to)>0&&(g.line-w.from.line<n?(m.pop().clear(),a(f,w.from,g)):a(f,w.to,g))}})});var Gle=Z((Yle,Kle)=>{(function(r){typeof Yle=="object"&&typeof Kle=="object"?r(Nr(),C1(),A1()):typeof define=="function"&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],r):r(CodeMirror)})(function(r){"use strict";var e=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;r.defineMode("gfm",function(t,n){var i=0;function o(c){return c.code=!1,null}var a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(c){return{code:c.code,codeBlock:c.codeBlock,ateSpace:c.ateSpace}},token:function(c,f){if(f.combineTokens=null,f.codeBlock)return c.match(/^```+/)?(f.codeBlock=!1,null):(c.skipToEnd(),null);if(c.sol()&&(f.code=!1),c.sol()&&c.match(/^```+/))return c.skipToEnd(),f.codeBlock=!0,null;if(c.peek()==="`"){c.next();var p=c.pos;c.eatWhile("`");var g=1+c.pos-p;return f.code?g===i&&(f.code=!1):(i=g,f.code=!0),null}else if(f.code)return c.next(),null;if(c.eatSpace())return f.ateSpace=!0,null;if((c.sol()||f.ateSpace)&&(f.ateSpace=!1,n.gitHubSpice!==!1)){if(c.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/))return f.combineTokens=!0,"link";if(c.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return f.combineTokens=!0,"link"}return c.match(e)&&c.string.slice(c.start-2,c.start)!="]("&&(c.start==0||/\W/.test(c.string.charAt(c.start-1)))?(f.combineTokens=!0,"link"):(c.next(),null)},blankLine:o},s={taskLists:!0,strikethrough:!0,emoji:!0};for(var u in n)s[u]=n[u];return s.name="markdown",r.overlayMode(r.getMode(t,s),a)},"markdown"),r.defineMIME("text/x-gfm","gfm")})});var Xle=Z(()=>{});var Qle=Z((kCt,MF)=>{var OF;(function(){"use strict";OF=function(r,e,t,n){n=n||{},this.dictionary=null,this.rules={},this.dictionaryTable={},this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=n.flags||{},this.memoized={},this.loaded=!1;var i=this,o,a,s,u,c;r&&(i.dictionary=r,e&&t?m():typeof window<"u"&&"chrome"in window&&"extension"in window.chrome&&"getURL"in window.chrome.extension?(n.dictionaryPath?o=n.dictionaryPath:o="typo/dictionaries",e||f(chrome.extension.getURL(o+"/"+r+"/"+r+".aff"),p),t||f(chrome.extension.getURL(o+"/"+r+"/"+r+".dic"),g)):(n.dictionaryPath?o=n.dictionaryPath:typeof __dirname<"u"?o=__dirname+"/dictionaries":o="./dictionaries",e||f(o+"/"+r+"/"+r+".aff",p),t||f(o+"/"+r+"/"+r+".dic",g)));function f(x,w){var T=i._readFile(x,null,n.asyncLoad);n.asyncLoad?T.then(function(k){w(k)}):w(T)}function p(x){e=x,t&&m()}function g(x){t=x,e&&m()}function m(){for(i.rules=i._parseAFF(e),i.compoundRuleCodes={},a=0,u=i.compoundRules.length;a<u;a++){var x=i.compoundRules[a];for(s=0,c=x.length;s<c;s++)i.compoundRuleCodes[x[s]]=[]}"ONLYINCOMPOUND"in i.flags&&(i.compoundRuleCodes[i.flags.ONLYINCOMPOUND]=[]),i.dictionaryTable=i._parseDIC(t);for(a in i.compoundRuleCodes)i.compoundRuleCodes[a].length===0&&delete i.compoundRuleCodes[a];for(a=0,u=i.compoundRules.length;a<u;a++){var w=i.compoundRules[a],T="";for(s=0,c=w.length;s<c;s++){var k=w[s];k in i.compoundRuleCodes?T+="("+i.compoundRuleCodes[k].join("|")+")":T+=k}i.compoundRules[a]=new RegExp(T,"i")}i.loaded=!0,n.asyncLoad&&n.loadedCallback&&n.loadedCallback(i)}return this},OF.prototype={load:function(r){for(var e in r)r.hasOwnProperty(e)&&(this[e]=r[e]);return this},_readFile:function(r,e,t){if(e=e||"utf8",typeof XMLHttpRequest<"u"){var n,i=new XMLHttpRequest;return i.open("GET",r,t),t&&(n=new Promise(function(a,s){i.onload=function(){i.status===200?a(i.responseText):s(i.statusText)},i.onerror=function(){s(i.statusText)}})),i.overrideMimeType&&i.overrideMimeType("text/plain; charset="+e),i.send(null),t?n:i.responseText}else if(typeof AN<"u"){var o=Xle();try{if(o.existsSync(r))return o.readFileSync(r,e);console.log("Path "+r+" does not exist.")}catch(a){return console.log(a),""}}},_parseAFF:function(r){var e={},t,n,i,o,a,s,u,c;r=this._removeAffixComments(r);var f=r.split(/\r?\n/);for(a=0,u=f.length;a<u;a++){t=f[a];var p=t.split(/\s+/),g=p[0];if(g=="PFX"||g=="SFX"){var m=p[1],x=p[2];i=parseInt(p[3],10);var w=[];for(s=a+1,c=a+1+i;s<c;s++){n=f[s],o=n.split(/\s+/);var T=o[2],k=o[3].split("/"),A=k[0];A==="0"&&(A="");var D=this.parseRuleCodes(k[1]),M=o[4],L={};L.add=A,D.length>0&&(L.continuationClasses=D),M!=="."&&(g==="SFX"?L.match=new RegExp(M+"$"):L.match=new RegExp("^"+M)),T!="0"&&(g==="SFX"?L.remove=new RegExp(T+"$"):L.remove=T),w.push(L)}e[m]={type:g,combineable:x=="Y",entries:w},a+=i}else if(g==="COMPOUNDRULE"){for(i=parseInt(p[1],10),s=a+1,c=a+1+i;s<c;s++)t=f[s],o=t.split(/\s+/),this.compoundRules.push(o[1]);a+=i}else g==="REP"?(o=t.split(/\s+/),o.length===3&&this.replacementTable.push([o[1],o[2]])):this.flags[g]=p[1]}return e},_removeAffixComments:function(r){return r=r.replace(/^\s*#.*$/mg,""),r=r.replace(/^\s\s*/m,"").replace(/\s\s*$/m,""),r=r.replace(/\n{2,}/g,`
|
129
129
|
`),r=r.replace(/^\s\s*/,"").replace(/\s\s*$/,""),r},_parseDIC:function(r){r=this._removeDicComments(r);var e=r.split(/\r?\n/),t={};function n(F,B){t.hasOwnProperty(F)||(t[F]=null),B.length>0&&(t[F]===null&&(t[F]=[]),t[F].push(B))}for(var i=1,o=e.length;i<o;i++){var a=e[i];if(!!a){var s=a.split("/",2),u=s[0];if(s.length>1){var c=this.parseRuleCodes(s[1]);(!("NEEDAFFIX"in this.flags)||c.indexOf(this.flags.NEEDAFFIX)==-1)&&n(u,c);for(var f=0,p=c.length;f<p;f++){var g=c[f],m=this.rules[g];if(m)for(var x=this._applyRule(u,m),w=0,T=x.length;w<T;w++){var k=x[w];if(n(k,[]),m.combineable)for(var A=f+1;A<p;A++){var D=c[A],M=this.rules[D];if(M&&M.combineable&&m.type!=M.type)for(var L=this._applyRule(k,M),_=0,C=L.length;_<C;_++){var O=L[_];n(O,[])}}}g in this.compoundRuleCodes&&this.compoundRuleCodes[g].push(u)}}else n(u.trim(),[])}}return t},_removeDicComments:function(r){return r=r.replace(/^\t.*$/mg,""),r},parseRuleCodes:function(r){if(r)if("FLAG"in this.flags){if(this.flags.FLAG==="long"){for(var e=[],t=0,n=r.length;t<n;t+=2)e.push(r.substr(t,2));return e}else if(this.flags.FLAG==="num")return r.split(",")}else return r.split("");else return[]},_applyRule:function(r,e){for(var t=e.entries,n=[],i=0,o=t.length;i<o;i++){var a=t[i];if(!a.match||r.match(a.match)){var s=r;if(a.remove&&(s=s.replace(a.remove,"")),e.type==="SFX"?s=s+a.add:s=a.add+s,n.push(s),"continuationClasses"in a)for(var u=0,c=a.continuationClasses.length;u<c;u++){var f=this.rules[a.continuationClasses[u]];f&&(n=n.concat(this._applyRule(s,f)))}}}return n},check:function(r){if(!this.loaded)throw"Dictionary not loaded.";var e=r.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(e))return!0;if(e.toUpperCase()===e){var t=e[0]+e.substring(1).toLowerCase();if(this.hasFlag(t,"KEEPCASE"))return!1;if(this.checkExact(t)||this.checkExact(e.toLowerCase()))return!0}var n=e[0].toLowerCase()+e.substring(1);if(n!==e){if(this.hasFlag(n,"KEEPCASE"))return!1;if(this.checkExact(n))return!0}return!1},checkExact:function(r){if(!this.loaded)throw"Dictionary not loaded.";var e=this.dictionaryTable[r],t,n;if(typeof e>"u"){if("COMPOUNDMIN"in this.flags&&r.length>=this.flags.COMPOUNDMIN){for(t=0,n=this.compoundRules.length;t<n;t++)if(r.match(this.compoundRules[t]))return!0}}else{if(e===null)return!0;if(typeof e=="object"){for(t=0,n=e.length;t<n;t++)if(!this.hasFlag(r,"ONLYINCOMPOUND",e[t]))return!0}}return!1},hasFlag:function(r,e,t){if(!this.loaded)throw"Dictionary not loaded.";return!!(e in this.flags&&(typeof t>"u"&&(t=Array.prototype.concat.apply([],this.dictionaryTable[r])),t&&t.indexOf(this.flags[e])!==-1))},alphabet:"",suggest:function(r,e){if(!this.loaded)throw"Dictionary not loaded.";if(e=e||5,this.memoized.hasOwnProperty(r)){var t=this.memoized[r].limit;if(e<=t||this.memoized[r].suggestions.length<t)return this.memoized[r].suggestions.slice(0,e)}if(this.check(r))return[];for(var n=0,i=this.replacementTable.length;n<i;n++){var o=this.replacementTable[n];if(r.indexOf(o[0])!==-1){var a=r.replace(o[0],o[1]);if(this.check(a))return[a]}}var s=this;s.alphabet="abcdefghijklmnopqrstuvwxyz";function u(f,p){var g={},m,x,w,T,k,A,D=s.alphabet.length;if(typeof f=="string"){var M=f;f={},f[M]=!0}for(var M in f)for(m=0,T=M.length+1;m<T;m++){var L=[M.substring(0,m),M.substring(m)];if(L[1]&&(A=L[0]+L[1].substring(1),(!p||s.check(A))&&(A in g?g[A]+=1:g[A]=1)),L[1].length>1&&L[1][1]!==L[1][0]&&(A=L[0]+L[1][1]+L[1][0]+L[1].substring(2),(!p||s.check(A))&&(A in g?g[A]+=1:g[A]=1)),L[1]){var _=L[1].substring(0,1).toUpperCase()===L[1].substring(0,1)?"uppercase":"lowercase";for(x=0;x<D;x++){var C=s.alphabet[x];_==="uppercase"&&(C=C.toUpperCase()),C!=L[1].substring(0,1)&&(A=L[0]+C+L[1].substring(1),(!p||s.check(A))&&(A in g?g[A]+=1:g[A]=1))}}if(L[1])for(x=0;x<D;x++){var _=L[0].substring(-1).toUpperCase()===L[0].substring(-1)&&L[1].substring(0,1).toUpperCase()===L[1].substring(0,1)?"uppercase":"lowercase",C=s.alphabet[x];_==="uppercase"&&(C=C.toUpperCase()),A=L[0]+C+L[1],(!p||s.check(A))&&(A in g?g[A]+=1:g[A]=1)}}return g}function c(f){var p=u(f),g=u(p,!0),m=g;for(var x in p)!s.check(x)||(x in m?m[x]+=p[x]:m[x]=p[x]);var w,T,k=[];for(w in m)m.hasOwnProperty(w)&&k.push([w,m[w]]);function A(_,C){var O=_[1],F=C[1];return O<F?-1:O>F?1:C[0].localeCompare(_[0])}k.sort(A).reverse();var D=[],M="lowercase";f.toUpperCase()===f?M="uppercase":f.substr(0,1).toUpperCase()+f.substr(1).toLowerCase()===f&&(M="capitalized");var L=e;for(w=0;w<Math.min(L,k.length);w++)M==="uppercase"?k[w][0]=k[w][0].toUpperCase():M==="capitalized"&&(k[w][0]=k[w][0].substr(0,1).toUpperCase()+k[w][0].substr(1)),!s.hasFlag(k[w][0],"NOSUGGEST")&&D.indexOf(k[w][0])==-1?D.push(k[w][0]):L++;return D}return this.memoized[r]={suggestions:c(r),limit:e},this.memoized[r].suggestions}}})();typeof MF<"u"&&(MF.exports=OF)});var eue=Z((ECt,Jle)=>{"use strict";var Zle=Qle();function xn(r){if(r=r||{},typeof r.codeMirrorInstance!="function"||typeof r.codeMirrorInstance.defineMode!="function"){console.log("CodeMirror Spell Checker: You must provide an instance of CodeMirror via the option `codeMirrorInstance`");return}String.prototype.includes||(String.prototype.includes=function(){"use strict";return String.prototype.indexOf.apply(this,arguments)!==-1}),r.codeMirrorInstance.defineMode("spell-checker",function(e){if(!xn.aff_loading){xn.aff_loading=!0;var t=new XMLHttpRequest;t.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.aff",!0),t.onload=function(){t.readyState===4&&t.status===200&&(xn.aff_data=t.responseText,xn.num_loaded++,xn.num_loaded==2&&(xn.typo=new Zle("en_US",xn.aff_data,xn.dic_data,{platform:"any"})))},t.send(null)}if(!xn.dic_loading){xn.dic_loading=!0;var n=new XMLHttpRequest;n.open("GET","https://cdn.jsdelivr.net/codemirror.spell-checker/latest/en_US.dic",!0),n.onload=function(){n.readyState===4&&n.status===200&&(xn.dic_data=n.responseText,xn.num_loaded++,xn.num_loaded==2&&(xn.typo=new Zle("en_US",xn.aff_data,xn.dic_data,{platform:"any"})))},n.send(null)}var i='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~ ',o={token:function(s){var u=s.peek(),c="";if(i.includes(u))return s.next(),null;for(;(u=s.peek())!=null&&!i.includes(u);)c+=u,s.next();return xn.typo&&!xn.typo.check(c)?"spell-error":null}},a=r.codeMirrorInstance.getMode(e,e.backdrop||"text/plain");return r.codeMirrorInstance.overlayMode(a,o,!0)})}xn.num_loaded=0;xn.aff_loading=!1;xn.dic_loading=!1;xn.aff_data="";xn.dic_data="";xn.typo;Jle.exports=xn});var fue=Z(wn=>{"use strict";Object.defineProperty(wn,"__esModule",{value:!0});function tue(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function gQe(r,e,t){return e&&tue(r.prototype,e),t&&tue(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}function mQe(r,e){if(!!r){if(typeof r=="string")return rue(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return rue(r,e)}}function rue(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function k0(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=mQe(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|