1(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`1666c9a9-b71a-45a4-a67c-db7aa45dd7fb`,e._sentryDebugIdIdentifier=`sentry-dbid-1666c9a9-b71a-45a4-a67c-db7aa45dd7fb`)}catch{}})();import"./_sentry-release-injection-file-CF9M8Hp2.js";import{Jt as e,R as t,U as n,V as r,W as i,Wt as a,_ as o,at as s,d as c,f as l,it as u,p as d,r as f,u as p,v as m}from"./runtime-core.esm-bundler-BtSCGTMb.js";import{d as h,f as g}from"./runtime-dom.esm-bundler-7KyOZnyU.js";import{a as _,i as v,o as y,t as b}from"./BaseButton-mgGicpZL.js";import{t as x}from"./_plugin-vue_export-helper-BwEFdXXb.js";import{t as S}from"./LBaseDropdown-CWUX0S7o.js";import{t as C}from"./LBaseDropdownItem-DEZhv0cE.js";var w=8,T={components:{LBaseDropdown:S,LBaseDropdownItem:C,BaseButton:b},props:{variables:{type:Array,required:!0},tooltip:{type:String,required:!1,default:void 0},dataTestId:{type:String,required:!1,default:`richTextEditorVariablesComponent`}},emits:[`select`],data(){return{BASE_BUTTON_SIZE:_,BASE_BUTTON_INTENT:v,BASE_BUTTON_VARIANT:y,searchQuery:``,focusedIndex:-1}},computed:{totalVariableCount(){return this.variables.reduce((e,t)=>t.groupName&&t.items?.length?e+t.items.length:e+1,0)},showSearch(){return this.totalVariableCount>w},filteredVariables(){if(!this.searchQuery.trim())return this.variables;let e=this.searchQuery.toLowerCase().trim();return this.variables.map(t=>{if(t.groupName&&t.items?.length){if(t.groupName.toLowerCase().includes(e))return t;let n=t.items.filter(t=>{let n=t.name?.toLowerCase().includes(e),r=t.description?.toLowerCase().includes(e);return n||r});return n.length===0?null:{...t,items:n}}let n=t.name?.toLowerCase().includes(e),r=t.description?.toLowerCase().includes(e);return n||r?t:null}).filter(Boolean)},flatFilteredVariables(){let e=[];for(let t of this.filteredVariables)if(t.groupName&&t.items?.length)for(let n of t.items)n.name&&e.push(n);else t.name&&e.push(t);return e}},watch:{searchQuery(){this.focusedIndex=-1}},methods:{select(e){this.$emit(`select`,e)},onDropdownToggle(e){e?this.focusInputField():(this.searchQuery=``,this.focusedIndex=-1)},focusInputField(){this.$nextTick(()=>{let e=this.$refs.searchFormKit?.$el?.querySelector(`input[type="text"]`);e&&e.focus()})},isItemFocused(e){return this.focusedIndex<0?!1:this.flatFilteredVariables[this.focusedIndex]?.key===e.key},onKeydown(e){let t=this.flatFilteredVariables.length;if(t!==0)switch(e.key){case`ArrowDown`:e.preventDefault(),this.focusedIndex=(this.focusedIndex+1)%t,this.scrollFocusedItemIntoView();break;case`ArrowUp`:e.preventDefault(),this.focusedIndex=this.focusedIndex<=0?t-1:this.focusedIndex-1,this.scrollFocusedItemIntoView();break;case`Enter`:this.focusedIndex>=0&&this.focusedIndex<t&&(e.preventDefault(),this.select(this.flatFilteredVariables[this.focusedIndex]));break}},scrollFocusedItemIntoView(){this.$nextTick(()=>{let e=this.flatFilteredVariables[this.focusedIndex];if(!e)return;let t=this.$refs[`item-${e.key}`],n=Array.isArray(t)?t[0]?.$el:t?.$el;n&&n.scrollIntoView({block:`nearest`,behavior:`smooth`})})}}},E={key:0,class:`tw-px-2 tw-py-2 tw-sticky tw-top-0 tw-bg-white tw-z-10`},D={key:1,class:`tw-px-4 tw-py-3 tw-text-graphite-500`},O={key:0},k={class:`tw-px-2 tw-pt-1 tw-text-neutral-prominent-base tw-text-base tw-font-bold`},A={class:`tw-truncate`},j=[`data-test-id`],M=[`data-test-id`,`title`],N=[`data-test-id`],P=[`data-test-id`];function F(_,v,y,x,w,T){let F=b,I=n(`FormKit`),L=C,R=S,z=i(`tooltip`);return t(),c(R,{"data-test-id":y.dataTestId,"extra-dropdown-class":`tw-min-w-[250px] tw-max-w-[350px]`,"use-fixed-position":``,onToggle:T.onDropdownToggle},{"button-content":u(()=>[s((t(),c(F,{size:w.BASE_BUTTON_SIZE.EXTRA_SMALL,intent:w.BASE_BUTTON_INTENT.BRAND,variant:w.BASE_BUTTON_VARIANT.GHOST,"icon-left":`fal fa-circle-plus`,"propagate-click-event":``},{default:u(()=>[o(e(_.$t(`richTextEditor.variablesButtonLabel`)),1)]),_:1},8,[`size`,`intent`,`variant`])),[[z,y.tooltip,void 0,{top:!0}]])]),default:u(()=>[p(`div`,{class:`tw-max-h-96 tw-overflow-y-auto`,onKeydown:v[2]||=(...e)=>T.onKeydown&&T.onKeydown(...e)}
1,[T.showSearch?(t(),d(`div`,E,[m(I,{ref:`searchFormKit`,modelValue:w.searchQuery,"onUpdate:modelValue":v[0]||=e=>w.searchQuery=e,type:`text`,placeholder:_.$t(`richTextEditor.searchVariablesPlaceholder`),"outer-class":`!tw-mb-0`,autocomplete:`off`,"data-test-id":`${y.dataTestId}-search-input`,onClick:v[1]||=g(()=>{},[`stop`])},null,8,[`modelValue`,`placeholder`,`data-test-id`])])):l(``,!0),T.filteredVariables.length===0?(t(),d(`div`,D,e(_.$t(`richTextEditor.noVariablesAvailable`)),1)):(t(!0),d(f,{key:2},r(T.filteredVariables,n=>(t(),d(`div`,{key:n.groupName??n.key},[n.groupName&&n.items?.length?(t(),d(`div`,O,[p(`div`,k,e(n.groupName),1),(t(!0),d(f,null,r(n.items,n=>(t(),d(`div`,{key:n.key},[n.name?(t(),c(L,{key:0,ref_for:!0,ref:`item-${n.key}`,"data-test-id":`${y.dataTestId}-option-${n.key}`,class:a([`hover:tw-bg-brandPrimary-25 tw-group`,T.isItemFocused(n)?`tw-bg-brandPrimary-25`:``]),onClick:e=>T.select(n),onKeyup:h(e=>T.select(n),[`enter`])},{default:u(()=>[p(`div`,A,[p(`div`,{"data-test-id":`${y.dataTestId}-variableName-${n.key}`,class:`tw-text-graphite-900`},e(n.name),9,j),p(`div`,{"data-test-id":`${y.dataTestId}-variableDescription-${n.key}`,class:`tw-text-graphite-500 tw-truncate`,title:n.description},e(n.description),9,M)])]),_:2},1032,[`data-test-id`,`class`,`onClick`,`onKeyup`])):l(``,!0)]))),128))])):n.name?(t(),c(L,{key:1,ref_for:!0,ref:`item-${n.key}`,"data-test-id":`${y.dataTestId}-option-${n.key}`,class:a([`hover:tw-bg-brandPrimary-25 tw-group`,T.isItemFocused(n)?`tw-bg-brandPrimary-25`:``]),onClick:e=>T.select(n),onKeyup:h(e=>T.select(n),[`enter`])},{default:u(()=>[p(`div`,{"data-test-id":`${y.dataTestId}-variableName-${n.key}`,class:`tw-text-graphite-900`},e(n.name),9,N),p(`div`,{"data-test-id":`${y.dataTestId}-variableDescription-${n.key}`,class:`tw-text-graphite-500`},e(n.description),9,P)]),_:2},1032,[`data-test-id`,`class`,`onClick`,`onKeyup`])):l(``,!0)]))),128))],32)]),_:1},8,[`data-test-id`,`onToggle`])}var I=x(T,[[`render`,F]]);export{I as t}; 2//# sourceMappingURL=DynamicVariables-Bav4j0Xv.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.