Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hammerstone/refine-vue2-dev

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hammerstone/refine-vue2-dev - npm Package Compare versions

Comparing version 1.0.1672751489 to 1.0.1672764386

2

dist/vue2/refine-vue.cjs.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue-demi");var t=e=>"conjunction"===(null==e?void 0:e.type),n=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(e,t,i)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,d=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&a(e,n,t[n]);if(o)for(var n of o(t))l.call(t,n)&&a(e,n,t[n]);return e},u=(e,t)=>i(e,r(t)),c=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},p=(e,t,n,i)=>{var r,o;const[s]=i||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:d({clause:null==n?void 0:n.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:c()}},f=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:c()}},h=class{constructor(e,t,n){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{n&&n([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?u(d({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||c()}):u(d({},e),{id:void 0,uid:c()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var n={};for(var i in e)s.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&o)for(var i of o(e))t.indexOf(i)<0&&l.call(e,i)&&(n[i]=e[i]);return n})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((n,i)=>{t(n)?"or"===n.word&&e.push([]):e[e.length-1].push(u(d({},n),{position:i}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let n=0;n<this.blueprint.length;n++)if(this.blueprint[n].uid===e){t=n;break}return t}replaceCriterion(e,t){const{meta:n,id:i,refinements:r}=this.findCondition(t.id),o=p(i,1,n,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:n}=this,i=n[e-1],r=n[e+1],o=t(r)&&"or"===r.word,s=t(i)&&"or"===i.word,l=o||!r,a=s||!i,d=a&&!l,u=a&&l;!i&&!r?this.blueprint=[]:u&&s?n.splice(e-1,2):u&&!i||d?n.splice(e,2):n.splice(e-1,2),this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,n=t[0],{meta:i,refinements:r}=n;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:c()}}()),e.push(p(n.id,1,i,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:n}=e,{blueprint:i}=this,r=p(t,n);return 0===i.length?i.push(r):i.splice(i.length,0,f(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:n}=this,i=n[0],{meta:r,refinements:o}=i;return t.splice(e+1,0,f(),p(i.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:n}=this.findCondition(e);let i;return n.forEach((e=>{e.id===t&&(i=e)})),i}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((n=>{n.id===e&&(t=n)})),t}switchClause({uid:e,id:t},n,i){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:n}:this.updateInput({uid:e},{clause:n},i)}switchRefinement({uid:e,id:t},n,i){const r=this.findRefinement(t,i),o=this.findCriterion(e),s=d({},o.input);delete s[n],s[i]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,n){const i=this.findCriterion(e);Object.keys(t).forEach((e=>{n?i.input[n][e]=t[e]:i.input[e]=t[e]})),this.blueprintChanged()}},m=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var n=0;n<this.options.length;n++){if(this.options[n].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.")}const i=this.options[this.options.length-1]||null,r=d({previousOption:i,nextOption:null},e);i&&(i.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((n=>{n.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const n=this.options[t];if(n.id===e)return n}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function v(e,t,n,i,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const u="function"==typeof n?n.options:n;let c;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),i&&(u._scopeId=i),o?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=c):t&&(c=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),c)if(u.functional){const e=u.render;u.render=function(t,n){return c.call(n),e(t,n)}}else{const e=u.beforeCreate;u.beforeCreate=e?[].concat(e,c):[c]}return n}const g=v({},undefined,{name:"renderless-selector",data:()=>({selector:e.reactive(new m),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i}=this;return{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i,options:this.selector.options}}},methods:{nextTick(){return e.nextTick().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:n}=this,{selectedOption:i}=t.toggleOption(e);return i?this.selectOption(e):this.deselectOption(e),n(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let t=this.$slots?.default;return e.isVue2&&(t=this.$scopedSlots?.default),t?t({actions:this.actions,...this.state}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0),y={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let b=1;var w={beforeCreate(){this.uid=b.toString(),b+=1}};const x=Symbol();function O(t,n,i=e.computed((()=>({})))){const r=e.inject(x),o=e.computed((()=>t(r)??{})),s=e.computed((()=>{const e={},t=i.value??{};let n=o.value.order;return n&&(e.order="function"==typeof n?n(t):n),e.wrap=o.value.wrap,e})),l=e.computed((()=>{const e={},t=i.value??{},n=o.value.class;n&&(e.class="function"==typeof n?n(t):n);const r=o.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return e.computed((()=>({component:o.value.component??n.value,props:l,extra:s})))}const _=e.defineComponent({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(t,n){const i=O((e=>{const n=t.component.split(".");let i=e;for(const e of n)i=i?.[e];return i}),e.computed((()=>t.as)),e.computed((()=>t.flavorOptions)));return()=>{const r=i.value,o=r.extra.value.order??t.order,s=function(e,t=[]){const n=Object.assign({},e);for(const e of t)e in n&&delete n[e];return n}(t,["as","component","order"]),l=n.slots;let a="string"==typeof r.component&&r.component.includes("-"),d=a?l:o.map((e=>l?.[e]?.())),u=e.isVue2?e.h(r.component,{scopedSlots:l,attrs:{...n.attrs,"data-flavor":t.component},props:s,on:n.listeners,...r.props.value},d):e.h(r.component,{...n.attrs,"data-flavor":t.component,...s,...r.props.value},d);return r.extra.value.wrap?r.extra.value.wrap(u):u}}});const C={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:_}};var k=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?n("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):n("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};k._withStripped=!0;const S=v({render:k,staticRenderFns:[]},undefined,C,undefined,false,undefined,!1,void 0,void 0,void 0);const $={name:"selector-listbox",mixins:[w],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:_}};var I=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[n("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};I._withStripped=!0;const R=v({render:I,staticRenderFns:[]},undefined,$,undefined,false,undefined,!1,void 0,void 0,void 0);const q={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:_}};var B=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[n("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};B._withStripped=!0;const j=v({render:B,staticRenderFns:[]},undefined,q,undefined,false,undefined,!1,void 0,void 0,void 0);const E={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:_}};var F=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var i=t.id,r=t.display;return n("refine-flavor",{key:i,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",i)}}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};F._withStripped=!0;const D=v({render:F,staticRenderFns:[]},undefined,E,undefined,false,undefined,!1,void 0,void 0,void 0);const A={name:"selector",mixins:[w],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,n){const{value:i}=n;if("function"!=typeof i)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||i()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},n=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:n,unmount:n}}},methods:{updateBuffer(e,t,n){if(!e)return;const i=t.find((t=>t.display.toLowerCase().includes(e)));i&&(n.highlightOption(i),this.scrollIntoView(i.id))},isSelected(e,t){let n=!1;return t.forEach((t=>{e.id===t.id&&(n=!0)})),n},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:n,selectOption:i,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(n(),i(e),await this.close(t))},scrollIntoView(e){if(e){this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:n}=await e();t&&this.scrollIntoView(n?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:D,RenderlessSelector:g,SelectorListItem:j,SelectorButton:S,SelectorListbox:R,RefineFlavor:_}};var V=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[n("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[n("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:i.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?n("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)},"deselect-option":function(t){return e.deselectOption(t,i)}}}):n("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)}}}),e._v(" "),n("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(i)},"highlight-previous-option":function(t){return e.highlightPreviousOption(i)},"select-option":function(t){return e.selectOption(l.id,i)},"buffer-changed":function(t){return e.updateBuffer(t,a,i)},close:function(t){return e.close(i)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return n("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return i.highlightOption(t)},mouseleave:function(e){return i.highlightOption(null)},selected:function(n){return e.selectOption(t.id,i)}}})}))}}],null,!0)})],1),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};V._withStripped=!0;const M=v({render:V,staticRenderFns:[]},undefined,A,undefined,false,undefined,!1,void 0,void 0,void 0);var P={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:n}=e,{id:i,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:i,type:r,display:o,uid:n,meta:s}}},render(){const{insertCriterion:t,addGroup:n,blueprintStore:i,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return e.isVue2&&(l=this.$scopedSlots?.default),l?l({insertCriterion:t,addGroup:n,blueprint:i,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:i.groupedBlueprint()}):null}},N={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(t,n)=>((t,n,i)=>{const r=e.inject("blueprint"),o=e.inject("builderModeActive");if(!t)throw new Error("useCondition requires an id.");if(!i)throw new Error("useCondition requires a Vue context.");if(!r)throw new Error("Conditions must be rendered within a query.");let s;s=o?r.findCriterion(n.uid):r.addCriterion({id:t,depth:0});const l=(e,t)=>r.updateInput(s,e,t),a=e=>r.switchClause(s,e);e.provide("criterion",s),e.provide("criterionMeta",n.meta),e.provide("updateInput",l),e.provide("switchRefinement",((e,t)=>{r.switchRefinement(s,e,t)})),e.provide("refinementId",null),e.onUnmounted((()=>{o||r.removeCriterion(r.indexOfCriterion(s))}));let d=null;return n?.condition?.meta?.clauses&&(d=n.condition.meta.clauses.map((e=>e.component))),()=>i.slots.default?i.slots.default({clauses:d,criterion:s,updateInput:l,switchClause:a}):null})(t.id,t,n)},T={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(t,n)=>((t,n,i)=>{const r=e.inject("criterion"),o=e.inject("updateInput"),s=e.inject("refinementId"),l=e.inject("builderModeActive"),a=e=>{o(e,s)};if(!r)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:t},s);const{clause:e,...i}=r.input;Object.keys(n).length>0&&0===Object.keys(i).length&&o({...n},s)}return e.onUnmounted((()=>{l||r.input.clause===t&&o({clause:void 0},s)})),()=>i.slots.default?i.slots.default({setValue:a,...r.input}):null})(t.clause,t,n)},z={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let t=this.$slots?.default;if(e.isVue2&&(t=this.$scopedSlots?.default),t)return t()}};const L={name:"selector-option",mixins:[y],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[y],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:n,selector:i}=this;i.registerOption({id:e,display:t||e,...this.$attrs}),n&&i.selectOption(e)},render(){const{isSelected:t}=this;let n=this.$slots?.default;return e.isVue2&&(n=this.$scopedSlots?.default),n&&t?n():null}}}};var H=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};H._withStripped=!0;const G=v({render:H,staticRenderFns:[]},undefined,L,undefined,false,undefined,!1,void 0,void 0,void 0);const Y={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:M}};var K=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};K._withStripped=!0;const U=v({render:K,staticRenderFns:[]},undefined,Y,undefined,false,undefined,!1,void 0,void 0,void 0);const Q=v({},undefined,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:t}=this;let n=this.$slots?.default;return e.isVue2&&(n=this.$scopedSlots?.default),n?n({blueprint:t}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0);const W={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,n=Number(t);isNaN(n)?this.currentValue=t:(this.currentValue=n,this.$emit("input",{value1:n}))}},components:{RefineFlavor:_}};var X=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};X._withStripped=!0;const Z=v({render:X,staticRenderFns:[]},undefined,W,undefined,false,undefined,!1,void 0,void 0,void 0);const J={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:Z,RefineFlavor:_}};var ee=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[n("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?n("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),n("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};ee._withStripped=!0;const te=v({render:ee,staticRenderFns:[]},undefined,J,undefined,false,undefined,!1,void 0,void 0,void 0);const ne={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:_}};var ie=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};ie._withStripped=!0;const re=v({render:ie,staticRenderFns:[]},undefined,ne,undefined,false,undefined,!1,void 0,void 0,void 0);const oe={setup(){var t,n;return{flavor:(t="inputs.date.pickerInput",O((e=>{const n=t.split(".");let i=e;for(const e of n)i=i?.[e];return i}),"",e.computed((()=>n)))?.value)}},props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:_}};var se=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():n("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?n("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};se._withStripped=!0;const le=v({render:se,staticRenderFns:[]},undefined,oe,undefined,false,undefined,!1,void 0,void 0,void 0);const ae={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:le},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var de=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};de._withStripped=!0;const ue=v({render:de,staticRenderFns:[]},undefined,ae,undefined,false,undefined,!1,void 0,void 0,void 0);const ce={name:"refine-double-date-input",components:{DatePicker:le,RefineFlavor:_},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var pe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[n("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),n("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),n("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};pe._withStripped=!0;const fe=v({render:pe,staticRenderFns:[]},undefined,ce,undefined,false,undefined,!1,void 0,void 0,void 0);const he={name:"refine-date-input",components:{Selector:M,SelectorOption:G,RefineFlavor:_},mixins:[w],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[n("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),n("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),n("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};me._withStripped=!0;const ve=v({render:me,staticRenderFns:[]},undefined,he,undefined,false,undefined,!1,void 0,void 0,void 0);const ge={name:"refine-option-input",components:{Selector:M,SelectorOption:G},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((n=>{n===e&&(t=!0)})),t}}};var ye=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var i=t.id,r=t.display;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.isSelected(i)}})})),1)};ye._withStripped=!0;const be=v({render:ye,staticRenderFns:[]},undefined,ge,undefined,false,undefined,!1,void 0,void 0,void 0);var we={RefineDateInput:ue,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:ve,RefineTextInput:re};const xe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:T,SelectorOption:G,Selector:M,...Object.freeze({__proto__:null,default:we,RefineDateInput:ue,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:ve,RefineTextInput:re})}};var Oe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var i=t.setValue;return[n("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return n("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?n(s,e._b({tag:"component",on:{input:i}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Oe._withStripped=!0;const _e=v({render:Oe,staticRenderFns:[]},undefined,xe,undefined,false,undefined,!1,void 0,void 0,void 0);const Ce={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:_e,RenderlessRefinement:z,Selector:M,SelectorOption:G},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var ke=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var i=t.id,r=t.meta,o=t.display;return n("selector-option",{key:i,attrs:{id:i,display:o,selected:!!e.input[i]}},[n("renderless-refinement",{attrs:{id:i}},[n("clause",{attrs:{meta:r,input:e.input[i]},on:{"switch-clause":function(t){var n=t.id;return e.updateInput({clause:n},i)}}})],1)],1)})),1)};ke._withStripped=!0;const Se={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:_e,Refinements:v({render:ke,staticRenderFns:[]},undefined,Ce,undefined,false,undefined,!1,void 0,void 0,void 0),SelectorOption:G,Selector:M,RefineFlavor:_}};var $e=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?n("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return n("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[n("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var i=t.id,r=t.display,o=t.meta,s=t.refinements;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.conditionId===i}},[n("div",[n("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?n("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[n("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};$e._withStripped=!0;const Ie={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:t=>e.isVue2?{}:{key:t},templateChildKey:t=>e.isVue2?{key:t}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(t){var n;n=t.flavor,e.provide(x,n)},components:{Criterion:v({render:$e,staticRenderFns:[]},undefined,Se,undefined,false,undefined,!1,void 0,void 0,void 0),RefineFlavor:_,RenderlessCondition:N,RenderlessQueryBuilder:P}};var Re=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===i.length?n("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[n("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):n("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(i,(function(t,s){return[n("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t){return n("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[n("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(i){var o=i.switchClause;return[n("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[n("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[n("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),n("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s+1,total:i.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),n("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Re._withStripped=!0;const qe=v({render:Re,staticRenderFns:[]},undefined,Ie,undefined,false,undefined,!1,void 0,void 0,void 0),Be="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",je="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",Ee=`${Be} ${je} w-60 pl-3 py-2`,Fe={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Be} ${je} block w-full pl-3 py-2 pr-0`},relative:{class:`${Ee} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:Ee,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ee}}},De="bg-white relative text-left cursor-default",Ae=`${De} focus:outline-none pl-3 py-1`,Ve={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${De} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ae} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ae} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ae}}};exports.ConditionSelector=U,exports.DatePickerPlugin={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},exports.Query=Q,exports.QueryBuilder=qe,exports.Selector=M,exports.SelectorOption=G,exports.linearFlavor=Ve,exports.tailwindFlavor=Fe;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue-demi");var t=e=>"conjunction"===(null==e?void 0:e.type),n=Object.defineProperty,i=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(e,t,i)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,d=(e,t)=>{for(var n in t||(t={}))s.call(t,n)&&a(e,n,t[n]);if(o)for(var n of o(t))l.call(t,n)&&a(e,n,t[n]);return e},u=(e,t)=>i(e,r(t)),c=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},p=(e,t,n,i)=>{var r,o;const[s]=i||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:d({clause:null==n?void 0:n.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:c()}},f=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:c()}},h=class{constructor(e,t,n){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{n&&n([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?u(d({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||c()}):u(d({},e),{id:void 0,uid:c()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var n={};for(var i in e)s.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&o)for(var i of o(e))t.indexOf(i)<0&&l.call(e,i)&&(n[i]=e[i]);return n})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((n,i)=>{t(n)?"or"===n.word&&e.push([]):e[e.length-1].push(u(d({},n),{position:i}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let n=0;n<this.blueprint.length;n++)if(this.blueprint[n].uid===e){t=n;break}return t}replaceCriterion(e,t){const{meta:n,id:i,refinements:r}=this.findCondition(t.id),o=p(i,1,n,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:n}=this,i=n[e-1],r=n[e+1],o=t(r)&&"or"===r.word,s=t(i)&&"or"===i.word,l=o||!r,a=s||!i,d=a&&!l,u=a&&l;!i&&!r?this.blueprint=[]:u&&s?n.splice(e-1,2):u&&!i||d?n.splice(e,2):n.splice(e-1,2),this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,n=t[0],{meta:i,refinements:r}=n;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:c()}}()),e.push(p(n.id,1,i,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:n}=e,{blueprint:i}=this,r=p(t,n);return 0===i.length?i.push(r):i.splice(i.length,0,f(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:n}=this,i=n[0],{meta:r,refinements:o}=i;return t.splice(e+1,0,f(),p(i.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:n}=this.findCondition(e);let i;return n.forEach((e=>{e.id===t&&(i=e)})),i}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((n=>{n.id===e&&(t=n)})),t}switchClause({uid:e,id:t},n,i){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:n}:this.updateInput({uid:e},{clause:n},i)}switchRefinement({uid:e,id:t},n,i){const r=this.findRefinement(t,i),o=this.findCriterion(e),s=d({},o.input);delete s[n],s[i]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,n){const i=this.findCriterion(e);Object.keys(t).forEach((e=>{n?i.input[n][e]=t[e]:i.input[e]=t[e]})),this.blueprintChanged()}},m=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var n=0;n<this.options.length;n++){if(this.options[n].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.")}const i=this.options[this.options.length-1]||null,r=d({previousOption:i,nextOption:null},e);i&&(i.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((n=>{n.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const n=this.options[t];if(n.id===e)return n}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function v(e,t,n,i,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const u="function"==typeof n?n.options:n;let c;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),i&&(u._scopeId=i),o?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=c):t&&(c=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),c)if(u.functional){const e=u.render;u.render=function(t,n){return c.call(n),e(t,n)}}else{const e=u.beforeCreate;u.beforeCreate=e?[].concat(e,c):[c]}return n}const g=v({},undefined,{name:"renderless-selector",data:()=>({selector:e.reactive(new m),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i}=this;return{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i,options:this.selector.options}}},methods:{nextTick(){return e.nextTick().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:n}=this,{selectedOption:i}=t.toggleOption(e);return i?this.selectOption(e):this.deselectOption(e),n(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let t=this.$slots?.default;return e.isVue2&&(t=this.$scopedSlots?.default),t?t({actions:this.actions,...this.state}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0),y={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let b=1;var w={beforeCreate(){this.uid=b.toString(),b+=1}};const x=Symbol();function O(t,n,i=e.computed((()=>({})))){const r=e.inject(x),o=e.computed((()=>t(r)??{})),s=e.computed((()=>{const e={},t=i.value??{};let n=o.value.order;return n&&(e.order="function"==typeof n?n(t):n),e.wrap=o.value.wrap,e})),l=e.computed((()=>{const e={},t=i.value,n=o.value.class;n&&(e.class="function"==typeof n?n(t):n);const r=o.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return e.computed((()=>({component:o.value.component??n.value,props:l,extra:s})))}const _=e.defineComponent({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(t,n){const i=O((e=>{const n=t.component.split(".");let i=e;for(const e of n)i=i?.[e];return i}),e.computed((()=>t.as)),e.computed((()=>({...n.attrs??{},...t.flavorOptions??{}}))));return()=>{const r=i.value,o=r.extra.value.order??t.order,s=function(e,t=[]){const n=Object.assign({},e);for(const e of t)e in n&&delete n[e];return n}(t,["as","component","order"]),l=n.slots;let a="string"==typeof r.component&&r.component.includes("-"),d=a?l:o.map((e=>l?.[e]?.())),u=e.isVue2?e.h(r.component,{scopedSlots:l,attrs:{...n.attrs,"data-flavor":t.component},props:s,on:n.listeners,...r.props.value},d):e.h(r.component,{...n.attrs,"data-flavor":t.component,...s,...r.props.value},d);return r.extra.value.wrap?r.extra.value.wrap(u):u}}});const C={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:_}};var k=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?n("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):n("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};k._withStripped=!0;const S=v({render:k,staticRenderFns:[]},undefined,C,undefined,false,undefined,!1,void 0,void 0,void 0);const $={name:"selector-listbox",mixins:[w],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:_}};var I=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[n("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};I._withStripped=!0;const R=v({render:I,staticRenderFns:[]},undefined,$,undefined,false,undefined,!1,void 0,void 0,void 0);const q={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:_}};var B=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[n("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};B._withStripped=!0;const j=v({render:B,staticRenderFns:[]},undefined,q,undefined,false,undefined,!1,void 0,void 0,void 0);const E={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:_}};var F=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var i=t.id,r=t.display;return n("refine-flavor",{key:i,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",i)}}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};F._withStripped=!0;const D=v({render:F,staticRenderFns:[]},undefined,E,undefined,false,undefined,!1,void 0,void 0,void 0);const A={name:"selector",mixins:[w],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,n){const{value:i}=n;if("function"!=typeof i)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||i()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},n=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:n,unmount:n}}},methods:{updateBuffer(e,t,n){if(!e)return;const i=t.find((t=>t.display.toLowerCase().includes(e)));i&&(n.highlightOption(i),this.scrollIntoView(i.id))},isSelected(e,t){let n=!1;return t.forEach((t=>{e.id===t.id&&(n=!0)})),n},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:n,selectOption:i,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(n(),i(e),await this.close(t))},scrollIntoView(e){if(e){this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:n}=await e();t&&this.scrollIntoView(n?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:D,RenderlessSelector:g,SelectorListItem:j,SelectorButton:S,SelectorListbox:R,RefineFlavor:_}};var V=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[n("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[n("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:i.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?n("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)},"deselect-option":function(t){return e.deselectOption(t,i)}}}):n("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)}}}),e._v(" "),n("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(i)},"highlight-previous-option":function(t){return e.highlightPreviousOption(i)},"select-option":function(t){return e.selectOption(l.id,i)},"buffer-changed":function(t){return e.updateBuffer(t,a,i)},close:function(t){return e.close(i)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return n("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return i.highlightOption(t)},mouseleave:function(e){return i.highlightOption(null)},selected:function(n){return e.selectOption(t.id,i)}}})}))}}],null,!0)})],1),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};V._withStripped=!0;const M=v({render:V,staticRenderFns:[]},undefined,A,undefined,false,undefined,!1,void 0,void 0,void 0);var P={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:n}=e,{id:i,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:i,type:r,display:o,uid:n,meta:s}}},render(){const{insertCriterion:t,addGroup:n,blueprintStore:i,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return e.isVue2&&(l=this.$scopedSlots?.default),l?l({insertCriterion:t,addGroup:n,blueprint:i,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:i.groupedBlueprint()}):null}},N={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(t,n)=>((t,n,i)=>{const r=e.inject("blueprint"),o=e.inject("builderModeActive");if(!t)throw new Error("useCondition requires an id.");if(!i)throw new Error("useCondition requires a Vue context.");if(!r)throw new Error("Conditions must be rendered within a query.");let s;s=o?r.findCriterion(n.uid):r.addCriterion({id:t,depth:0});const l=(e,t)=>r.updateInput(s,e,t),a=e=>r.switchClause(s,e);e.provide("criterion",s),e.provide("criterionMeta",n.meta),e.provide("updateInput",l),e.provide("switchRefinement",((e,t)=>{r.switchRefinement(s,e,t)})),e.provide("refinementId",null),e.onUnmounted((()=>{o||r.removeCriterion(r.indexOfCriterion(s))}));let d=null;return n?.condition?.meta?.clauses&&(d=n.condition.meta.clauses.map((e=>e.component))),()=>i.slots.default?i.slots.default({clauses:d,criterion:s,updateInput:l,switchClause:a}):null})(t.id,t,n)},T={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(t,n)=>((t,n,i)=>{const r=e.inject("criterion"),o=e.inject("updateInput"),s=e.inject("refinementId"),l=e.inject("builderModeActive"),a=e=>{o(e,s)};if(!r)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:t},s);const{clause:e,...i}=r.input;Object.keys(n).length>0&&0===Object.keys(i).length&&o({...n},s)}return e.onUnmounted((()=>{l||r.input.clause===t&&o({clause:void 0},s)})),()=>i.slots.default?i.slots.default({setValue:a,...r.input}):null})(t.clause,t,n)},z={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let t=this.$slots?.default;if(e.isVue2&&(t=this.$scopedSlots?.default),t)return t()}};const L={name:"selector-option",mixins:[y],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[y],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:n,selector:i}=this;i.registerOption({id:e,display:t||e,...this.$attrs}),n&&i.selectOption(e)},render(){const{isSelected:t}=this;let n=this.$slots?.default;return e.isVue2&&(n=this.$scopedSlots?.default),n&&t?n():null}}}};var H=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};H._withStripped=!0;const G=v({render:H,staticRenderFns:[]},undefined,L,undefined,false,undefined,!1,void 0,void 0,void 0);const Y={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:M}};var K=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};K._withStripped=!0;const U=v({render:K,staticRenderFns:[]},undefined,Y,undefined,false,undefined,!1,void 0,void 0,void 0);const Q=v({},undefined,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:t}=this;let n=this.$slots?.default;return e.isVue2&&(n=this.$scopedSlots?.default),n?n({blueprint:t}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0);const W={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,n=Number(t);isNaN(n)?this.currentValue=t:(this.currentValue=n,this.$emit("input",{value1:n}))}},components:{RefineFlavor:_}};var X=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};X._withStripped=!0;const Z=v({render:X,staticRenderFns:[]},undefined,W,undefined,false,undefined,!1,void 0,void 0,void 0);const J={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:Z,RefineFlavor:_}};var ee=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[n("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?n("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),n("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};ee._withStripped=!0;const te=v({render:ee,staticRenderFns:[]},undefined,J,undefined,false,undefined,!1,void 0,void 0,void 0);const ne={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:_}};var ie=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};ie._withStripped=!0;const re=v({render:ie,staticRenderFns:[]},undefined,ne,undefined,false,undefined,!1,void 0,void 0,void 0);const oe={setup(){var t,n;return{flavor:(t="inputs.date.pickerInput",O((e=>{const n=t.split(".");let i=e;for(const e of n)i=i?.[e];return i}),"",e.computed((()=>n)))?.value)}},props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:_}};var se=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():n("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?n("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};se._withStripped=!0;const le=v({render:se,staticRenderFns:[]},undefined,oe,undefined,false,undefined,!1,void 0,void 0,void 0);const ae={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:le},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var de=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};de._withStripped=!0;const ue=v({render:de,staticRenderFns:[]},undefined,ae,undefined,false,undefined,!1,void 0,void 0,void 0);const ce={name:"refine-double-date-input",components:{DatePicker:le,RefineFlavor:_},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var pe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[n("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),n("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),n("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};pe._withStripped=!0;const fe=v({render:pe,staticRenderFns:[]},undefined,ce,undefined,false,undefined,!1,void 0,void 0,void 0);const he={name:"refine-date-input",components:{Selector:M,SelectorOption:G,RefineFlavor:_},mixins:[w],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[n("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),n("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),n("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};me._withStripped=!0;const ve=v({render:me,staticRenderFns:[]},undefined,he,undefined,false,undefined,!1,void 0,void 0,void 0);const ge={name:"refine-option-input",components:{Selector:M,SelectorOption:G},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((n=>{n===e&&(t=!0)})),t}}};var ye=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var i=t.id,r=t.display;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.isSelected(i)}})})),1)};ye._withStripped=!0;const be=v({render:ye,staticRenderFns:[]},undefined,ge,undefined,false,undefined,!1,void 0,void 0,void 0);var we={RefineDateInput:ue,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:ve,RefineTextInput:re};const xe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:T,SelectorOption:G,Selector:M,...Object.freeze({__proto__:null,default:we,RefineDateInput:ue,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:ve,RefineTextInput:re})}};var Oe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var i=t.setValue;return[n("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return n("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?n(s,e._b({tag:"component",on:{input:i}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Oe._withStripped=!0;const _e=v({render:Oe,staticRenderFns:[]},undefined,xe,undefined,false,undefined,!1,void 0,void 0,void 0);const Ce={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:_e,RenderlessRefinement:z,Selector:M,SelectorOption:G},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var ke=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var i=t.id,r=t.meta,o=t.display;return n("selector-option",{key:i,attrs:{id:i,display:o,selected:!!e.input[i]}},[n("renderless-refinement",{attrs:{id:i}},[n("clause",{attrs:{meta:r,input:e.input[i]},on:{"switch-clause":function(t){var n=t.id;return e.updateInput({clause:n},i)}}})],1)],1)})),1)};ke._withStripped=!0;const Se={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:_e,Refinements:v({render:ke,staticRenderFns:[]},undefined,Ce,undefined,false,undefined,!1,void 0,void 0,void 0),SelectorOption:G,Selector:M,RefineFlavor:_}};var $e=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?n("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return n("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[n("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var i=t.id,r=t.display,o=t.meta,s=t.refinements;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.conditionId===i}},[n("div",[n("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?n("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[n("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};$e._withStripped=!0;const Ie={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:t=>e.isVue2?{}:{key:t},templateChildKey:t=>e.isVue2?{key:t}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(t){var n;n=t.flavor,e.provide(x,n)},components:{Criterion:v({render:$e,staticRenderFns:[]},undefined,Se,undefined,false,undefined,!1,void 0,void 0,void 0),RefineFlavor:_,RenderlessCondition:N,RenderlessQueryBuilder:P}};var Re=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===i.length?n("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[n("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):n("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(i,(function(t,s){return[n("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t,i){return n("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[n("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(i){var o=i.switchClause;return[n("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[n("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[n("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),n("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s,total:i.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),n("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Re._withStripped=!0;const qe=v({render:Re,staticRenderFns:[]},undefined,Ie,undefined,false,undefined,!1,void 0,void 0,void 0),Be="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",je="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",Ee=`${Be} ${je} w-60 pl-3 py-2`,Fe={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Be} ${je} block w-full pl-3 py-2 pr-0`},relative:{class:`${Ee} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:Ee,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ee}}},De="bg-white relative text-left cursor-default",Ae=`${De} focus:outline-none pl-3 py-1`,Ve={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${De} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ae} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ae} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ae}}};exports.ConditionSelector=U,exports.DatePickerPlugin={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},exports.Query=Q,exports.QueryBuilder=qe,exports.Selector=M,exports.SelectorOption=G,exports.linearFlavor=Ve,exports.tailwindFlavor=Fe;
//# sourceMappingURL=refine-vue.cjs.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue-demi"),t=e=>"conjunction"===(null==e?void 0:e.type),i=Object.defineProperty,n=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var i in t||(t={}))s.call(t,i)&&a(e,i,t[i]);if(o)for(var i of o(t))l.call(t,i)&&a(e,i,t[i]);return e},c=(e,t)=>n(e,r(t)),u=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},p=(e,t,i,n)=>{var r,o;const[s]=n||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:d({clause:null==i?void 0:i.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:u()}},f=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:u()}},h=class{constructor(e,t,i){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{i&&i([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?c(d({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||u()}):c(d({},e),{id:void 0,uid:u()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var i={};for(var n in e)s.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&o)for(var n of o(e))t.indexOf(n)<0&&l.call(e,n)&&(i[n]=e[n]);return i})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((i,n)=>{t(i)?"or"===i.word&&e.push([]):e[e.length-1].push(c(d({},i),{position:n}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let i=0;i<this.blueprint.length;i++)if(this.blueprint[i].uid===e){t=i;break}return t}replaceCriterion(e,t){const{meta:i,id:n,refinements:r}=this.findCondition(t.id),o=p(n,1,i,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:i}=this,n=i[e-1],r=i[e+1],o=t(r)&&"or"===r.word,s=t(n)&&"or"===n.word,l=o||!r,a=s||!n,d=a&&!l,c=a&&l;n||r?c&&s?i.splice(e-1,2):c&&!n||d?i.splice(e,2):i.splice(e-1,2):this.blueprint=[],this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,i=t[0],{meta:n,refinements:r}=i;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:u()}}()),e.push(p(i.id,1,n,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:i}=e,{blueprint:n}=this,r=p(t,i);return 0===n.length?n.push(r):n.splice(n.length,0,f(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:i}=this,n=i[0],{meta:r,refinements:o}=n;return t.splice(e+1,0,f(),p(n.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:i}=this.findCondition(e);let n;return i.forEach((e=>{e.id===t&&(n=e)})),n}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((i=>{i.id===e&&(t=i)})),t}switchClause({uid:e,id:t},i,n){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:i}:this.updateInput({uid:e},{clause:i},n)}switchRefinement({uid:e,id:t},i,n){const r=this.findRefinement(t,n),o=this.findCriterion(e),s=d({},o.input);delete s[i],s[n]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,i){const n=this.findCriterion(e);Object.keys(t).forEach((e=>{i?n.input[i][e]=t[e]:n.input[e]=t[e]})),this.blueprintChanged()}},v=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var i=0;i<this.options.length;i++)if(this.options[i].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.");const n=this.options[this.options.length-1]||null,r=d({previousOption:n,nextOption:null},e);n&&(n.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((i=>{i.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const i=this.options[t];if(i.id===e)return i}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function m(e,t,i,n,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const c="function"==typeof i?i.options:i;let u;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),n&&(c._scopeId=n),o?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),u)if(c.functional){const e=c.render;c.render=function(t,i){return u.call(i),e(t,i)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,u):[u]}return i}const g=m({},void 0,{name:"renderless-selector",data:()=>({selector:e.reactive(new v),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n}=this;return{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n,options:this.selector.options}}},methods:{nextTick(){return e.nextTick().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:i}=this,{selectedOption:n}=t.toggleOption(e);return n?this.selectOption(e):this.deselectOption(e),i(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let t=this.$slots?.default;return e.isVue2&&(t=this.$scopedSlots?.default),t?t({actions:this.actions,...this.state}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),y={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let b=1;var w={beforeCreate(){this.uid=b.toString(),b+=1}};const x=Symbol();function O(t,i,n=e.computed((()=>({})))){const r=e.inject(x),o=e.computed((()=>t(r)??{})),s=e.computed((()=>{const e={},t=n.value??{};let i=o.value.order;return i&&(e.order="function"==typeof i?i(t):i),e.wrap=o.value.wrap,e})),l=e.computed((()=>{const e={},t=n.value??{},i=o.value.class;i&&(e.class="function"==typeof i?i(t):i);const r=o.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return e.computed((()=>({component:o.value.component??i.value,props:l,extra:s})))}const _=e.defineComponent({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(t,i){const n=O((e=>{const i=t.component.split(".");let n=e;for(const e of i)n=n?.[e];return n}),e.computed((()=>t.as)),e.computed((()=>t.flavorOptions)));return()=>{const r=n.value,o=r.extra.value.order??t.order,s=function(e,t=[]){const i=Object.assign({},e);for(const e of t)e in i&&delete i[e];return i}(t,["as","component","order"]),l=i.slots;let a="string"==typeof r.component&&r.component.includes("-")?l:o.map((e=>l?.[e]?.())),d=e.isVue2?e.h(r.component,{scopedSlots:l,attrs:{...i.attrs,"data-flavor":t.component},props:s,on:i.listeners,...r.props.value},a):e.h(r.component,{...i.attrs,"data-flavor":t.component,...s,...r.props.value},a);return r.extra.value.wrap?r.extra.value.wrap(d):d}}}),C={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:_}};var k=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?i("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):i("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};k._withStripped=!0;const S=m({render:k,staticRenderFns:[]},void 0,C,void 0,!1,void 0,!1,void 0,void 0,void 0),$={name:"selector-listbox",mixins:[w],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:_}};var I=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[i("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};I._withStripped=!0;const R=m({render:I,staticRenderFns:[]},void 0,$,void 0,!1,void 0,!1,void 0,void 0,void 0),q={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:_}};var B=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[i("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};B._withStripped=!0;const j=m({render:B,staticRenderFns:[]},void 0,q,void 0,!1,void 0,!1,void 0,void 0,void 0),E={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:_}};var F=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var n=t.id,r=t.display;return i("refine-flavor",{key:n,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",n)}}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};F._withStripped=!0;const D=m({render:F,staticRenderFns:[]},void 0,E,void 0,!1,void 0,!1,void 0,void 0,void 0),A={name:"selector",mixins:[w],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,i){const{value:n}=i;if("function"!=typeof n)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||n()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},i=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:i,unmount:i}}},methods:{updateBuffer(e,t,i){if(!e)return;const n=t.find((t=>t.display.toLowerCase().includes(e)));n&&(i.highlightOption(n),this.scrollIntoView(n.id))},isSelected(e,t){let i=!1;return t.forEach((t=>{e.id===t.id&&(i=!0)})),i},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:i,selectOption:n,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(i(),n(e),await this.close(t))},scrollIntoView(e){e&&this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:i}=await e();t&&this.scrollIntoView(i?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:D,RenderlessSelector:g,SelectorListItem:j,SelectorButton:S,SelectorListbox:R,RefineFlavor:_}};var V=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[i("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[i("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:n.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?i("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)},"deselect-option":function(t){return e.deselectOption(t,n)}}}):i("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)}}}),e._v(" "),i("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(n)},"highlight-previous-option":function(t){return e.highlightPreviousOption(n)},"select-option":function(t){return e.selectOption(l.id,n)},"buffer-changed":function(t){return e.updateBuffer(t,a,n)},close:function(t){return e.close(n)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return i("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return n.highlightOption(t)},mouseleave:function(e){return n.highlightOption(null)},selected:function(i){return e.selectOption(t.id,n)}}})}))}}],null,!0)})],1),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};V._withStripped=!0;const M=m({render:V,staticRenderFns:[]},void 0,A,void 0,!1,void 0,!1,void 0,void 0,void 0);var P={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:i}=e,{id:n,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:n,type:r,display:o,uid:i,meta:s}}},render(){const{insertCriterion:t,addGroup:i,blueprintStore:n,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return e.isVue2&&(l=this.$scopedSlots?.default),l?l({insertCriterion:t,addGroup:i,blueprint:n,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:n.groupedBlueprint()}):null}},N={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(t,i)=>((t,i,n)=>{const r=e.inject("blueprint"),o=e.inject("builderModeActive");if(!t)throw new Error("useCondition requires an id.");if(!n)throw new Error("useCondition requires a Vue context.");if(!r)throw new Error("Conditions must be rendered within a query.");let s;s=o?r.findCriterion(i.uid):r.addCriterion({id:t,depth:0});const l=(e,t)=>r.updateInput(s,e,t),a=e=>r.switchClause(s,e);e.provide("criterion",s),e.provide("criterionMeta",i.meta),e.provide("updateInput",l),e.provide("switchRefinement",((e,t)=>{r.switchRefinement(s,e,t)})),e.provide("refinementId",null),e.onUnmounted((()=>{o||r.removeCriterion(r.indexOfCriterion(s))}));let d=null;return i?.condition?.meta?.clauses&&(d=i.condition.meta.clauses.map((e=>e.component))),()=>n.slots.default?n.slots.default({clauses:d,criterion:s,updateInput:l,switchClause:a}):null})(t.id,t,i)},T={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(t,i)=>((t,i,n)=>{const r=e.inject("criterion"),o=e.inject("updateInput"),s=e.inject("refinementId"),l=e.inject("builderModeActive"),a=e=>{o(e,s)};if(!r)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:t},s);const{clause:e,...n}=r.input;Object.keys(i).length>0&&0===Object.keys(n).length&&o({...i},s)}return e.onUnmounted((()=>{l||r.input.clause===t&&o({clause:void 0},s)})),()=>n.slots.default?n.slots.default({setValue:a,...r.input}):null})(t.clause,t,i)},z={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let t=this.$slots?.default;if(e.isVue2&&(t=this.$scopedSlots?.default),t)return t()}};const L={name:"selector-option",mixins:[y],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[y],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:i,selector:n}=this;n.registerOption({id:e,display:t||e,...this.$attrs}),i&&n.selectOption(e)},render(){const{isSelected:t}=this;let i=this.$slots?.default;return e.isVue2&&(i=this.$scopedSlots?.default),i&&t?i():null}}}};var H=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};H._withStripped=!0;const G=m({render:H,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0),Y={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:M}};var K=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};K._withStripped=!0;const U=m({render:K,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Q=m({},void 0,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:t}=this;let i=this.$slots?.default;return e.isVue2&&(i=this.$scopedSlots?.default),i?i({blueprint:t}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),W={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,i=Number(t);isNaN(i)?this.currentValue=t:(this.currentValue=i,this.$emit("input",{value1:i}))}},components:{RefineFlavor:_}};var X=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};X._withStripped=!0;const Z=m({render:X,staticRenderFns:[]},void 0,W,void 0,!1,void 0,!1,void 0,void 0,void 0),J={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:Z,RefineFlavor:_}};var ee=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[i("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?i("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),i("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};ee._withStripped=!0;const te=m({render:ee,staticRenderFns:[]},void 0,J,void 0,!1,void 0,!1,void 0,void 0,void 0),ie={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:_}};var ne=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};ne._withStripped=!0;const re=m({render:ne,staticRenderFns:[]},void 0,ie,void 0,!1,void 0,!1,void 0,void 0,void 0),oe={setup:()=>({flavor:("inputs.date.pickerInput",O((e=>{const t="inputs.date.pickerInput".split(".");let i=e;for(const e of t)i=i?.[e];return i}),"",e.computed((()=>{})))?.value)}),props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:_}};var se=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():i("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?i("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};se._withStripped=!0;const le=m({render:se,staticRenderFns:[]},void 0,oe,void 0,!1,void 0,!1,void 0,void 0,void 0),ae={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:le},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var de=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};de._withStripped=!0;const ce=m({render:de,staticRenderFns:[]},void 0,ae,void 0,!1,void 0,!1,void 0,void 0,void 0),ue={name:"refine-double-date-input",components:{DatePicker:le,RefineFlavor:_},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var pe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[i("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),i("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),i("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};pe._withStripped=!0;const fe=m({render:pe,staticRenderFns:[]},void 0,ue,void 0,!1,void 0,!1,void 0,void 0,void 0),he={name:"refine-date-input",components:{Selector:M,SelectorOption:G,RefineFlavor:_},mixins:[w],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var ve=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[i("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),i("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),i("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};ve._withStripped=!0;const me=m({render:ve,staticRenderFns:[]},void 0,he,void 0,!1,void 0,!1,void 0,void 0,void 0),ge={name:"refine-option-input",components:{Selector:M,SelectorOption:G},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((i=>{i===e&&(t=!0)})),t}}};var ye=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var n=t.id,r=t.display;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.isSelected(n)}})})),1)};ye._withStripped=!0;const be=m({render:ye,staticRenderFns:[]},void 0,ge,void 0,!1,void 0,!1,void 0,void 0,void 0);var we={RefineDateInput:ce,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:me,RefineTextInput:re};const xe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:T,SelectorOption:G,Selector:M,...Object.freeze({__proto__:null,default:we,RefineDateInput:ce,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:me,RefineTextInput:re})}};var Oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var n=t.setValue;return[i("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return i("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?i(s,e._b({tag:"component",on:{input:n}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Oe._withStripped=!0;const _e=m({render:Oe,staticRenderFns:[]},void 0,xe,void 0,!1,void 0,!1,void 0,void 0,void 0),Ce={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:_e,RenderlessRefinement:z,Selector:M,SelectorOption:G},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var ke=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var n=t.id,r=t.meta,o=t.display;return i("selector-option",{key:n,attrs:{id:n,display:o,selected:!!e.input[n]}},[i("renderless-refinement",{attrs:{id:n}},[i("clause",{attrs:{meta:r,input:e.input[n]},on:{"switch-clause":function(t){var i=t.id;return e.updateInput({clause:i},n)}}})],1)],1)})),1)};ke._withStripped=!0;const Se={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:_e,Refinements:m({render:ke,staticRenderFns:[]},void 0,Ce,void 0,!1,void 0,!1,void 0,void 0,void 0),SelectorOption:G,Selector:M,RefineFlavor:_}};var $e=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?i("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return i("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[i("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var n=t.id,r=t.display,o=t.meta,s=t.refinements;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.conditionId===n}},[i("div",[i("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?i("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[i("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};$e._withStripped=!0;const Ie={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:t=>e.isVue2?{}:{key:t},templateChildKey:t=>e.isVue2?{key:t}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(t){var i;i=t.flavor,e.provide(x,i)},components:{Criterion:m({render:$e,staticRenderFns:[]},void 0,Se,void 0,!1,void 0,!1,void 0,void 0,void 0),RefineFlavor:_,RenderlessCondition:N,RenderlessQueryBuilder:P}};var Re=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===n.length?i("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[i("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):i("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(n,(function(t,s){return[i("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t){return i("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[i("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(n){var o=n.switchClause;return[i("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[i("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[i("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),i("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s+1,total:n.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),i("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Re._withStripped=!0;const qe=m({render:Re,staticRenderFns:[]},void 0,Ie,void 0,!1,void 0,!1,void 0,void 0,void 0),Be="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",je="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",Ee=`${Be} ${je} w-60 pl-3 py-2`,Fe={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Be} ${je} block w-full pl-3 py-2 pr-0`},relative:{class:`${Ee} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:Ee,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ee}}},De="bg-white relative text-left cursor-default",Ae=`${De} focus:outline-none pl-3 py-1`,Ve={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${De} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ae} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ae} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ae}}};exports.ConditionSelector=U,exports.DatePickerPlugin={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},exports.Query=Q,exports.QueryBuilder=qe,exports.Selector=M,exports.SelectorOption=G,exports.linearFlavor=Ve,exports.tailwindFlavor=Fe;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("vue-demi"),t=e=>"conjunction"===(null==e?void 0:e.type),i=Object.defineProperty,n=Object.defineProperties,r=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,s=Object.prototype.hasOwnProperty,l=Object.prototype.propertyIsEnumerable,a=(e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var i in t||(t={}))s.call(t,i)&&a(e,i,t[i]);if(o)for(var i of o(t))l.call(t,i)&&a(e,i,t[i]);return e},c=(e,t)=>n(e,r(t)),u=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},p=(e,t,i,n)=>{var r,o;const[s]=n||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:d({clause:null==i?void 0:i.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:u()}},f=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:u()}},h=class{constructor(e,t,i){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{i&&i([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?c(d({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||u()}):c(d({},e),{id:void 0,uid:u()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var i={};for(var n in e)s.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&o)for(var n of o(e))t.indexOf(n)<0&&l.call(e,n)&&(i[n]=e[n]);return i})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((i,n)=>{t(i)?"or"===i.word&&e.push([]):e[e.length-1].push(c(d({},i),{position:n}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let i=0;i<this.blueprint.length;i++)if(this.blueprint[i].uid===e){t=i;break}return t}replaceCriterion(e,t){const{meta:i,id:n,refinements:r}=this.findCondition(t.id),o=p(n,1,i,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:i}=this,n=i[e-1],r=i[e+1],o=t(r)&&"or"===r.word,s=t(n)&&"or"===n.word,l=o||!r,a=s||!n,d=a&&!l,c=a&&l;n||r?c&&s?i.splice(e-1,2):c&&!n||d?i.splice(e,2):i.splice(e-1,2):this.blueprint=[],this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,i=t[0],{meta:n,refinements:r}=i;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:u()}}()),e.push(p(i.id,1,n,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:i}=e,{blueprint:n}=this,r=p(t,i);return 0===n.length?n.push(r):n.splice(n.length,0,f(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:i}=this,n=i[0],{meta:r,refinements:o}=n;return t.splice(e+1,0,f(),p(n.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:i}=this.findCondition(e);let n;return i.forEach((e=>{e.id===t&&(n=e)})),n}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((i=>{i.id===e&&(t=i)})),t}switchClause({uid:e,id:t},i,n){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:i}:this.updateInput({uid:e},{clause:i},n)}switchRefinement({uid:e,id:t},i,n){const r=this.findRefinement(t,n),o=this.findCriterion(e),s=d({},o.input);delete s[i],s[n]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,i){const n=this.findCriterion(e);Object.keys(t).forEach((e=>{i?n.input[i][e]=t[e]:n.input[e]=t[e]})),this.blueprintChanged()}},v=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var i=0;i<this.options.length;i++)if(this.options[i].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.");const n=this.options[this.options.length-1]||null,r=d({previousOption:n,nextOption:null},e);n&&(n.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((i=>{i.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const i=this.options[t];if(i.id===e)return i}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function m(e,t,i,n,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const c="function"==typeof i?i.options:i;let u;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),n&&(c._scopeId=n),o?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),u)if(c.functional){const e=c.render;c.render=function(t,i){return u.call(i),e(t,i)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,u):[u]}return i}const g=m({},void 0,{name:"renderless-selector",data:()=>({selector:e.reactive(new v),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n}=this;return{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n,options:this.selector.options}}},methods:{nextTick(){return e.nextTick().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:i}=this,{selectedOption:n}=t.toggleOption(e);return n?this.selectOption(e):this.deselectOption(e),i(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let t=this.$slots?.default;return e.isVue2&&(t=this.$scopedSlots?.default),t?t({actions:this.actions,...this.state}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),y={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let b=1;var w={beforeCreate(){this.uid=b.toString(),b+=1}};const x=Symbol();function O(t,i,n=e.computed((()=>({})))){const r=e.inject(x),o=e.computed((()=>t(r)??{})),s=e.computed((()=>{const e={},t=n.value??{};let i=o.value.order;return i&&(e.order="function"==typeof i?i(t):i),e.wrap=o.value.wrap,e})),l=e.computed((()=>{const e={},t=n.value,i=o.value.class;i&&(e.class="function"==typeof i?i(t):i);const r=o.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return e.computed((()=>({component:o.value.component??i.value,props:l,extra:s})))}const _=e.defineComponent({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(t,i){const n=O((e=>{const i=t.component.split(".");let n=e;for(const e of i)n=n?.[e];return n}),e.computed((()=>t.as)),e.computed((()=>({...i.attrs??{},...t.flavorOptions??{}}))));return()=>{const r=n.value,o=r.extra.value.order??t.order,s=function(e,t=[]){const i=Object.assign({},e);for(const e of t)e in i&&delete i[e];return i}(t,["as","component","order"]),l=i.slots;let a="string"==typeof r.component&&r.component.includes("-")?l:o.map((e=>l?.[e]?.())),d=e.isVue2?e.h(r.component,{scopedSlots:l,attrs:{...i.attrs,"data-flavor":t.component},props:s,on:i.listeners,...r.props.value},a):e.h(r.component,{...i.attrs,"data-flavor":t.component,...s,...r.props.value},a);return r.extra.value.wrap?r.extra.value.wrap(d):d}}}),C={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:_}};var k=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?i("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):i("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};k._withStripped=!0;const S=m({render:k,staticRenderFns:[]},void 0,C,void 0,!1,void 0,!1,void 0,void 0,void 0),$={name:"selector-listbox",mixins:[w],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:_}};var I=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[i("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};I._withStripped=!0;const R=m({render:I,staticRenderFns:[]},void 0,$,void 0,!1,void 0,!1,void 0,void 0,void 0),q={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:_}};var B=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[i("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};B._withStripped=!0;const j=m({render:B,staticRenderFns:[]},void 0,q,void 0,!1,void 0,!1,void 0,void 0,void 0),E={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:_}};var F=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var n=t.id,r=t.display;return i("refine-flavor",{key:n,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",n)}}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};F._withStripped=!0;const D=m({render:F,staticRenderFns:[]},void 0,E,void 0,!1,void 0,!1,void 0,void 0,void 0),A={name:"selector",mixins:[w],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,i){const{value:n}=i;if("function"!=typeof n)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||n()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},i=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:i,unmount:i}}},methods:{updateBuffer(e,t,i){if(!e)return;const n=t.find((t=>t.display.toLowerCase().includes(e)));n&&(i.highlightOption(n),this.scrollIntoView(n.id))},isSelected(e,t){let i=!1;return t.forEach((t=>{e.id===t.id&&(i=!0)})),i},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:i,selectOption:n,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(i(),n(e),await this.close(t))},scrollIntoView(e){e&&this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:i}=await e();t&&this.scrollIntoView(i?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:D,RenderlessSelector:g,SelectorListItem:j,SelectorButton:S,SelectorListbox:R,RefineFlavor:_}};var V=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[i("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[i("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:n.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?i("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)},"deselect-option":function(t){return e.deselectOption(t,n)}}}):i("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)}}}),e._v(" "),i("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(n)},"highlight-previous-option":function(t){return e.highlightPreviousOption(n)},"select-option":function(t){return e.selectOption(l.id,n)},"buffer-changed":function(t){return e.updateBuffer(t,a,n)},close:function(t){return e.close(n)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return i("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return n.highlightOption(t)},mouseleave:function(e){return n.highlightOption(null)},selected:function(i){return e.selectOption(t.id,n)}}})}))}}],null,!0)})],1),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};V._withStripped=!0;const M=m({render:V,staticRenderFns:[]},void 0,A,void 0,!1,void 0,!1,void 0,void 0,void 0);var P={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:i}=e,{id:n,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:n,type:r,display:o,uid:i,meta:s}}},render(){const{insertCriterion:t,addGroup:i,blueprintStore:n,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return e.isVue2&&(l=this.$scopedSlots?.default),l?l({insertCriterion:t,addGroup:i,blueprint:n,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:n.groupedBlueprint()}):null}},N={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(t,i)=>((t,i,n)=>{const r=e.inject("blueprint"),o=e.inject("builderModeActive");if(!t)throw new Error("useCondition requires an id.");if(!n)throw new Error("useCondition requires a Vue context.");if(!r)throw new Error("Conditions must be rendered within a query.");let s;s=o?r.findCriterion(i.uid):r.addCriterion({id:t,depth:0});const l=(e,t)=>r.updateInput(s,e,t),a=e=>r.switchClause(s,e);e.provide("criterion",s),e.provide("criterionMeta",i.meta),e.provide("updateInput",l),e.provide("switchRefinement",((e,t)=>{r.switchRefinement(s,e,t)})),e.provide("refinementId",null),e.onUnmounted((()=>{o||r.removeCriterion(r.indexOfCriterion(s))}));let d=null;return i?.condition?.meta?.clauses&&(d=i.condition.meta.clauses.map((e=>e.component))),()=>n.slots.default?n.slots.default({clauses:d,criterion:s,updateInput:l,switchClause:a}):null})(t.id,t,i)},T={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(t,i)=>((t,i,n)=>{const r=e.inject("criterion"),o=e.inject("updateInput"),s=e.inject("refinementId"),l=e.inject("builderModeActive"),a=e=>{o(e,s)};if(!r)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:t},s);const{clause:e,...n}=r.input;Object.keys(i).length>0&&0===Object.keys(n).length&&o({...i},s)}return e.onUnmounted((()=>{l||r.input.clause===t&&o({clause:void 0},s)})),()=>n.slots.default?n.slots.default({setValue:a,...r.input}):null})(t.clause,t,i)},z={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let t=this.$slots?.default;if(e.isVue2&&(t=this.$scopedSlots?.default),t)return t()}};const L={name:"selector-option",mixins:[y],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[y],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:i,selector:n}=this;n.registerOption({id:e,display:t||e,...this.$attrs}),i&&n.selectOption(e)},render(){const{isSelected:t}=this;let i=this.$slots?.default;return e.isVue2&&(i=this.$scopedSlots?.default),i&&t?i():null}}}};var H=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};H._withStripped=!0;const G=m({render:H,staticRenderFns:[]},void 0,L,void 0,!1,void 0,!1,void 0,void 0,void 0),Y={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:M}};var K=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};K._withStripped=!0;const U=m({render:K,staticRenderFns:[]},void 0,Y,void 0,!1,void 0,!1,void 0,void 0,void 0),Q=m({},void 0,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new h(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:t}=this;let i=this.$slots?.default;return e.isVue2&&(i=this.$scopedSlots?.default),i?i({blueprint:t}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),W={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,i=Number(t);isNaN(i)?this.currentValue=t:(this.currentValue=i,this.$emit("input",{value1:i}))}},components:{RefineFlavor:_}};var X=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};X._withStripped=!0;const Z=m({render:X,staticRenderFns:[]},void 0,W,void 0,!1,void 0,!1,void 0,void 0,void 0),J={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:Z,RefineFlavor:_}};var ee=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[i("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?i("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),i("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};ee._withStripped=!0;const te=m({render:ee,staticRenderFns:[]},void 0,J,void 0,!1,void 0,!1,void 0,void 0,void 0),ie={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:_}};var ne=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};ne._withStripped=!0;const re=m({render:ne,staticRenderFns:[]},void 0,ie,void 0,!1,void 0,!1,void 0,void 0,void 0),oe={setup:()=>({flavor:("inputs.date.pickerInput",O((e=>{const t="inputs.date.pickerInput".split(".");let i=e;for(const e of t)i=i?.[e];return i}),"",e.computed((()=>{})))?.value)}),props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:_}};var se=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():i("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?i("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};se._withStripped=!0;const le=m({render:se,staticRenderFns:[]},void 0,oe,void 0,!1,void 0,!1,void 0,void 0,void 0),ae={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:le},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var de=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};de._withStripped=!0;const ce=m({render:de,staticRenderFns:[]},void 0,ae,void 0,!1,void 0,!1,void 0,void 0,void 0),ue={name:"refine-double-date-input",components:{DatePicker:le,RefineFlavor:_},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var pe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[i("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),i("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),i("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};pe._withStripped=!0;const fe=m({render:pe,staticRenderFns:[]},void 0,ue,void 0,!1,void 0,!1,void 0,void 0,void 0),he={name:"refine-date-input",components:{Selector:M,SelectorOption:G,RefineFlavor:_},mixins:[w],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var ve=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[i("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),i("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),i("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};ve._withStripped=!0;const me=m({render:ve,staticRenderFns:[]},void 0,he,void 0,!1,void 0,!1,void 0,void 0,void 0),ge={name:"refine-option-input",components:{Selector:M,SelectorOption:G},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((i=>{i===e&&(t=!0)})),t}}};var ye=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var n=t.id,r=t.display;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.isSelected(n)}})})),1)};ye._withStripped=!0;const be=m({render:ye,staticRenderFns:[]},void 0,ge,void 0,!1,void 0,!1,void 0,void 0,void 0);var we={RefineDateInput:ce,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:me,RefineTextInput:re};const xe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:T,SelectorOption:G,Selector:M,...Object.freeze({__proto__:null,default:we,RefineDateInput:ce,RefineDoubleDateInput:fe,RefineDoubleNumberInput:te,RefineNumberInput:Z,RefineOptionInput:be,RefineRelativeDateInput:me,RefineTextInput:re})}};var Oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var n=t.setValue;return[i("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return i("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?i(s,e._b({tag:"component",on:{input:n}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Oe._withStripped=!0;const _e=m({render:Oe,staticRenderFns:[]},void 0,xe,void 0,!1,void 0,!1,void 0,void 0,void 0),Ce={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:_e,RenderlessRefinement:z,Selector:M,SelectorOption:G},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var ke=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var n=t.id,r=t.meta,o=t.display;return i("selector-option",{key:n,attrs:{id:n,display:o,selected:!!e.input[n]}},[i("renderless-refinement",{attrs:{id:n}},[i("clause",{attrs:{meta:r,input:e.input[n]},on:{"switch-clause":function(t){var i=t.id;return e.updateInput({clause:i},n)}}})],1)],1)})),1)};ke._withStripped=!0;const Se={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:_e,Refinements:m({render:ke,staticRenderFns:[]},void 0,Ce,void 0,!1,void 0,!1,void 0,void 0,void 0),SelectorOption:G,Selector:M,RefineFlavor:_}};var $e=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?i("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return i("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[i("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var n=t.id,r=t.display,o=t.meta,s=t.refinements;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.conditionId===n}},[i("div",[i("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?i("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[i("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};$e._withStripped=!0;const Ie={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:t=>e.isVue2?{}:{key:t},templateChildKey:t=>e.isVue2?{key:t}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(t){var i;i=t.flavor,e.provide(x,i)},components:{Criterion:m({render:$e,staticRenderFns:[]},void 0,Se,void 0,!1,void 0,!1,void 0,void 0,void 0),RefineFlavor:_,RenderlessCondition:N,RenderlessQueryBuilder:P}};var Re=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===n.length?i("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[i("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):i("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(n,(function(t,s){return[i("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t,n){return i("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[i("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(n){var o=n.switchClause;return[i("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[i("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[i("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),i("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s,total:n.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),i("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Re._withStripped=!0;const qe=m({render:Re,staticRenderFns:[]},void 0,Ie,void 0,!1,void 0,!1,void 0,void 0,void 0),Be="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",je="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",Ee=`${Be} ${je} w-60 pl-3 py-2`,Fe={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Be} ${je} block w-full pl-3 py-2 pr-0`},relative:{class:`${Ee} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:Ee,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ee}}},De="bg-white relative text-left cursor-default",Ae=`${De} focus:outline-none pl-3 py-1`,Ve={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${De} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ae} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ae} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ae}}};exports.ConditionSelector=U,exports.DatePickerPlugin={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},exports.Query=Q,exports.QueryBuilder=qe,exports.Selector=M,exports.SelectorOption=G,exports.linearFlavor=Ve,exports.tailwindFlavor=Fe;
//# sourceMappingURL=refine-vue.cjs.min.js.map

@@ -1,2 +0,2 @@

import{reactive as e,nextTick as t,isVue2 as n,computed as i,inject as r,provide as o,defineComponent as s,h as l,onUnmounted as a}from"vue-demi";var d={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},u=e=>"conjunction"===(null==e?void 0:e.type),c=Object.defineProperty,p=Object.defineProperties,f=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,g=(e,t,n)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))m.call(t,n)&&g(e,n,t[n]);if(h)for(var n of h(t))v.call(t,n)&&g(e,n,t[n]);return e},b=(e,t)=>p(e,f(t)),w=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},O=(e,t,n,i)=>{var r,o;const[s]=i||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:y({clause:null==n?void 0:n.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:w()}},x=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:w()}},_=class{constructor(e,t,n){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{n&&n([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?b(y({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||w()}):b(y({},e),{id:void 0,uid:w()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var n={};for(var i in e)m.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&h)for(var i of h(e))t.indexOf(i)<0&&v.call(e,i)&&(n[i]=e[i]);return n})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((t,n)=>{u(t)?"or"===t.word&&e.push([]):e[e.length-1].push(b(y({},t),{position:n}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let n=0;n<this.blueprint.length;n++)if(this.blueprint[n].uid===e){t=n;break}return t}replaceCriterion(e,t){const{meta:n,id:i,refinements:r}=this.findCondition(t.id),o=O(i,1,n,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:t}=this,n=t[e-1],i=t[e+1],r=u(i)&&"or"===i.word,o=u(n)&&"or"===n.word,s=r||!i,l=o||!n,a=l&&!s,d=l&&s;!n&&!i?this.blueprint=[]:d&&o?t.splice(e-1,2):d&&!n||a?t.splice(e,2):t.splice(e-1,2),this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,n=t[0],{meta:i,refinements:r}=n;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:w()}}()),e.push(O(n.id,1,i,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:n}=e,{blueprint:i}=this,r=O(t,n);return 0===i.length?i.push(r):i.splice(i.length,0,x(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:n}=this,i=n[0],{meta:r,refinements:o}=i;return t.splice(e+1,0,x(),O(i.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:n}=this.findCondition(e);let i;return n.forEach((e=>{e.id===t&&(i=e)})),i}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((n=>{n.id===e&&(t=n)})),t}switchClause({uid:e,id:t},n,i){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:n}:this.updateInput({uid:e},{clause:n},i)}switchRefinement({uid:e,id:t},n,i){const r=this.findRefinement(t,i),o=this.findCriterion(e),s=y({},o.input);delete s[n],s[i]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,n){const i=this.findCriterion(e);Object.keys(t).forEach((e=>{n?i.input[n][e]=t[e]:i.input[e]=t[e]})),this.blueprintChanged()}},C=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var n=0;n<this.options.length;n++){if(this.options[n].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.")}const i=this.options[this.options.length-1]||null,r=y({previousOption:i,nextOption:null},e);i&&(i.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((n=>{n.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const n=this.options[t];if(n.id===e)return n}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function k(e,t,n,i,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const u="function"==typeof n?n.options:n;let c;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),i&&(u._scopeId=i),o?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=c):t&&(c=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),c)if(u.functional){const e=u.render;u.render=function(t,n){return c.call(n),e(t,n)}}else{const e=u.beforeCreate;u.beforeCreate=e?[].concat(e,c):[c]}return n}const S=k({},undefined,{name:"renderless-selector",data:()=>({selector:e(new C),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i}=this;return{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i,options:this.selector.options}}},methods:{nextTick(){return t().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:n}=this,{selectedOption:i}=t.toggleOption(e);return i?this.selectOption(e):this.deselectOption(e),n(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let e=this.$slots?.default;return n&&(e=this.$scopedSlots?.default),e?e({actions:this.actions,...this.state}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0),$={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let I=1;var R={beforeCreate(){this.uid=I.toString(),I+=1}};const q=Symbol();function B(e,t,n=i((()=>({})))){const o=r(q),s=i((()=>e(o)??{})),l=i((()=>{const e={},t=n.value??{};let i=s.value.order;return i&&(e.order="function"==typeof i?i(t):i),e.wrap=s.value.wrap,e})),a=i((()=>{const e={},t=n.value??{},i=s.value.class;i&&(e.class="function"==typeof i?i(t):i);const r=s.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return i((()=>({component:s.value.component??t.value,props:a,extra:l})))}const E=s({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(e,t){const r=B((t=>{const n=e.component.split(".");let i=t;for(const e of n)i=i?.[e];return i}),i((()=>e.as)),i((()=>e.flavorOptions)));return()=>{const i=r.value,o=i.extra.value.order??e.order,s=function(e,t=[]){const n=Object.assign({},e);for(const e of t)e in n&&delete n[e];return n}(e,["as","component","order"]),a=t.slots;let d="string"==typeof i.component&&i.component.includes("-"),u=d?a:o.map((e=>a?.[e]?.())),c=l(i.component,n?{scopedSlots:a,attrs:{...t.attrs,"data-flavor":e.component},props:s,on:t.listeners,...i.props.value}:{...t.attrs,"data-flavor":e.component,...s,...i.props.value},u);return i.extra.value.wrap?i.extra.value.wrap(c):c}}});const j={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:E}};var F=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?n("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):n("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};F._withStripped=!0;const D=k({render:F,staticRenderFns:[]},undefined,j,undefined,false,undefined,!1,void 0,void 0,void 0);const A={name:"selector-listbox",mixins:[R],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:E}};var M=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[n("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};M._withStripped=!0;const V=k({render:M,staticRenderFns:[]},undefined,A,undefined,false,undefined,!1,void 0,void 0,void 0);const P={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:E}};var N=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[n("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};N._withStripped=!0;const T=k({render:N,staticRenderFns:[]},undefined,P,undefined,false,undefined,!1,void 0,void 0,void 0);const z={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:E}};var L=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var i=t.id,r=t.display;return n("refine-flavor",{key:i,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",i)}}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};L._withStripped=!0;const H=k({render:L,staticRenderFns:[]},undefined,z,undefined,false,undefined,!1,void 0,void 0,void 0);const G={name:"selector",mixins:[R],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,n){const{value:i}=n;if("function"!=typeof i)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||i()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},n=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:n,unmount:n}}},methods:{updateBuffer(e,t,n){if(!e)return;const i=t.find((t=>t.display.toLowerCase().includes(e)));i&&(n.highlightOption(i),this.scrollIntoView(i.id))},isSelected(e,t){let n=!1;return t.forEach((t=>{e.id===t.id&&(n=!0)})),n},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:n,selectOption:i,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(n(),i(e),await this.close(t))},scrollIntoView(e){if(e){this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:n}=await e();t&&this.scrollIntoView(n?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:H,RenderlessSelector:S,SelectorListItem:T,SelectorButton:D,SelectorListbox:V,RefineFlavor:E}};var Y=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[n("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[n("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:i.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?n("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)},"deselect-option":function(t){return e.deselectOption(t,i)}}}):n("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)}}}),e._v(" "),n("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(i)},"highlight-previous-option":function(t){return e.highlightPreviousOption(i)},"select-option":function(t){return e.selectOption(l.id,i)},"buffer-changed":function(t){return e.updateBuffer(t,a,i)},close:function(t){return e.close(i)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return n("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return i.highlightOption(t)},mouseleave:function(e){return i.highlightOption(null)},selected:function(n){return e.selectOption(t.id,i)}}})}))}}],null,!0)})],1),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};Y._withStripped=!0;const K=k({render:Y,staticRenderFns:[]},undefined,G,undefined,false,undefined,!1,void 0,void 0,void 0);var U={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:n}=e,{id:i,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:i,type:r,display:o,uid:n,meta:s}}},render(){const{insertCriterion:e,addGroup:t,blueprintStore:i,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return n&&(l=this.$scopedSlots?.default),l?l({insertCriterion:e,addGroup:t,blueprint:i,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:i.groupedBlueprint()}):null}},Q={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(e,t)=>((e,t,n)=>{const i=r("blueprint"),s=r("builderModeActive");if(!e)throw new Error("useCondition requires an id.");if(!n)throw new Error("useCondition requires a Vue context.");if(!i)throw new Error("Conditions must be rendered within a query.");let l;l=s?i.findCriterion(t.uid):i.addCriterion({id:e,depth:0});const d=(e,t)=>i.updateInput(l,e,t),u=e=>i.switchClause(l,e);o("criterion",l),o("criterionMeta",t.meta),o("updateInput",d),o("switchRefinement",((e,t)=>{i.switchRefinement(l,e,t)})),o("refinementId",null),a((()=>{s||i.removeCriterion(i.indexOfCriterion(l))}));let c=null;return t?.condition?.meta?.clauses&&(c=t.condition.meta.clauses.map((e=>e.component))),()=>n.slots.default?n.slots.default({clauses:c,criterion:l,updateInput:d,switchClause:u}):null})(e.id,e,t)},W={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(e,t)=>((e,t,n)=>{const i=r("criterion"),o=r("updateInput"),s=r("refinementId"),l=r("builderModeActive"),d=e=>{o(e,s)};if(!i)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:e},s);const{clause:n,...r}=i.input;Object.keys(t).length>0&&0===Object.keys(r).length&&o({...t},s)}return a((()=>{l||i.input.clause===e&&o({clause:void 0},s)})),()=>n.slots.default?n.slots.default({setValue:d,...i.input}):null})(e.clause,e,t)},X={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let e=this.$slots?.default;if(n&&(e=this.$scopedSlots?.default),e)return e()}};const Z={name:"selector-option",mixins:[$],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[$],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:n,selector:i}=this;i.registerOption({id:e,display:t||e,...this.$attrs}),n&&i.selectOption(e)},render(){const{isSelected:e}=this;let t=this.$slots?.default;return n&&(t=this.$scopedSlots?.default),t&&e?t():null}}}};var J=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};J._withStripped=!0;const ee=k({render:J,staticRenderFns:[]},undefined,Z,undefined,false,undefined,!1,void 0,void 0,void 0);const te={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:K}};var ne=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};ne._withStripped=!0;const ie=k({render:ne,staticRenderFns:[]},undefined,te,undefined,false,undefined,!1,void 0,void 0,void 0);const re=k({},undefined,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:e}=this;let t=this.$slots?.default;return n&&(t=this.$scopedSlots?.default),t?t({blueprint:e}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0);const oe={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,n=Number(t);isNaN(n)?this.currentValue=t:(this.currentValue=n,this.$emit("input",{value1:n}))}},components:{RefineFlavor:E}};var se=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};se._withStripped=!0;const le=k({render:se,staticRenderFns:[]},undefined,oe,undefined,false,undefined,!1,void 0,void 0,void 0);const ae={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:le,RefineFlavor:E}};var de=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[n("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?n("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),n("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};de._withStripped=!0;const ue=k({render:de,staticRenderFns:[]},undefined,ae,undefined,false,undefined,!1,void 0,void 0,void 0);const ce={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:E}};var pe=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};pe._withStripped=!0;const fe=k({render:pe,staticRenderFns:[]},undefined,ce,undefined,false,undefined,!1,void 0,void 0,void 0);const he={setup(){var e,t;return{flavor:(e="inputs.date.pickerInput",B((t=>{const n=e.split(".");let i=t;for(const e of n)i=i?.[e];return i}),"",i((()=>t)))?.value)}},props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:E}};var me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():n("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?n("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};me._withStripped=!0;const ve=k({render:me,staticRenderFns:[]},undefined,he,undefined,false,undefined,!1,void 0,void 0,void 0);const ge={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:ve},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var ye=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};ye._withStripped=!0;const be=k({render:ye,staticRenderFns:[]},undefined,ge,undefined,false,undefined,!1,void 0,void 0,void 0);const we={name:"refine-double-date-input",components:{DatePicker:ve,RefineFlavor:E},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var Oe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[n("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),n("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),n("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};Oe._withStripped=!0;const xe=k({render:Oe,staticRenderFns:[]},undefined,we,undefined,false,undefined,!1,void 0,void 0,void 0);const _e={name:"refine-date-input",components:{Selector:K,SelectorOption:ee,RefineFlavor:E},mixins:[R],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var Ce=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[n("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),n("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),n("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};Ce._withStripped=!0;const ke=k({render:Ce,staticRenderFns:[]},undefined,_e,undefined,false,undefined,!1,void 0,void 0,void 0);const Se={name:"refine-option-input",components:{Selector:K,SelectorOption:ee},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((n=>{n===e&&(t=!0)})),t}}};var $e=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var i=t.id,r=t.display;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.isSelected(i)}})})),1)};$e._withStripped=!0;const Ie=k({render:$e,staticRenderFns:[]},undefined,Se,undefined,false,undefined,!1,void 0,void 0,void 0);var Re={RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ue,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe};const qe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:W,SelectorOption:ee,Selector:K,...Object.freeze({__proto__:null,default:Re,RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ue,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe})}};var Be=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var i=t.setValue;return[n("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return n("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?n(s,e._b({tag:"component",on:{input:i}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Be._withStripped=!0;const Ee=k({render:Be,staticRenderFns:[]},undefined,qe,undefined,false,undefined,!1,void 0,void 0,void 0);const je={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:Ee,RenderlessRefinement:X,Selector:K,SelectorOption:ee},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var Fe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var i=t.id,r=t.meta,o=t.display;return n("selector-option",{key:i,attrs:{id:i,display:o,selected:!!e.input[i]}},[n("renderless-refinement",{attrs:{id:i}},[n("clause",{attrs:{meta:r,input:e.input[i]},on:{"switch-clause":function(t){var n=t.id;return e.updateInput({clause:n},i)}}})],1)],1)})),1)};Fe._withStripped=!0;const De={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:Ee,Refinements:k({render:Fe,staticRenderFns:[]},undefined,je,undefined,false,undefined,!1,void 0,void 0,void 0),SelectorOption:ee,Selector:K,RefineFlavor:E}};var Ae=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?n("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return n("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[n("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var i=t.id,r=t.display,o=t.meta,s=t.refinements;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.conditionId===i}},[n("div",[n("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?n("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[n("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};Ae._withStripped=!0;const Me={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:e=>n?{}:{key:e},templateChildKey:e=>n?{key:e}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(e){var t;t=e.flavor,o(q,t)},components:{Criterion:k({render:Ae,staticRenderFns:[]},undefined,De,undefined,false,undefined,!1,void 0,void 0,void 0),RefineFlavor:E,RenderlessCondition:Q,RenderlessQueryBuilder:U}};var Ve=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===i.length?n("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[n("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):n("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(i,(function(t,s){return[n("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t){return n("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[n("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(i){var o=i.switchClause;return[n("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[n("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[n("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),n("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s+1,total:i.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),n("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Ve._withStripped=!0;const Pe=k({render:Ve,staticRenderFns:[]},undefined,Me,undefined,false,undefined,!1,void 0,void 0,void 0),Ne="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",Te="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",ze=`${Ne} ${Te} w-60 pl-3 py-2`,Le={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Ne} ${Te} block w-full pl-3 py-2 pr-0`},relative:{class:`${ze} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:ze,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:ze}}},He="bg-white relative text-left cursor-default",Ge=`${He} focus:outline-none pl-3 py-1`,Ye={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${He} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ge} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ge} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ge}}};export{ie as ConditionSelector,d as DatePickerPlugin,re as Query,Pe as QueryBuilder,K as Selector,ee as SelectorOption,Ye as linearFlavor,Le as tailwindFlavor};
import{reactive as e,nextTick as t,isVue2 as n,computed as i,inject as r,provide as o,defineComponent as s,h as l,onUnmounted as a}from"vue-demi";var d={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},u=e=>"conjunction"===(null==e?void 0:e.type),c=Object.defineProperty,p=Object.defineProperties,f=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,m=Object.prototype.hasOwnProperty,v=Object.prototype.propertyIsEnumerable,g=(e,t,n)=>t in e?c(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))m.call(t,n)&&g(e,n,t[n]);if(h)for(var n of h(t))v.call(t,n)&&g(e,n,t[n]);return e},b=(e,t)=>p(e,f(t)),w=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},O=(e,t,n,i)=>{var r,o;const[s]=i||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:y({clause:null==n?void 0:n.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:w()}},x=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:w()}},_=class{constructor(e,t,n){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{n&&n([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?b(y({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||w()}):b(y({},e),{id:void 0,uid:w()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var n={};for(var i in e)m.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&h)for(var i of h(e))t.indexOf(i)<0&&v.call(e,i)&&(n[i]=e[i]);return n})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((t,n)=>{u(t)?"or"===t.word&&e.push([]):e[e.length-1].push(b(y({},t),{position:n}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let n=0;n<this.blueprint.length;n++)if(this.blueprint[n].uid===e){t=n;break}return t}replaceCriterion(e,t){const{meta:n,id:i,refinements:r}=this.findCondition(t.id),o=O(i,1,n,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:t}=this,n=t[e-1],i=t[e+1],r=u(i)&&"or"===i.word,o=u(n)&&"or"===n.word,s=r||!i,l=o||!n,a=l&&!s,d=l&&s;!n&&!i?this.blueprint=[]:d&&o?t.splice(e-1,2):d&&!n||a?t.splice(e,2):t.splice(e-1,2),this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,n=t[0],{meta:i,refinements:r}=n;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:w()}}()),e.push(O(n.id,1,i,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:n}=e,{blueprint:i}=this,r=O(t,n);return 0===i.length?i.push(r):i.splice(i.length,0,x(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:n}=this,i=n[0],{meta:r,refinements:o}=i;return t.splice(e+1,0,x(),O(i.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:n}=this.findCondition(e);let i;return n.forEach((e=>{e.id===t&&(i=e)})),i}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((n=>{n.id===e&&(t=n)})),t}switchClause({uid:e,id:t},n,i){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:n}:this.updateInput({uid:e},{clause:n},i)}switchRefinement({uid:e,id:t},n,i){const r=this.findRefinement(t,i),o=this.findCriterion(e),s=y({},o.input);delete s[n],s[i]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,n){const i=this.findCriterion(e);Object.keys(t).forEach((e=>{n?i.input[n][e]=t[e]:i.input[e]=t[e]})),this.blueprintChanged()}},C=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var n=0;n<this.options.length;n++){if(this.options[n].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.")}const i=this.options[this.options.length-1]||null,r=y({previousOption:i,nextOption:null},e);i&&(i.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((n=>{n.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const n=this.options[t];if(n.id===e)return n}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function k(e,t,n,i,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const u="function"==typeof n?n.options:n;let c;if(e&&e.render&&(u.render=e.render,u.staticRenderFns=e.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),i&&(u._scopeId=i),o?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=c):t&&(c=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),c)if(u.functional){const e=u.render;u.render=function(t,n){return c.call(n),e(t,n)}}else{const e=u.beforeCreate;u.beforeCreate=e?[].concat(e,c):[c]}return n}const S=k({},undefined,{name:"renderless-selector",data:()=>({selector:e(new C),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:n,highlightPreviousOption:i,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i}=this;return{isClosed:e,isOpen:t,selectedOptions:n,highlightedOption:i,options:this.selector.options}}},methods:{nextTick(){return t().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:n}=this,{selectedOption:i}=t.toggleOption(e);return i?this.selectOption(e):this.deselectOption(e),n(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let e=this.$slots?.default;return n&&(e=this.$scopedSlots?.default),e?e({actions:this.actions,...this.state}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0),$={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let I=1;var R={beforeCreate(){this.uid=I.toString(),I+=1}};const q=Symbol();function B(e,t,n=i((()=>({})))){const o=r(q),s=i((()=>e(o)??{})),l=i((()=>{const e={},t=n.value??{};let i=s.value.order;return i&&(e.order="function"==typeof i?i(t):i),e.wrap=s.value.wrap,e})),a=i((()=>{const e={},t=n.value,i=s.value.class;i&&(e.class="function"==typeof i?i(t):i);const r=s.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return i((()=>({component:s.value.component??t.value,props:a,extra:l})))}const E=s({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(e,t){const r=B((t=>{const n=e.component.split(".");let i=t;for(const e of n)i=i?.[e];return i}),i((()=>e.as)),i((()=>({...t.attrs??{},...e.flavorOptions??{}}))));return()=>{const i=r.value,o=i.extra.value.order??e.order,s=function(e,t=[]){const n=Object.assign({},e);for(const e of t)e in n&&delete n[e];return n}(e,["as","component","order"]),a=t.slots;let d="string"==typeof i.component&&i.component.includes("-"),u=d?a:o.map((e=>a?.[e]?.())),c=l(i.component,n?{scopedSlots:a,attrs:{...t.attrs,"data-flavor":e.component},props:s,on:t.listeners,...i.props.value}:{...t.attrs,"data-flavor":e.component,...s,...i.props.value},u);return i.extra.value.wrap?i.extra.value.wrap(c):c}}});const j={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:E}};var F=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?n("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):n("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};F._withStripped=!0;const D=k({render:F,staticRenderFns:[]},undefined,j,undefined,false,undefined,!1,void 0,void 0,void 0);const A={name:"selector-listbox",mixins:[R],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:E}};var M=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[n("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};M._withStripped=!0;const V=k({render:M,staticRenderFns:[]},undefined,A,undefined,false,undefined,!1,void 0,void 0,void 0);const P={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:E}};var N=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[n("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};N._withStripped=!0;const T=k({render:N,staticRenderFns:[]},undefined,P,undefined,false,undefined,!1,void 0,void 0,void 0);const z={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:E}};var L=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var i=t.id,r=t.display;return n("refine-flavor",{key:i,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",i)}}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[n("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};L._withStripped=!0;const H=k({render:L,staticRenderFns:[]},undefined,z,undefined,false,undefined,!1,void 0,void 0,void 0);const G={name:"selector",mixins:[R],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,n){const{value:i}=n;if("function"!=typeof i)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||i()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},n=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:n,unmount:n}}},methods:{updateBuffer(e,t,n){if(!e)return;const i=t.find((t=>t.display.toLowerCase().includes(e)));i&&(n.highlightOption(i),this.scrollIntoView(i.id))},isSelected(e,t){let n=!1;return t.forEach((t=>{e.id===t.id&&(n=!0)})),n},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:n,selectOption:i,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(n(),i(e),await this.close(t))},scrollIntoView(e){if(e){this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})}},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:n}=await e();t&&this.scrollIntoView(n?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:H,RenderlessSelector:S,SelectorListItem:T,SelectorButton:D,SelectorListbox:V,RefineFlavor:E}};var Y=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[n("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[n("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:i.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?n("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)},"deselect-option":function(t){return e.deselectOption(t,i)}}}):n("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(i)},open:function(t){return e.open(i)}}}),e._v(" "),n("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(i)},"highlight-previous-option":function(t){return e.highlightPreviousOption(i)},"select-option":function(t){return e.selectOption(l.id,i)},"buffer-changed":function(t){return e.updateBuffer(t,a,i)},close:function(t){return e.close(i)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return n("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return i.highlightOption(t)},mouseleave:function(e){return i.highlightOption(null)},selected:function(n){return e.selectOption(t.id,i)}}})}))}}],null,!0)})],1),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};Y._withStripped=!0;const K=k({render:Y,staticRenderFns:[]},undefined,G,undefined,false,undefined,!1,void 0,void 0,void 0);var U={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:n}=e,{id:i,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:i,type:r,display:o,uid:n,meta:s}}},render(){const{insertCriterion:e,addGroup:t,blueprintStore:i,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return n&&(l=this.$scopedSlots?.default),l?l({insertCriterion:e,addGroup:t,blueprint:i,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:i.groupedBlueprint()}):null}},Q={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(e,t)=>((e,t,n)=>{const i=r("blueprint"),s=r("builderModeActive");if(!e)throw new Error("useCondition requires an id.");if(!n)throw new Error("useCondition requires a Vue context.");if(!i)throw new Error("Conditions must be rendered within a query.");let l;l=s?i.findCriterion(t.uid):i.addCriterion({id:e,depth:0});const d=(e,t)=>i.updateInput(l,e,t),u=e=>i.switchClause(l,e);o("criterion",l),o("criterionMeta",t.meta),o("updateInput",d),o("switchRefinement",((e,t)=>{i.switchRefinement(l,e,t)})),o("refinementId",null),a((()=>{s||i.removeCriterion(i.indexOfCriterion(l))}));let c=null;return t?.condition?.meta?.clauses&&(c=t.condition.meta.clauses.map((e=>e.component))),()=>n.slots.default?n.slots.default({clauses:c,criterion:l,updateInput:d,switchClause:u}):null})(e.id,e,t)},W={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(e,t)=>((e,t,n)=>{const i=r("criterion"),o=r("updateInput"),s=r("refinementId"),l=r("builderModeActive"),d=e=>{o(e,s)};if(!i)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:e},s);const{clause:n,...r}=i.input;Object.keys(t).length>0&&0===Object.keys(r).length&&o({...t},s)}return a((()=>{l||i.input.clause===e&&o({clause:void 0},s)})),()=>n.slots.default?n.slots.default({setValue:d,...i.input}):null})(e.clause,e,t)},X={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let e=this.$slots?.default;if(n&&(e=this.$scopedSlots?.default),e)return e()}};const Z={name:"selector-option",mixins:[$],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[$],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:n,selector:i}=this;i.registerOption({id:e,display:t||e,...this.$attrs}),n&&i.selectOption(e)},render(){const{isSelected:e}=this;let t=this.$slots?.default;return n&&(t=this.$scopedSlots?.default),t&&e?t():null}}}};var J=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};J._withStripped=!0;const ee=k({render:J,staticRenderFns:[]},undefined,Z,undefined,false,undefined,!1,void 0,void 0,void 0);const te={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:K}};var ne=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};ne._withStripped=!0;const ie=k({render:ne,staticRenderFns:[]},undefined,te,undefined,false,undefined,!1,void 0,void 0,void 0);const re=k({},undefined,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:e}=this;let t=this.$slots?.default;return n&&(t=this.$scopedSlots?.default),t?t({blueprint:e}):null}},undefined,undefined,undefined,!1,void 0,void 0,void 0);const oe={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,n=Number(t);isNaN(n)?this.currentValue=t:(this.currentValue=n,this.$emit("input",{value1:n}))}},components:{RefineFlavor:E}};var se=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};se._withStripped=!0;const le=k({render:se,staticRenderFns:[]},undefined,oe,undefined,false,undefined,!1,void 0,void 0,void 0);const ae={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:le,RefineFlavor:E}};var de=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[n("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?n("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),n("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};de._withStripped=!0;const ue=k({render:de,staticRenderFns:[]},undefined,ae,undefined,false,undefined,!1,void 0,void 0,void 0);const ce={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:E}};var pe=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};pe._withStripped=!0;const fe=k({render:pe,staticRenderFns:[]},undefined,ce,undefined,false,undefined,!1,void 0,void 0,void 0);const he={setup(){var e,t;return{flavor:(e="inputs.date.pickerInput",B((t=>{const n=e.split(".");let i=t;for(const e of n)i=i?.[e];return i}),"",i((()=>t)))?.value)}},props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:E}};var me=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():n("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?n("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};me._withStripped=!0;const ve=k({render:me,staticRenderFns:[]},undefined,he,undefined,false,undefined,!1,void 0,void 0,void 0);const ge={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:ve},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var ye=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};ye._withStripped=!0;const be=k({render:ye,staticRenderFns:[]},undefined,ge,undefined,false,undefined,!1,void 0,void 0,void 0);const we={name:"refine-double-date-input",components:{DatePicker:ve,RefineFlavor:E},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var Oe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[n("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),n("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),n("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};Oe._withStripped=!0;const xe=k({render:Oe,staticRenderFns:[]},undefined,we,undefined,false,undefined,!1,void 0,void 0,void 0);const _e={name:"refine-date-input",components:{Selector:K,SelectorOption:ee,RefineFlavor:E},mixins:[R],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var Ce=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[n("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),n("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),n("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return n("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};Ce._withStripped=!0;const ke=k({render:Ce,staticRenderFns:[]},undefined,_e,undefined,false,undefined,!1,void 0,void 0,void 0);const Se={name:"refine-option-input",components:{Selector:K,SelectorOption:ee},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((n=>{n===e&&(t=!0)})),t}}};var $e=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var i=t.id,r=t.display;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.isSelected(i)}})})),1)};$e._withStripped=!0;const Ie=k({render:$e,staticRenderFns:[]},undefined,Se,undefined,false,undefined,!1,void 0,void 0,void 0);var Re={RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ue,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe};const qe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:W,SelectorOption:ee,Selector:K,...Object.freeze({__proto__:null,default:Re,RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ue,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe})}};var Be=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var i=t.setValue;return[n("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return n("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?n(s,e._b({tag:"component",on:{input:i}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Be._withStripped=!0;const Ee=k({render:Be,staticRenderFns:[]},undefined,qe,undefined,false,undefined,!1,void 0,void 0,void 0);const je={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:Ee,RenderlessRefinement:X,Selector:K,SelectorOption:ee},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var Fe=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var i=t.id,r=t.meta,o=t.display;return n("selector-option",{key:i,attrs:{id:i,display:o,selected:!!e.input[i]}},[n("renderless-refinement",{attrs:{id:i}},[n("clause",{attrs:{meta:r,input:e.input[i]},on:{"switch-clause":function(t){var n=t.id;return e.updateInput({clause:n},i)}}})],1)],1)})),1)};Fe._withStripped=!0;const De={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:Ee,Refinements:k({render:Fe,staticRenderFns:[]},undefined,je,undefined,false,undefined,!1,void 0,void 0,void 0),SelectorOption:ee,Selector:K,RefineFlavor:E}};var Ae=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?n("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return n("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[n("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var i=t.id,r=t.display,o=t.meta,s=t.refinements;return n("selector-option",{key:i,attrs:{id:i,display:r,selected:e.conditionId===i}},[n("div",[n("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?n("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[n("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};Ae._withStripped=!0;const Me={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:e=>n?{}:{key:e},templateChildKey:e=>n?{key:e}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(e){var t;t=e.flavor,o(q,t)},components:{Criterion:k({render:Ae,staticRenderFns:[]},undefined,De,undefined,false,undefined,!1,void 0,void 0,void 0),RefineFlavor:E,RenderlessCondition:Q,RenderlessQueryBuilder:U}};var Ve=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var i=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===i.length?n("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[n("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[n("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):n("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(i,(function(t,s){return[n("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t,i){return n("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[n("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(i){var o=i.switchClause;return[n("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),n("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[n("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[n("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[n("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),n("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),n("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s,total:i.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),n("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Ve._withStripped=!0;const Pe=k({render:Ve,staticRenderFns:[]},undefined,Me,undefined,false,undefined,!1,void 0,void 0,void 0),Ne="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",Te="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",ze=`${Ne} ${Te} w-60 pl-3 py-2`,Le={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Ne} ${Te} block w-full pl-3 py-2 pr-0`},relative:{class:`${ze} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:ze,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:ze}}},He="bg-white relative text-left cursor-default",Ge=`${He} focus:outline-none pl-3 py-1`,Ye={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${He} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ge} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ge} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ge}}};export{ie as ConditionSelector,d as DatePickerPlugin,re as Query,Pe as QueryBuilder,K as Selector,ee as SelectorOption,Ye as linearFlavor,Le as tailwindFlavor};
//# sourceMappingURL=refine-vue.esm.js.map

@@ -1,2 +0,2 @@

import{reactive as e,nextTick as t,isVue2 as i,computed as n,inject as r,provide as o,defineComponent as s,h as l,onUnmounted as a}from"vue-demi";var d={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},c=e=>"conjunction"===(null==e?void 0:e.type),u=Object.defineProperty,p=Object.defineProperties,f=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,g=(e,t,i)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,y=(e,t)=>{for(var i in t||(t={}))v.call(t,i)&&g(e,i,t[i]);if(h)for(var i of h(t))m.call(t,i)&&g(e,i,t[i]);return e},b=(e,t)=>p(e,f(t)),w=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},O=(e,t,i,n)=>{var r,o;const[s]=n||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:y({clause:null==i?void 0:i.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:w()}},x=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:w()}},_=class{constructor(e,t,i){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{i&&i([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?b(y({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||w()}):b(y({},e),{id:void 0,uid:w()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var i={};for(var n in e)v.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&h)for(var n of h(e))t.indexOf(n)<0&&m.call(e,n)&&(i[n]=e[n]);return i})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((t,i)=>{c(t)?"or"===t.word&&e.push([]):e[e.length-1].push(b(y({},t),{position:i}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let i=0;i<this.blueprint.length;i++)if(this.blueprint[i].uid===e){t=i;break}return t}replaceCriterion(e,t){const{meta:i,id:n,refinements:r}=this.findCondition(t.id),o=O(n,1,i,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:t}=this,i=t[e-1],n=t[e+1],r=c(n)&&"or"===n.word,o=c(i)&&"or"===i.word,s=r||!n,l=o||!i,a=l&&!s,d=l&&s;i||n?d&&o?t.splice(e-1,2):d&&!i||a?t.splice(e,2):t.splice(e-1,2):this.blueprint=[],this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,i=t[0],{meta:n,refinements:r}=i;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:w()}}()),e.push(O(i.id,1,n,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:i}=e,{blueprint:n}=this,r=O(t,i);return 0===n.length?n.push(r):n.splice(n.length,0,x(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:i}=this,n=i[0],{meta:r,refinements:o}=n;return t.splice(e+1,0,x(),O(n.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:i}=this.findCondition(e);let n;return i.forEach((e=>{e.id===t&&(n=e)})),n}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((i=>{i.id===e&&(t=i)})),t}switchClause({uid:e,id:t},i,n){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:i}:this.updateInput({uid:e},{clause:i},n)}switchRefinement({uid:e,id:t},i,n){const r=this.findRefinement(t,n),o=this.findCriterion(e),s=y({},o.input);delete s[i],s[n]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,i){const n=this.findCriterion(e);Object.keys(t).forEach((e=>{i?n.input[i][e]=t[e]:n.input[e]=t[e]})),this.blueprintChanged()}},C=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var i=0;i<this.options.length;i++)if(this.options[i].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.");const n=this.options[this.options.length-1]||null,r=y({previousOption:n,nextOption:null},e);n&&(n.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((i=>{i.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const i=this.options[t];if(i.id===e)return i}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function k(e,t,i,n,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const c="function"==typeof i?i.options:i;let u;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),n&&(c._scopeId=n),o?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),u)if(c.functional){const e=c.render;c.render=function(t,i){return u.call(i),e(t,i)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,u):[u]}return i}const S=k({},void 0,{name:"renderless-selector",data:()=>({selector:e(new C),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n}=this;return{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n,options:this.selector.options}}},methods:{nextTick(){return t().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:i}=this,{selectedOption:n}=t.toggleOption(e);return n?this.selectOption(e):this.deselectOption(e),i(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let e=this.$slots?.default;return i&&(e=this.$scopedSlots?.default),e?e({actions:this.actions,...this.state}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),$={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let I=1;var R={beforeCreate(){this.uid=I.toString(),I+=1}};const q=Symbol();function B(e,t,i=n((()=>({})))){const o=r(q),s=n((()=>e(o)??{})),l=n((()=>{const e={},t=i.value??{};let n=s.value.order;return n&&(e.order="function"==typeof n?n(t):n),e.wrap=s.value.wrap,e})),a=n((()=>{const e={},t=i.value??{},n=s.value.class;n&&(e.class="function"==typeof n?n(t):n);const r=s.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return n((()=>({component:s.value.component??t.value,props:a,extra:l})))}const E=s({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(e,t){const r=B((t=>{const i=e.component.split(".");let n=t;for(const e of i)n=n?.[e];return n}),n((()=>e.as)),n((()=>e.flavorOptions)));return()=>{const n=r.value,o=n.extra.value.order??e.order,s=function(e,t=[]){const i=Object.assign({},e);for(const e of t)e in i&&delete i[e];return i}(e,["as","component","order"]),a=t.slots;let d="string"==typeof n.component&&n.component.includes("-")?a:o.map((e=>a?.[e]?.())),c=l(n.component,i?{scopedSlots:a,attrs:{...t.attrs,"data-flavor":e.component},props:s,on:t.listeners,...n.props.value}:{...t.attrs,"data-flavor":e.component,...s,...n.props.value},d);return n.extra.value.wrap?n.extra.value.wrap(c):c}}}),j={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:E}};var F=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?i("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):i("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};F._withStripped=!0;const D=k({render:F,staticRenderFns:[]},void 0,j,void 0,!1,void 0,!1,void 0,void 0,void 0),A={name:"selector-listbox",mixins:[R],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:E}};var V=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[i("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};V._withStripped=!0;const M=k({render:V,staticRenderFns:[]},void 0,A,void 0,!1,void 0,!1,void 0,void 0,void 0),P={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:E}};var N=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[i("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};N._withStripped=!0;const T=k({render:N,staticRenderFns:[]},void 0,P,void 0,!1,void 0,!1,void 0,void 0,void 0),z={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:E}};var L=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var n=t.id,r=t.display;return i("refine-flavor",{key:n,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",n)}}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};L._withStripped=!0;const H=k({render:L,staticRenderFns:[]},void 0,z,void 0,!1,void 0,!1,void 0,void 0,void 0),G={name:"selector",mixins:[R],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,i){const{value:n}=i;if("function"!=typeof n)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||n()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},i=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:i,unmount:i}}},methods:{updateBuffer(e,t,i){if(!e)return;const n=t.find((t=>t.display.toLowerCase().includes(e)));n&&(i.highlightOption(n),this.scrollIntoView(n.id))},isSelected(e,t){let i=!1;return t.forEach((t=>{e.id===t.id&&(i=!0)})),i},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:i,selectOption:n,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(i(),n(e),await this.close(t))},scrollIntoView(e){e&&this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:i}=await e();t&&this.scrollIntoView(i?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:H,RenderlessSelector:S,SelectorListItem:T,SelectorButton:D,SelectorListbox:M,RefineFlavor:E}};var Y=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[i("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[i("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:n.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?i("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)},"deselect-option":function(t){return e.deselectOption(t,n)}}}):i("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)}}}),e._v(" "),i("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(n)},"highlight-previous-option":function(t){return e.highlightPreviousOption(n)},"select-option":function(t){return e.selectOption(l.id,n)},"buffer-changed":function(t){return e.updateBuffer(t,a,n)},close:function(t){return e.close(n)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return i("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return n.highlightOption(t)},mouseleave:function(e){return n.highlightOption(null)},selected:function(i){return e.selectOption(t.id,n)}}})}))}}],null,!0)})],1),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};Y._withStripped=!0;const K=k({render:Y,staticRenderFns:[]},void 0,G,void 0,!1,void 0,!1,void 0,void 0,void 0);var U={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:i}=e,{id:n,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:n,type:r,display:o,uid:i,meta:s}}},render(){const{insertCriterion:e,addGroup:t,blueprintStore:n,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return i&&(l=this.$scopedSlots?.default),l?l({insertCriterion:e,addGroup:t,blueprint:n,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:n.groupedBlueprint()}):null}},Q={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(e,t)=>((e,t,i)=>{const n=r("blueprint"),s=r("builderModeActive");if(!e)throw new Error("useCondition requires an id.");if(!i)throw new Error("useCondition requires a Vue context.");if(!n)throw new Error("Conditions must be rendered within a query.");let l;l=s?n.findCriterion(t.uid):n.addCriterion({id:e,depth:0});const d=(e,t)=>n.updateInput(l,e,t),c=e=>n.switchClause(l,e);o("criterion",l),o("criterionMeta",t.meta),o("updateInput",d),o("switchRefinement",((e,t)=>{n.switchRefinement(l,e,t)})),o("refinementId",null),a((()=>{s||n.removeCriterion(n.indexOfCriterion(l))}));let u=null;return t?.condition?.meta?.clauses&&(u=t.condition.meta.clauses.map((e=>e.component))),()=>i.slots.default?i.slots.default({clauses:u,criterion:l,updateInput:d,switchClause:c}):null})(e.id,e,t)},W={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(e,t)=>((e,t,i)=>{const n=r("criterion"),o=r("updateInput"),s=r("refinementId"),l=r("builderModeActive"),d=e=>{o(e,s)};if(!n)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:e},s);const{clause:i,...r}=n.input;Object.keys(t).length>0&&0===Object.keys(r).length&&o({...t},s)}return a((()=>{l||n.input.clause===e&&o({clause:void 0},s)})),()=>i.slots.default?i.slots.default({setValue:d,...n.input}):null})(e.clause,e,t)},X={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let e=this.$slots?.default;if(i&&(e=this.$scopedSlots?.default),e)return e()}};const Z={name:"selector-option",mixins:[$],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[$],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:i,selector:n}=this;n.registerOption({id:e,display:t||e,...this.$attrs}),i&&n.selectOption(e)},render(){const{isSelected:e}=this;let t=this.$slots?.default;return i&&(t=this.$scopedSlots?.default),t&&e?t():null}}}};var J=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};J._withStripped=!0;const ee=k({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),te={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:K}};var ie=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};ie._withStripped=!0;const ne=k({render:ie,staticRenderFns:[]},void 0,te,void 0,!1,void 0,!1,void 0,void 0,void 0),re=k({},void 0,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:e}=this;let t=this.$slots?.default;return i&&(t=this.$scopedSlots?.default),t?t({blueprint:e}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),oe={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,i=Number(t);isNaN(i)?this.currentValue=t:(this.currentValue=i,this.$emit("input",{value1:i}))}},components:{RefineFlavor:E}};var se=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};se._withStripped=!0;const le=k({render:se,staticRenderFns:[]},void 0,oe,void 0,!1,void 0,!1,void 0,void 0,void 0),ae={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:le,RefineFlavor:E}};var de=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[i("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?i("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),i("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};de._withStripped=!0;const ce=k({render:de,staticRenderFns:[]},void 0,ae,void 0,!1,void 0,!1,void 0,void 0,void 0),ue={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:E}};var pe=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};pe._withStripped=!0;const fe=k({render:pe,staticRenderFns:[]},void 0,ue,void 0,!1,void 0,!1,void 0,void 0,void 0),he={setup:()=>({flavor:("inputs.date.pickerInput",B((e=>{const t="inputs.date.pickerInput".split(".");let i=e;for(const e of t)i=i?.[e];return i}),"",n((()=>{})))?.value)}),props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:E}};var ve=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():i("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?i("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};ve._withStripped=!0;const me=k({render:ve,staticRenderFns:[]},void 0,he,void 0,!1,void 0,!1,void 0,void 0,void 0),ge={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:me},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var ye=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};ye._withStripped=!0;const be=k({render:ye,staticRenderFns:[]},void 0,ge,void 0,!1,void 0,!1,void 0,void 0,void 0),we={name:"refine-double-date-input",components:{DatePicker:me,RefineFlavor:E},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var Oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[i("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),i("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),i("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};Oe._withStripped=!0;const xe=k({render:Oe,staticRenderFns:[]},void 0,we,void 0,!1,void 0,!1,void 0,void 0,void 0),_e={name:"refine-date-input",components:{Selector:K,SelectorOption:ee,RefineFlavor:E},mixins:[R],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var Ce=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[i("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),i("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),i("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};Ce._withStripped=!0;const ke=k({render:Ce,staticRenderFns:[]},void 0,_e,void 0,!1,void 0,!1,void 0,void 0,void 0),Se={name:"refine-option-input",components:{Selector:K,SelectorOption:ee},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((i=>{i===e&&(t=!0)})),t}}};var $e=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var n=t.id,r=t.display;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.isSelected(n)}})})),1)};$e._withStripped=!0;const Ie=k({render:$e,staticRenderFns:[]},void 0,Se,void 0,!1,void 0,!1,void 0,void 0,void 0);var Re={RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ce,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe};const qe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:W,SelectorOption:ee,Selector:K,...Object.freeze({__proto__:null,default:Re,RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ce,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe})}};var Be=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var n=t.setValue;return[i("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return i("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?i(s,e._b({tag:"component",on:{input:n}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Be._withStripped=!0;const Ee=k({render:Be,staticRenderFns:[]},void 0,qe,void 0,!1,void 0,!1,void 0,void 0,void 0),je={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:Ee,RenderlessRefinement:X,Selector:K,SelectorOption:ee},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var Fe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var n=t.id,r=t.meta,o=t.display;return i("selector-option",{key:n,attrs:{id:n,display:o,selected:!!e.input[n]}},[i("renderless-refinement",{attrs:{id:n}},[i("clause",{attrs:{meta:r,input:e.input[n]},on:{"switch-clause":function(t){var i=t.id;return e.updateInput({clause:i},n)}}})],1)],1)})),1)};Fe._withStripped=!0;const De={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:Ee,Refinements:k({render:Fe,staticRenderFns:[]},void 0,je,void 0,!1,void 0,!1,void 0,void 0,void 0),SelectorOption:ee,Selector:K,RefineFlavor:E}};var Ae=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?i("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return i("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[i("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var n=t.id,r=t.display,o=t.meta,s=t.refinements;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.conditionId===n}},[i("div",[i("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?i("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[i("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};Ae._withStripped=!0;const Ve={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:e=>i?{}:{key:e},templateChildKey:e=>i?{key:e}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(e){var t;t=e.flavor,o(q,t)},components:{Criterion:k({render:Ae,staticRenderFns:[]},void 0,De,void 0,!1,void 0,!1,void 0,void 0,void 0),RefineFlavor:E,RenderlessCondition:Q,RenderlessQueryBuilder:U}};var Me=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===n.length?i("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[i("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):i("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(n,(function(t,s){return[i("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t){return i("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[i("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(n){var o=n.switchClause;return[i("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[i("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[i("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),i("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s+1,total:n.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),i("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Me._withStripped=!0;const Pe=k({render:Me,staticRenderFns:[]},void 0,Ve,void 0,!1,void 0,!1,void 0,void 0,void 0),Ne="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",Te="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",ze=`${Ne} ${Te} w-60 pl-3 py-2`,Le={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Ne} ${Te} block w-full pl-3 py-2 pr-0`},relative:{class:`${ze} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:ze,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:ze}}},He="bg-white relative text-left cursor-default",Ge=`${He} focus:outline-none pl-3 py-1`,Ye={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${He} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ge} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ge} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ge}}};export{ne as ConditionSelector,d as DatePickerPlugin,re as Query,Pe as QueryBuilder,K as Selector,ee as SelectorOption,Ye as linearFlavor,Le as tailwindFlavor};
import{reactive as e,nextTick as t,isVue2 as i,computed as n,inject as r,provide as o,defineComponent as s,h as l,onUnmounted as a}from"vue-demi";var d={install:(e,{DatePicker:t})=>{e.component("refine-date-picker",t)}},c=e=>"conjunction"===(null==e?void 0:e.type),u=Object.defineProperty,p=Object.defineProperties,f=Object.getOwnPropertyDescriptors,h=Object.getOwnPropertySymbols,v=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,g=(e,t,i)=>t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,y=(e,t)=>{for(var i in t||(t={}))v.call(t,i)&&g(e,i,t[i]);if(h)for(var i of h(t))m.call(t,i)&&g(e,i,t[i]);return e},b=(e,t)=>p(e,f(t)),w=function(){return`${~~(1e4*Math.random()+1e4)}-${~~(Date.now()/1e3)}`},O=(e,t,i,n)=>{var r,o;const[s]=n||[];return{id:e,condition_id:e,depth:t,type:"criterion",input:y({clause:null==i?void 0:i.clauses[0].id},s&&{[s.id]:{clause:null==(o=null==(r=null==s?void 0:s.meta)?void 0:r.clauses[0])?void 0:o.id}}),uid:w()}},x=function(e=1){return{id:void 0,depth:e,type:"conjunction",word:"and",uid:w()}},_=class{constructor(e,t,i){e=e||[],t=t||[],this.conditions=t,this.blueprint=this.mapBlueprint(e),this.blueprintChanged=()=>{i&&i([...this.blueprint])},this.blueprintChanged()}mapBlueprint(e){return e.map((e=>{return"criterion"===(null==(t=e)?void 0:t.type)?b(y({},e),{id:e.condition_id,uid:(null==e?void 0:e.uid)||w()}):b(y({},e),{id:void 0,uid:w()});var t}))}getBlueprint(){return this.blueprint.map((e=>((e,t)=>{var i={};for(var n in e)v.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&h)for(var n of h(e))t.indexOf(n)<0&&m.call(e,n)&&(i[n]=e[n]);return i})(e,["id","uid"])))}updateBlueprint(e){this.blueprint=this.mapBlueprint(e)}groupedBlueprint(){if(0===this.blueprint.length)return[];const e=[];return e.push([]),this.blueprint.forEach(((t,i)=>{c(t)?"or"===t.word&&e.push([]):e[e.length-1].push(b(y({},t),{position:i}))})),e}indexOfCriterion({uid:e}){let t=-1;for(let i=0;i<this.blueprint.length;i++)if(this.blueprint[i].uid===e){t=i;break}return t}replaceCriterion(e,t){const{meta:i,id:n,refinements:r}=this.findCondition(t.id),o=O(n,1,i,r);this.blueprint.splice(e,1,o),this.blueprintChanged()}removeCriterion(e){const{blueprint:t}=this,i=t[e-1],n=t[e+1],r=c(n)&&"or"===n.word,o=c(i)&&"or"===i.word,s=r||!n,l=o||!i,a=l&&!s,d=l&&s;i||n?d&&o?t.splice(e-1,2):d&&!i||a?t.splice(e,2):t.splice(e-1,2):this.blueprint=[],this.blueprintChanged()}findCriterion(e){const t=this.indexOfCriterion({uid:e});return this.blueprint[t]}addGroup(){const{blueprint:e,conditions:t}=this,i=t[0],{meta:n,refinements:r}=i;e.length>0&&e.push(function(e=0){return{id:void 0,depth:e,type:"conjunction",word:"or",uid:w()}}()),e.push(O(i.id,1,n,r)),this.blueprintChanged()}addCriterion(e){const{id:t,depth:i}=e,{blueprint:n}=this,r=O(t,i);return 0===n.length?n.push(r):n.splice(n.length,0,x(),r),this.blueprintChanged(),r}insertCriterion(e){const{blueprint:t,conditions:i}=this,n=i[0],{meta:r,refinements:o}=n;return t.splice(e+1,0,x(),O(n.id,1,r,o)),this.blueprintChanged(),t[e+1]}findRefinement(e,t){const{refinements:i}=this.findCondition(e);let n;return i.forEach((e=>{e.id===t&&(n=e)})),n}findCondition(e){let t=this.conditions[0];return this.conditions.forEach((i=>{i.id===e&&(t=i)})),t}switchClause({uid:e,id:t},i,n){const{meta:r}=this.findCondition(t),o=this.findCriterion(e);Array.isArray(r.options)?o.input={clause:i}:this.updateInput({uid:e},{clause:i},n)}switchRefinement({uid:e,id:t},i,n){const r=this.findRefinement(t,n),o=this.findCriterion(e),s=y({},o.input);delete s[i],s[n]={clause:r.meta.clauses[0].id},o.input=s}updateInput({uid:e},t,i){const n=this.findCriterion(e);Object.keys(t).forEach((e=>{i?n.input[i][e]=t[e]:n.input[e]=t[e]})),this.blueprintChanged()}},C=class{constructor(){this.options=[],this.selectedOptions=[]}registerOption(e){const{id:t}=e;for(var i=0;i<this.options.length;i++)if(this.options[i].id===t)throw new Error("An option with id ${optionId} has already been registered for this selector.");const n=this.options[this.options.length-1]||null,r=y({previousOption:n,nextOption:null},e);n&&(n.nextOption=r),this.options.push(r)}isSelected(e){let t=!1;return this.selectedOptions.forEach((i=>{i.id===e&&(t=!0)})),t}findOption(e){for(var t=0;t<this.options.length;t++){const i=this.options[t];if(i.id===e)return i}return null}toggleOption(e){return this.isSelected(e)?this.deselectOption(e):this.selectOption(e)}clearSelectedOptions(){this.selectedOptions.splice(0,this.selectedOptions.length)}deselectOption(e){const t=this.findOption(e);return this.selectedOptions=this.selectedOptions.filter((t=>t.id!==e)),{deselectedOption:t,selectedOptions:this.selectedOptions}}selectOption(e){const t=this.findOption(e);return this.isSelected(e)||this.selectedOptions.push(t),{selectedOption:t,selectedOptions:this.selectedOptions}}};function k(e,t,i,n,r,o,s,l,a,d){"boolean"!=typeof s&&(a=l,l=s,s=!1);const c="function"==typeof i?i.options:i;let u;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,r&&(c.functional=!0)),n&&(c._scopeId=n),o?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(o)},c._ssrRegister=u):t&&(u=s?function(e){t.call(this,d(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,l(e))}),u)if(c.functional){const e=c.render;c.render=function(t,i){return u.call(i),e(t,i)}}else{const e=c.beforeCreate;c.beforeCreate=e?[].concat(e,u):[u]}return i}const S=k({},void 0,{name:"renderless-selector",data:()=>({selector:e(new C),isClosed:!0,highlightedOption:null}),emits:["select-option","deselect-option"],provide(){return{selector:this.selector}},computed:{selectedOptions(){return this.selector.selectedOptions},firstSelectedOption(){return this.selectedOptions[0]||this.selector.options[0]},isOpen(){return!this.isClosed},actions:function(){const{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}=this;return{clearOptions:e,close:t,highlightNextOption:i,highlightPreviousOption:n,highlightOption:r,open:o,selectOption:s,selectedOptions:l,toggle:a,toggleOption:d}},state:function(){const{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n}=this;return{isClosed:e,isOpen:t,selectedOptions:i,highlightedOption:n,options:this.selector.options}}},methods:{nextTick(){return t().then((()=>({actions:this.actions,...this.state})))},close(){return this.isClosed||(this.isClosed=!0),this.nextTick()},open(){return this.isClosed=!1,this.highlightedOption=this.firstSelectedOption,this.nextTick()},toggle(){return this.isClosed?this.open():this.close(),this.nextTick()},toggleOption(e){const{selector:t,highlightOption:i}=this,{selectedOption:n}=t.toggleOption(e);return n?this.selectOption(e):this.deselectOption(e),i(t.findOption(e))},clearOptions(){this.selector.clearSelectedOptions()},deselectOption(e){this.$emit("deselect-option",this.selector.deselectOption(e))},selectOption(e){this.$emit("select-option",this.selector.selectOption(e))},highlightOption(e){return this.highlightedOption=e,this.nextTick()},highlightNextOption(){const e=this.highlightedOption?.nextOption;return e&&(this.highlightedOption=e),this.nextTick()},highlightPreviousOption(){const e=this.highlightedOption?.previousOption;return e&&(this.highlightedOption=e),this.nextTick()}},render(){let e=this.$slots?.default;return i&&(e=this.$scopedSlots?.default),e?e({actions:this.actions,...this.state}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),$={props:{id:{type:[String,Number],required:!0},display:{type:String,required:!1},selected:{type:Boolean,required:!1,default:!1}}};let I=1;var R={beforeCreate(){this.uid=I.toString(),I+=1}};const q=Symbol();function B(e,t,i=n((()=>({})))){const o=r(q),s=n((()=>e(o)??{})),l=n((()=>{const e={},t=i.value??{};let n=s.value.order;return n&&(e.order="function"==typeof n?n(t):n),e.wrap=s.value.wrap,e})),a=n((()=>{const e={},t=i.value,n=s.value.class;n&&(e.class="function"==typeof n?n(t):n);const r=s.value.style;return r&&(e.style="function"==typeof r?r(t):r),e}));return n((()=>({component:s.value.component??t.value,props:a,extra:l})))}const E=s({name:"RefineFlavor",props:{as:{type:String,default:"div"},order:{type:Array,default:()=>["default"]},component:{type:String,required:!0},flavorOptions:{type:Object,required:!1}},inheritAttrs:!1,setup(e,t){const r=B((t=>{const i=e.component.split(".");let n=t;for(const e of i)n=n?.[e];return n}),n((()=>e.as)),n((()=>({...t.attrs??{},...e.flavorOptions??{}}))));return()=>{const n=r.value,o=n.extra.value.order??e.order,s=function(e,t=[]){const i=Object.assign({},e);for(const e of t)e in i&&delete i[e];return i}(e,["as","component","order"]),a=t.slots;let d="string"==typeof n.component&&n.component.includes("-")?a:o.map((e=>a?.[e]?.())),c=l(n.component,i?{scopedSlots:a,attrs:{...t.attrs,"data-flavor":e.component},props:s,on:t.listeners,...n.props.value}:{...t.attrs,"data-flavor":e.component,...s,...n.props.value},d);return n.extra.value.wrap?n.extra.value.wrap(c):c}}}),j={name:"selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},display:{type:String,required:!0}},methods:{label:function(){return this.display?`${this.display} Selected`:"Choose an option"},focus:function(){this.$refs.button.$el.focus()}},components:{RefineFlavor:E}};var F=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"button",component:"select.button",id:e.id,type:"button","aria-haspopup":"listbox","aria-expanded":e.isOpen,"aria-label":e.label()},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}}},[0===e.display.length?i("refine-flavor",{attrs:{as:"span",component:"select.button.placeholder"}},[e._v("\n Choose an option\n ")]):i("refine-flavor",{attrs:{as:"span",component:"select.button.selected"}},[e._v("\n "+e._s(e.display)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)};F._withStripped=!0;const D=k({render:F,staticRenderFns:[]},void 0,j,void 0,!1,void 0,!1,void 0,void 0,void 0),A={name:"selector-listbox",mixins:[R],data:()=>({buffer:"",clearBufferTimeout:null}),props:{isClosed:{type:Boolean,required:!1,default:!0},selectedOption:{type:Object,required:!1}},watch:{isClosed(e){e||this.$nextTick((()=>this.$refs.listBox.$el.focus()))},buffer(e){this.$emit("buffer-changed",e)}},methods:{createItemId:function(e){return`listbox-option-${this.uid}-${e}`},handleKeypress(e){new RegExp(/[a-zA-Z\d ]/).test(e.key)&&1===e.key.length&&(this.buffer+=e.key,this.preserveBuffer())},clearBuffer(){this.buffer=this.buffer.slice(0,-1),this.preserveBuffer()},preserveBuffer(){return clearTimeout(this.clearBufferTimeout),this.clearBufferTimeout=setTimeout((()=>{this.buffer=""}),1500),!0}},components:{RefineFlavor:E}};var V=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"select.listbox.wrapper"}},[i("refine-flavor",{ref:"listBox",attrs:{as:"ul",component:"select.listbox",flavorOptions:{isClosed:e.isClosed},tabindex:"-1",role:"listbox","aria-activedescendant":e.selectedOption?e.createItemId(e.selectedOption.id):""},on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.stopPropagation(),t.preventDefault(),e.clearBuffer.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-next-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-up",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),function(){return e.preserveBuffer()&&e.$emit("highlight-previous-option")}.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("select-option"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"escape",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("close"))},function(t){return e.handleKeypress(t)}]}},[e._t("default",null,{createItemId:e.createItemId})],2)],1)};V._withStripped=!0;const M=k({render:V,staticRenderFns:[]},void 0,A,void 0,!1,void 0,!1,void 0,void 0,void 0),P={name:"selector-list-item",props:{optionId:{type:[String,Number],required:!0},optionDisplay:{type:String,required:!0},selected:{type:Boolean,required:!1,default:!1},isHighlighted:{type:Boolean,required:!1,default:!1}},emits:["selected","mouseenter","mouseleave"],components:{RefineFlavor:E}};var N=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{key:e.optionId,ref:"listItem",attrs:{as:"li",component:"select.listbox.item",flavorOptions:{isHighlighted:e.isHighlighted},role:"option","aria-label":e.optionDisplay,"aria-selected":e.selected},on:{mouseenter:function(t){return e.$emit("mouseenter")},mouseleave:function(t){return e.$emit("mouseleave")},click:function(t){return e.$emit("selected")}}},[i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.text",flavorOptions:{selected:e.selected}}},[e._v("\n "+e._s(e.optionDisplay)+"\n ")]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.listbox.item.icon.wrapper",flavorOptions:{isHighlighted:e.isHighlighted}}},[i("refine-flavor",{directives:[{name:"show",rawName:"v-show",value:e.selected,expression:"selected"}],attrs:{as:"svg",component:"select.listbox.item.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":!e.selected}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z","clip-rule":"evenodd"}})])],1)],1)};N._withStripped=!0;const T=k({render:N,staticRenderFns:[]},void 0,P,void 0,!1,void 0,!1,void 0,void 0,void 0),z={name:"multi-selector-button",props:{id:{type:String,required:!0},isOpen:{type:Boolean,required:!0},selectedOptions:{type:Array,required:!0}},methods:{label:function(){const e=`${this.selectedOptions.map((({display:e})=>e)).join(", ")} Selected`;return 0===this.selectedOptions.length?"Choose an option":e},focus:function(){this.$refs.button.focus()}},components:{RefineFlavor:E}};var L=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{ref:"button",attrs:{as:"div",component:"select.multi.button",id:e.id,"aria-haspopup":"listbox","aria-label":e.label(),"aria-expanded":e.isOpen,tabindex:"0"},on:{click:function(t){return t.preventDefault(),e.$emit("toggle")},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"arrow-down",void 0,t.key,void 0)?null:(t.stopPropagation(),t.preventDefault(),e.$emit("open"))}]}},[0===e.selectedOptions.length?i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.placeholder"}},[e._v("\n Choose an option\n ")]):e._l(e.selectedOptions,(function(t){var n=t.id,r=t.display;return i("refine-flavor",{key:n,attrs:{as:"span",component:"select.multi.button.selected"}},[e._v("\n "+e._s(r)+"\n "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.deselect.icon.wrapper"},on:{click:function(t){return t.preventDefault(),e.$emit("deselect-option",n)}}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.deselect.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"select.multi.button.icon.wrapper"}},[i("refine-flavor",{attrs:{as:"svg",component:"select.multi.button.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 3a1 1 0 01.707.293l3 3a1 1 0 01-1.414 1.414L10 5.414 7.707 7.707a1 1 0 01-1.414-1.414l3-3A1 1 0 0110 3zm-3.707 9.293a1 1 0 011.414 0L10 14.586l2.293-2.293a1 1 0 011.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z","clip-rule":"evenodd"}})])],1)],2)};L._withStripped=!0;const H=k({render:L,staticRenderFns:[]},void 0,z,void 0,!1,void 0,!1,void 0,void 0,void 0),G={name:"selector",mixins:[R],inject:["builderModeActive"],props:{isMultiSelect:{type:Boolean,required:!1,default:!1},innerClass:{type:String,required:!1,default:""}},emits:["select-option","deselect-option"],computed:{selectorId(){return this.uid},buttonId(){return`button-${this.selectorId}`}},mounted(){this.builderModeActive&&this.$refs.button.$el.focus()},directives:{clickAway:new function(){const e={},t=function(t,i){const{value:n}=i;if("function"!=typeof n)throw new Error("The click-away directive expects a function/method as an argument.");if(!t.id)throw new Error("The click-away directive requires the element it is bound to to have an id.");const r=e=>{t.contains(e.target)||n()};e[t.id]=r,document.addEventListener("click",r),document.addEventListener("touchstart",r)},i=function(t){document.removeEventListener("click",e[t.id]),document.removeEventListener("touchstart",e[t.id]),delete e[t.id]};return{bind:t,beforeMount:t,unbind:i,unmount:i}}},methods:{updateBuffer(e,t,i){if(!e)return;const n=t.find((t=>t.display.toLowerCase().includes(e)));n&&(i.highlightOption(n),this.scrollIntoView(n.id))},isSelected(e,t){let i=!1;return t.forEach((t=>{e.id===t.id&&(i=!0)})),i},deselectOption(e,{toggleOption:t}){t(e)},async selectOption(e,t){const{clearOptions:i,selectOption:n,toggleOption:r}=t,{isMultiSelect:o}=this;o?r(e):(i(),n(e),await this.close(t))},scrollIntoView(e){e&&this.$refs[e][0].$el.scrollIntoView({behavior:"smooth",block:"nearest",inline:"start"})},async close({close:e}){const{isClosed:t}=await e();t&&this.$refs.button?.$el?.focus()},async open({open:e}){const{selectedOption:t}=await e();this.scrollIntoView(t?.id)},async toggle({toggle:e}){const{isOpen:t,selectedOption:i}=await e();t&&this.scrollIntoView(i?.id)},async highlightNextOption({highlightNextOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)},async highlightPreviousOption({highlightPreviousOption:e}){const{highlightedOption:t}=await e();this.scrollIntoView(t?.id)}},components:{MultiSelectorButton:H,RenderlessSelector:S,SelectorListItem:T,SelectorButton:D,SelectorListbox:M,RefineFlavor:E}};var Y=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-selector",{on:{"select-option":function(t){return e.$emit("select-option",t)},"deselect-option":function(t){return e.$emit("deselect-option",t)}},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.actions,r=t.isOpen,o=t.isClosed,s=t.selectedOptions,l=t.highlightedOption,a=t.options;return[i("refine-flavor",{attrs:{as:"div",component:"select.wrapper"}},[i("refine-flavor",{directives:[{name:"click-away",rawName:"v-click-away",value:n.close,expression:"actions.close"}],class:e.innerClass,attrs:{as:"div",component:"select",id:"listbox-"+e.selectorId,"aria-labelledby":e.buttonId}},[e.isMultiSelect?i("multi-selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,selectedOptions:s},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)},"deselect-option":function(t){return e.deselectOption(t,n)}}}):i("selector-button",{ref:"button",attrs:{id:e.buttonId,isOpen:r,display:s[0]?s[0].display:""},on:{toggle:function(t){return e.toggle(n)},open:function(t){return e.open(n)}}}),e._v(" "),i("selector-listbox",{ref:"listBox",attrs:{selectedOption:s[0],isClosed:o},on:{"highlight-next-option":function(t){return e.highlightNextOption(n)},"highlight-previous-option":function(t){return e.highlightPreviousOption(n)},"select-option":function(t){return e.selectOption(l.id,n)},"buffer-changed":function(t){return e.updateBuffer(t,a,n)},close:function(t){return e.close(n)}},scopedSlots:e._u([{key:"default",fn:function(t){var r=t.createItemId;return e._l(a,(function(t){return i("selector-list-item",{key:t.id,ref:t.id,refInFor:!0,attrs:{id:r(t.id),optionId:t.id,optionDisplay:t.display,selected:e.isSelected(t,s),isHighlighted:l&&t.id===l.id},on:{mouseenter:function(e){return n.highlightOption(t)},mouseleave:function(e){return n.highlightOption(null)},selected:function(i){return e.selectOption(t.id,n)}}})}))}}],null,!0)})],1),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"customOptions.wrapper"}},[e._t("default")],2)],1)]}}],null,!0)})};Y._withStripped=!0;const K=k({render:Y,staticRenderFns:[]},void 0,G,void 0,!1,void 0,!1,void 0,void 0,void 0);var U={name:"renderless-query-builder",emits:["change"],props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!0}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!0}},data(){return{conditionsLookup:this.conditions.reduce(((e,t)=>(e[t.id]=t,e)),{}),internalBlueprint:null,blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.internalBlueprint=e,this.$emit("change",e)}))}},methods:{replaceCriterion(e,t){this.blueprintStore.replaceCriterion(e,t)},insertCriterion(e){this.blueprintStore.insertCriterion(e)},removeCriterion(e){this.blueprintStore.removeCriterion(e)},addGroup(){this.blueprintStore.addGroup()},conditionFor(e){const{id:t,uid:i}=e,{id:n,type:r,display:o,meta:s}=this.conditionsLookup[t];return{id:n,type:r,display:o,uid:i,meta:s}}},render(){const{insertCriterion:e,addGroup:t,blueprintStore:n,conditionFor:r,replaceCriterion:o,removeCriterion:s}=this;let l=this.$slots?.default;return i&&(l=this.$scopedSlots?.default),l?l({insertCriterion:e,addGroup:t,blueprint:n,conditionFor:r,removeCriterion:s,replaceCriterion:o,groupedBlueprint:n.groupedBlueprint()}):null}},Q={name:"renderless-condition",inheritAttrs:!1,props:{id:{type:String,required:!0},display:{type:String,required:!0},uid:{type:String,required:!0},meta:{type:Object,required:!0}},setup:(e,t)=>((e,t,i)=>{const n=r("blueprint"),s=r("builderModeActive");if(!e)throw new Error("useCondition requires an id.");if(!i)throw new Error("useCondition requires a Vue context.");if(!n)throw new Error("Conditions must be rendered within a query.");let l;l=s?n.findCriterion(t.uid):n.addCriterion({id:e,depth:0});const d=(e,t)=>n.updateInput(l,e,t),c=e=>n.switchClause(l,e);o("criterion",l),o("criterionMeta",t.meta),o("updateInput",d),o("switchRefinement",((e,t)=>{n.switchRefinement(l,e,t)})),o("refinementId",null),a((()=>{s||n.removeCriterion(n.indexOfCriterion(l))}));let u=null;return t?.condition?.meta?.clauses&&(u=t.condition.meta.clauses.map((e=>e.component))),()=>i.slots.default?i.slots.default({clauses:u,criterion:l,updateInput:d,switchClause:c}):null})(e.id,e,t)},W={name:"renderless-clause",inheritAttrs:!1,props:{clause:{type:String,required:!0}},setup:(e,t)=>((e,t,i)=>{const n=r("criterion"),o=r("updateInput"),s=r("refinementId"),l=r("builderModeActive"),d=e=>{o(e,s)};if(!n)throw new Error("A clause must be used within a criterion.");if(!l){o({clause:e},s);const{clause:i,...r}=n.input;Object.keys(t).length>0&&0===Object.keys(r).length&&o({...t},s)}return a((()=>{l||n.input.clause===e&&o({clause:void 0},s)})),()=>i.slots.default?i.slots.default({setValue:d,...n.input}):null})(e.clause,e,t)},X={name:"renderless-refinement",inject:["updateInput"],props:{id:{type:String,required:!0}},provide(){return{refinementId:this.id}},render(){let e=this.$slots?.default;if(i&&(e=this.$scopedSlots?.default),e)return e()}};const Z={name:"selector-option",mixins:[$],components:{RenderlessOption:{name:"renderless-option",inject:["selector"],mixins:[$],computed:{isSelected:function(){const{selector:e,id:t}=this;return e.isSelected(t)}},created(){const{id:e,display:t,selected:i,selector:n}=this;n.registerOption({id:e,display:t||e,...this.$attrs}),i&&n.selectOption(e)},render(){const{isSelected:e}=this;let t=this.$slots?.default;return i&&(t=this.$scopedSlots?.default),t&&e?t():null}}}};var J=function(){var e=this,t=e.$createElement;return(e._self._c||t)("renderless-option",{attrs:{id:e.id,display:e.display,selected:e.selected}},[e._t("default")],2)};J._withStripped=!0;const ee=k({render:J,staticRenderFns:[]},void 0,Z,void 0,!1,void 0,!1,void 0,void 0,void 0),te={name:"condition-selector",emits:["select-condition"],methods:{selectOption(e){this.$emit("select-condition",e)}},components:{Selector:K}};var ie=function(){var e=this,t=e.$createElement;return(e._self._c||t)("selector",{on:{"select-option":e.selectOption}},[e._t("default")],2)};ie._withStripped=!0;const ne=k({render:ie,staticRenderFns:[]},void 0,te,void 0,!1,void 0,!1,void 0,void 0,void 0),re=k({},void 0,{props:{blueprint:{type:Array,required:!1},conditions:{type:Array,required:!1}},provide(){const{blueprintStore:e}=this;return{blueprint:e,builderModeActive:!1}},data(){return{blueprintStore:new _(this.blueprint,this.conditions,(e=>{this.$emit("change",e)}))}},render(){const{blueprintStore:e}=this;let t=this.$slots?.default;return i&&(t=this.$scopedSlots?.default),t?t({blueprint:e}):null}},void 0,void 0,void 0,!1,void 0,void 0,void 0),oe={name:"refine-number-input",data(){return{currentValue:this.value1}},emits:["input"],props:{value1:{type:[Number,String],required:!1},meta:{type:Object,required:!1,default:()=>({})}},computed:{metaAttributes(){return["min","max","step","placeholder"].reduce(((e,t)=>(Object.prototype.hasOwnProperty.call(this.meta,t)&&""!==this.meta[t]&&(e[t]=this.meta[t]),e)),{})}},methods:{handleInputChange:function(e){const t=e.target.value,i=Number(t);isNaN(i)?this.currentValue=t:(this.currentValue=i,this.$emit("input",{value1:i}))}},components:{RefineFlavor:E}};var se=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",e._b({attrs:{as:"input",component:"inputs.number",type:"number",value:e.currentValue},on:{input:e.handleInputChange}},"refine-flavor",e.metaAttributes,!1))};se._withStripped=!0;const le=k({render:se,staticRenderFns:[]},void 0,oe,void 0,!1,void 0,!1,void 0,void 0,void 0),ae={name:"refine-double-number-input",data(){return{currentValue:this.value}},emits:["input"],computed:{joinWord(){return Object.prototype.hasOwnProperty.call(this.meta,"joiner")?this.meta.joiner:"and"}},methods:{updateFirstValue:function({value1:e}){this.$emit("input",{value1:e})},updateSecondValue:function({value1:e}){this.$emit("input",{value2:e})}},props:{value1:{type:[String,Number],required:!1},value2:{type:[String,Number],required:!1},meta:{type:Object,required:!1,default:()=>({})}},components:{NumberInput:le,RefineFlavor:E}};var de=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.number.double.wrapper"}},[i("number-input",{attrs:{meta:e.meta,value:e.value1},on:{input:e.updateFirstValue}}),e._v(" "),e.joinWord?i("refine-flavor",{attrs:{as:"span",component:"inputs.number.double.joiner"}},[e._v(e._s(e.joinWord)+"\n ")]):e._e(),e._v(" "),i("number-input",{attrs:{meta:e.meta,value:e.value2},on:{input:e.updateSecondValue}})],1)};de._withStripped=!0;const ce=k({render:de,staticRenderFns:[]},void 0,ae,void 0,!1,void 0,!1,void 0,void 0,void 0),ue={name:"refine-text-input",props:{value:{type:String,required:!1,default:""}},emits:["input"],components:{RefineFlavor:E}};var pe=function(){var e=this,t=e.$createElement;return(e._self._c||t)("refine-flavor",{attrs:{as:"input",component:"inputs.text",type:"text",value:e.value},on:{input:function(t){return e.$emit("input",{value:t.target.value})}}})};pe._withStripped=!0;const fe=k({render:pe,staticRenderFns:[]},void 0,ue,void 0,!1,void 0,!1,void 0,void 0,void 0),he={setup:()=>({flavor:("inputs.date.pickerInput",B((e=>{const t="inputs.date.pickerInput".split(".");let i=e;for(const e of t)i=i?.[e];return i}),"",n((()=>{})))?.value)}),props:{date:{type:String,required:!1},format:{type:String,required:!1,default:"MM/DD/YYYY"}},emits:["input"],data(){const{date:e}=this;return{time:e,hasError:!1,inputClass:this.flavor.props.value?.class,errorClass:this.flavor.props.value?.class}},methods:{handleInputError:function(){this.hasError=!0},handleInput:function(){this.hasError=!1,this.$emit("input",{date:this.time})}},components:{RefineFlavor:E}};var ve=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",e._b({attrs:{as:"refine-date-picker",component:"inputs.date","value-type":"YYYY-MM-DD",format:e.format,"input-class":e.hasError?e.inputClass+e.errorClass:e.inputClass},on:{input:e.handleInput,change:e.handleInput,"input-error":e.handleInputError},scopedSlots:e._u([{key:"icon-calendar",fn:function(){return[e.hasError?e._e():i("refine-flavor",{attrs:{as:"svg",component:"input.date.calendar.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z","clip-rule":"evenodd"}})]),e._v(" "),e.hasError?i("refine-flavor",{attrs:{as:"svg",component:"input.date.error.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z","clip-rule":"evenodd"}})]):e._e()]},proxy:!0}]),model:{value:e.time,callback:function(t){e.time=t},expression:"time"}},"refine-flavor",e.$attrs,!1))};ve._withStripped=!0;const me=k({render:ve,staticRenderFns:[]},void 0,he,void 0,!1,void 0,!1,void 0,void 0,void 0),ge={name:"refine-date-input",props:{date1:{type:String,required:!1}},emits:["input"],components:{DatePicker:me},methods:{handleInput:function({date:e}){this.$emit("input",{date1:e})}}};var ye=function(){var e=this,t=e.$createElement;return(e._self._c||t)("date-picker",e._b({attrs:{date:e.date1},on:{input:e.handleInput}},"date-picker",e.$attrs,!1))};ye._withStripped=!0;const be=k({render:ye,staticRenderFns:[]},void 0,ge,void 0,!1,void 0,!1,void 0,void 0,void 0),we={name:"refine-double-date-input",components:{DatePicker:me,RefineFlavor:E},emits:["input"],props:{date1:{type:String,required:!1},date2:{type:String,required:!1},joiner:{type:String,required:!1,default:"and"}},methods:{updateFirstDate:function({date:e}){this.$emit("input",{date1:e})},updateSecondDate:function({date:e}){this.$emit("input",{date2:e})}}};var Oe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.double.wrapper"}},[i("date-picker",e._b({attrs:{date:e.date1},on:{input:e.updateFirstDate}},"date-picker",e.$attrs,!1)),e._v(" "),i("refine-flavor",{attrs:{as:"p",component:"inputs.date.double.joiner"}},[e._v(e._s(e.joiner))]),e._v(" "),i("date-picker",e._b({attrs:{date:e.date2},on:{input:e.updateSecondDate}},"date-picker",e.$attrs,!1))],1)};Oe._withStripped=!0;const xe=k({render:Oe,staticRenderFns:[]},void 0,we,void 0,!1,void 0,!1,void 0,void 0,void 0),_e={name:"refine-date-input",components:{Selector:K,SelectorOption:ee,RefineFlavor:E},mixins:[R],emits:["input"],props:{amount:{type:[String,Number],required:!1},unit:{type:String,required:!1},modifier:{type:String,required:!1},units:{type:Array,required:!0},modifiers:{type:Array,required:!0}},created(){const{modifier:e}=this;this.$emit("input",{modifier:e})},methods:{updateModifier({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{modifier:t[0]})},updateAmount:function(e){const t=e.target.value;this.$emit("input",{amount:t})},updateUnit:function({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{unit:t[0]})}}};var Ce=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{as:"div",component:"inputs.date.relative.wrapper"}},[i("refine-flavor",{attrs:{as:"input",component:"inputs.date.relative",type:"number",name:"amount",value:e.amount},on:{input:e.updateAmount}}),e._v(" "),i("selector",{on:{"select-option":e.updateUnit}},e._l(e.units,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,display:t.display,selected:t.id===e.unit}})})),1),e._v(" "),i("selector",{on:{"select-option":e.updateModifier}},e._l(e.modifiers,(function(t){return i("selector-option",{key:t.id,attrs:{id:t.id,selected:t.id===e.modifier,display:t.display}})})),1)],1)};Ce._withStripped=!0;const ke=k({render:Ce,staticRenderFns:[]},void 0,_e,void 0,!1,void 0,!1,void 0,void 0,void 0),Se={name:"refine-option-input",components:{Selector:K,SelectorOption:ee},emits:["input"],props:{selected:{type:Array,required:!1,default:()=>[]},options:{type:Array,required:!0},multiple:{type:Boolean,required:!1,default:!1}},methods:{selectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},deselectOption({selectedOptions:e}){const t=e.map((({id:e})=>e));this.$emit("input",{selected:t})},isSelected(e){let t=!1;return this.selected.forEach((i=>{i===e&&(t=!0)})),t}}};var $e=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{attrs:{isMultiSelect:e.multiple},on:{"select-option":e.selectOption,"deselect-option":e.deselectOption}},e._l(e.options,(function(t){var n=t.id,r=t.display;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.isSelected(n)}})})),1)};$e._withStripped=!0;const Ie=k({render:$e,staticRenderFns:[]},void 0,Se,void 0,!1,void 0,!1,void 0,void 0,void 0);var Re={RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ce,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe};const qe={name:"clause",props:{input:{type:Object,default:()=>({})},meta:{type:Object,required:!0}},emits:["switch-clause"],methods:{switchClause:function({selectedOption:e}){this.$emit("switch-clause",e)}},components:{RenderlessClause:W,SelectorOption:ee,Selector:K,...Object.freeze({__proto__:null,default:Re,RefineDateInput:be,RefineDoubleDateInput:xe,RefineDoubleNumberInput:ce,RefineNumberInput:le,RefineOptionInput:Ie,RefineRelativeDateInput:ke,RefineTextInput:fe})}};var Be=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-clause",e._b({scopedSlots:e._u([{key:"default",fn:function(t){var n=t.setValue;return[i("selector",{attrs:{innerClass:"refine-clause-selector"},on:{"select-option":e.switchClause}},e._l(e.meta.clauses,(function(t){var r=t.id,o=t.display,s=t.component,l=t.meta;return i("selector-option",{key:r,attrs:{id:r,display:o,selected:e.input.clause===r}},[s?i(s,e._b({tag:"component",on:{input:n}},"component",Object.assign({},e.meta,l,e.input),!1)):e._e()],1)})),1)]}}])},"renderless-clause",e.input,!1))};Be._withStripped=!0;const Ee=k({render:Be,staticRenderFns:[]},void 0,qe,void 0,!1,void 0,!1,void 0,void 0,void 0),je={name:"refinements",inject:["updateInput","switchRefinement"],components:{Clause:Ee,RenderlessRefinement:X,Selector:K,SelectorOption:ee},props:{refinements:{required:!0,type:Array},input:{required:!1,type:Object,default:()=>({})}},methods:{selectedRefinementId(){let e;return this.refinements.forEach((({id:t})=>{this.input[t]&&(e=t)})),e},selectRefinement({selectedOption:e}){const{id:t}=e;this.switchRefinement(this.selectedRefinementId(),t)}}};var Fe=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("selector",{on:{"select-option":e.selectRefinement}},e._l(e.refinements,(function(t){var n=t.id,r=t.meta,o=t.display;return i("selector-option",{key:n,attrs:{id:n,display:o,selected:!!e.input[n]}},[i("renderless-refinement",{attrs:{id:n}},[i("clause",{attrs:{meta:r,input:e.input[n]},on:{"switch-clause":function(t){var i=t.id;return e.updateInput({clause:i},n)}}})],1)],1)})),1)};Fe._withStripped=!0;const De={name:"criterion",props:{conditions:{required:!0,type:Array},conditionId:{type:String,required:!0},input:{type:Object,required:!0},errors:{type:Array,required:!1,default:()=>[]}},methods:{switchCondition:function({selectedOption:e}){this.conditionId!==e.id&&this.$emit("switch-condition",e)},switchClause:function(e){this.$emit("switch-clause",e)}},components:{Clause:Ee,Refinements:k({render:Fe,staticRenderFns:[]},void 0,je,void 0,!1,void 0,!1,void 0,void 0,void 0),SelectorOption:ee,Selector:K,RefineFlavor:E}};var Ae=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("refine-flavor",{attrs:{order:["errors","selector","remove"],as:"div",component:"criterion.wrapper"},scopedSlots:e._u([{key:"errors",fn:function(){return[e.errors.length>0?i("refine-flavor",{attrs:{as:"ul",component:"criterion.errors"}},e._l(e.errors,(function(t){return i("refine-flavor",{key:t.id,attrs:{as:"li",component:"criterion.errors.error"}},[e._v("\n "+e._s(t.message)+"\n ")])})),1):e._e()]},proxy:!0},{key:"selector",fn:function(){return[i("selector",{on:{"select-option":e.switchCondition}},e._l(e.conditions,(function(t){var n=t.id,r=t.display,o=t.meta,s=t.refinements;return i("selector-option",{key:n,attrs:{id:n,display:r,selected:e.conditionId===n}},[i("div",[i("clause",{attrs:{input:e.input,meta:o},on:{"switch-clause":e.switchClause}}),e._v(" "),s&&s.length>0?i("refinements",{attrs:{input:e.input,refinements:s}}):e._e()],1)])})),1)]},proxy:!0},{key:"remove",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"criterion.removeCriterionButton",type:"button"},on:{click:function(t){return t.preventDefault(),e.$emit("remove-condition")}}},[i("refine-flavor",{attrs:{as:"svg",component:"criterion.removeCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z","clip-rule":"evenodd"}})])],1)]},proxy:!0}])})};Ae._withStripped=!0;const Ve={name:"query-builder",model:{prop:"blueprint",event:"update:blueprint"},emits:["update:blueprint"],props:{blueprint:{required:!1,type:Array,default:()=>[]},conditions:{required:!0,type:Array},errors:{required:!1,type:Object,default:()=>({})},flavor:{required:!1,type:Object,default:()=>({})}},methods:{templateKey:e=>i?{}:{key:e},templateChildKey:e=>i?{key:e}:{},onChange(e){this.$emit("update:blueprint",e)}},created(){if(0===this.conditions.length)throw new Error("You must provide at least one condition to the query builder.")},setup(e){var t;t=e.flavor,o(q,t)},components:{Criterion:k({render:Ae,staticRenderFns:[]},void 0,De,void 0,!1,void 0,!1,void 0,void 0,void 0),RefineFlavor:E,RenderlessCondition:Q,RenderlessQueryBuilder:U}};var Me=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("renderless-query-builder",{attrs:{blueprint:e.blueprint,conditions:e.conditions},on:{change:e.onChange},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.groupedBlueprint,r=t.replaceCriterion,o=t.insertCriterion,s=t.addGroup,l=t.removeCriterion,a=t.conditionFor;return[0===n.length?i("refine-flavor",e._b({attrs:{as:"div",component:"emptyGroup",order:["button","default"]},scopedSlots:e._u([{key:"button",fn:function(){return[i("refine-flavor",{attrs:{as:"button",component:"emptyGroup.addCriterionButton",tabindex:"0",type:"button"},on:{click:s}},[i("refine-flavor",{attrs:{as:"svg",component:"emptyGroup.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"emptyGroup.addCriterionButton.text"}},[e._v("\n Add a new condition\n ")])],1)]},proxy:!0}],null,!0)},"refine-flavor",{addGroup:s},!1)):i("refine-flavor",{attrs:{as:"div",component:"group.wrapper"}},[e._l(n,(function(t,s){return[i("refine-flavor",e._b({attrs:{as:"div",component:"group"}},"refine-flavor",e.templateChildKey("group-"+s),!1),[e._l(t,(function(t,n){return i("refine-flavor",{key:t.uid,attrs:{as:"div",component:"condition"}},[i("renderless-condition",e._b({scopedSlots:e._u([{key:"default",fn:function(n){var o=n.switchClause;return[i("criterion",{attrs:{conditionId:t.condition_id,conditions:e.conditions,errors:e.errors[t.uid],input:t.input},on:{"switch-clause":function(e){var t=e.id;return o(t)},"remove-condition":function(e){return l(t.position)},"switch-condition":function(e){return r(t.position,a(e))}}})]}}],null,!0)},"renderless-condition",a(Object.assign({},{id:t.condition_id},t)),!1))],1)})),e._v(" "),i("refine-flavor",{attrs:{as:"div",component:"group.addCriterionButton.wrapper"}},[i("refine-flavor",{attrs:{as:"button",component:"group.addCriterionButton",tabindex:"0",type:"button"},on:{click:function(e){return o(t[t.length-1].position)}}},[i("refine-flavor",{attrs:{as:"svg",component:"group.addCriterionButton.icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"}},[i("path",{attrs:{"fill-rule":"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z","clip-rule":"evenodd"}})]),e._v(" "),i("refine-flavor",{attrs:{as:"span",component:"group.addCriterionButton.text"}},[e._v(" And")])],1)],1)],2),e._v(" "),i("refine-flavor",e._b({attrs:{as:"template",component:"group.divider",index:s,total:n.length}},"refine-flavor",e.templateChildKey("separator-"+s),!1))]})),e._v(" "),i("refine-flavor",{attrs:{as:"button",component:"addGroupButton",type:"button"},on:{click:s}},[e._v("\n Add an 'Or'\n ")])],2)]}}])})};Me._withStripped=!0;const Pe=k({render:Me,staticRenderFns:[]},void 0,Ve,void 0,!1,void 0,!1,void 0,void 0,void 0),Ne="bg-white relative border border-gray-300 rounded-md shadow-sm text-left cursor-default",Te="focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",ze=`${Ne} ${Te} w-60 pl-3 py-2`,Le={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-600",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-col gap-4 bg-gray-100 px-4 py-8 rounded-lg border-l-4 overflow-hidden",wrapper:{class:"space-y-4"},addCriterionButton:{wrapper:{},class:"flex items-center rounded text-sm text-gray-600",icon:{class:"h-4 w-4"},text:{}}},addGroupButton:{class:"px-2 py-1 bg-blue-500 text-white rounded"},criterion:{wrapper:{order:["errors","selector","remove"],class:"flex flex-wrap gap-x-2 gap-y-4"},removeCriterionButton:{class:"rounded-full bg-gray-200 w-10 h-10 text-gray-600 flex items-center justify-center ml-auto",icon:{class:"h-5 w-5"}},errors:{class:"flex-1 basis-full bg-red-50 border-l-2 border-red-600 text-red-300 px-4 py-2 rounded list-disc list-inside",error:{class:"text-red-600 font-semibold"}}},select:{class:" sm:inline-block w-60",wrapper:{class:"flex items-start gap-4"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"overflow-hidden absolute z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-2 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default; focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-2 pl-3 pr-10 text-left bg-white border border-gray-300 rounded-md shadow-sm cursor-default focus:outline-none focus:ring-1 focus:ring-indigo-500 focus:border-indigo-500",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex p-1 mr-1 border border-gray-300 rounded"},deselect:{icon:{class:"w-4 h-4",wrapper:{class:"flex items-center ml-1 text-gray-500 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-400",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${Ne} ${Te} block w-full pl-3 py-2 pr-0`},relative:{class:`${ze} mr-4`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:ze,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:ze}}},He="bg-white relative text-left cursor-default",Ge=`${He} focus:outline-none pl-3 py-1`,Ye={emptyGroup:{class:"",wrapper:{class:"space-y-4"},addCriterionButton:{class:"flex items-center rounded text-sm text-gray-400 hover:bg-gray-100",wrapper:{},icon:{class:"h-4 w-4"},text:{}}},group:{class:"flex flex-wrap items-center gap-y-2",wrapper:{class:""},addCriterionButton:{wrapper:{},class:"flex items-center p-1 text-gray-100 hover:bg-gray-100 rounded",icon:{class:"h-6 w-6 text-gray-400"},text:{class:"hidden"}}},addGroupButton:{class:"hidden"},criterion:{wrapper:{component:"linear-criterion-row",order:["errors","selector","remove"],class:"mr-4"},removeCriterionButton:{class:"px-3 hover:bg-gray-100 text-gray-400 flex items-center justify-center",icon:{class:"h-4 w-4"}},errors:{class:"hidden",error:{class:"hidden"}}},select:{class:"relative sm:inline-block",wrapper:{class:"flex items-start"},customOptions:{class:"",wrapper:{class:"w-auto pt-4 md:flex md:pt-0"}},listbox:{class:e=>e.isClosed?"hidden":"overflow-auto text-base rounded-md max-h-60 ring-1 ring-black ring-opacity-5 focus:outline-none",wrapper:{class:"absolute w-48 z-10 mt-1 bg-white rounded-md shadow-lg"},item:{class:e=>"relative py-1 border-b border-gray-100 pl-3 cursor-pointer select-none pr-9 "+(e.isHighlighted?"text-white bg-blue-600":"text-gray-900"),text:{class:e=>"block truncate "+(e.selected?"font-semibold":"font-normal")},icon:{class:"w-5 h-5",wrapper:{class:e=>"absolute inset-y-0 right-0 flex items-center pr-4 "+(e.isHighlighted?"text-white":"text-blue-600")}}}},button:{class:"relative w-full py-1 px-3 text-left bg-white cursor-default hover:bg-gray-100",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"block truncate"},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"hidden absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}},multi:{button:{class:"relative w-full py-1 pl-3 pr-10 text-left bg-white cursor-default focus:outline-none",placeholder:{class:"block text-gray-300 truncate select-none"},selected:{class:"inline-flex mr-2 "},deselect:{icon:{class:"hidden w-4 h-4",wrapper:{class:"hidden flex items-center ml-1 text-gray-300 cursor-pointer"}}},icon:{class:"w-5 h-5 text-gray-300",wrapper:{class:"absolute inset-y-0 right-0 flex items-center pr-2 pointer-events-none"}}}}},inputs:{date:{pickerInput:{class:`${He} focus:outline-none block w-full pl-3 py-1 pr-0`},relative:{class:`${Ge} w-12`,wrapper:{class:"flex mr-4"}},double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},number:{class:`${Ge} w-14`,double:{wrapper:{class:"flex items-center gap-[1ch]"},joiner:{}}},text:{class:Ge}}};export{ne as ConditionSelector,d as DatePickerPlugin,re as Query,Pe as QueryBuilder,K as Selector,ee as SelectorOption,Ye as linearFlavor,Le as tailwindFlavor};
//# sourceMappingURL=refine-vue.esm.min.js.map

@@ -21,3 +21,3 @@ {

],
"version": "1.0.1672751489",
"version": "1.0.1672764386",
"scripts": {

@@ -24,0 +24,0 @@ "test": "jest ./tests",

@@ -43,3 +43,12 @@ import { h, defineComponent, isVue2, computed } from 'vue-demi';

computed(() => incomingProps.as),
computed(() => incomingProps.flavorOptions)
computed(() => {
// Originally we only passed "flavorOptions" through to the flavor `class`
// function, but it makes more sense to send them all. So now we combine
// them and pass them all through.
// @TODO It might make sense to get rid of flavorOptions altogether?
return {
...(bindings.attrs ?? {}),
...(incomingProps.flavorOptions ?? {}),
}
})
);

@@ -46,0 +55,0 @@

@@ -16,2 +16,4 @@ const inputBase =

addCriterionButton: {

@@ -18,0 +20,0 @@ class: 'flex items-center rounded text-sm text-gray-600',

@@ -9,2 +9,3 @@ import { inject, provide, computed } from 'vue-demi';

// I think this is only used
export function getFlavorItem(pointer, flavorOptions) {

@@ -21,3 +22,3 @@ let flavor = useFlavor(

'',
computed(() => flavorOptions)
computed(() => flavorOptions),
);

@@ -48,3 +49,3 @@

const props = {};
const opts = options.value ?? {};
const opts = options.value;

@@ -51,0 +52,0 @@ const resolvedClass = flavor.value.class;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc