1import F from"./TmlNewSelect.95ec32e2.js";import{_ as g,by as y,bG as d,aw as f,bH as _}from"./index.a4e8ca65.js";import{N as m,D as L,W as w,U as r,f as c,a4 as u,a0 as p}from"./vue.00f7c436.js";import{s as b}from"./startCase.bc79096a.js";import{u as v}from"./ucFirst.0531bce4.js";import"./faTimes.ad061359.js";import"./faSearch.250ef055.js";import"./form-field.2fa65598.js";import"./debounce.5129c224.js";import"./scrollToElement.2aea5813.js";import"./isEqual.e839bc13.js";import"./sentry.09480738.js";const x={name:"TmlFontsList",components:{TmlNewSelect:F,TmlFont:y},inject:["integrationFonts"],model:{prop:"value",event:"font-selected"},props:{label:{type:String,required:!0},fieldName:{type:String,required:!0},preSelected:{type:String,required:!1},value:String,weight:Number,maxHeight:{type:String,default:"400"},fontType:String,allowDynamicLoading:{type:Boolean}},data(){return{fonts:[],loadingFonts:!1}},computed:{parsedFonts(){return this.fonts.map(t=>({text:b(t.displayName),value:t.displayCssName}))}},watch:{fontType:{immediate:!0,handler(){this.rebuildFonts()}},"integrationFonts.value":{deep:!0,handler(){this.rebuildFonts()}}},mounted(){this.$emit("font-selected",this.value)},methods:{rebuildFonts(){var o;const t=((o=this.integrationFonts)==null?void 0:o.value)||[],e=this.fontType;if(e){const a=d.filter(n=>Array.isArray(n.type)?n.type.includes(e):n.type===e);this.fonts=[...a,...t].sort((n,s)=>n.name.toLowerCase().localeCompare(s.name.toLowerCase()))}else this.fonts=[...d,...t].sort((a,n)=>a.name.toLowerCase().localeCompare(n.name.toLowerCase()));f(this.fonts.filter(a=>a.name!=="Lato"))},onSelect(t){this.$emit("font-selected",t),this.$emit("input",t)},afterSearch({result:t,searchTerm:e}){if(this.allowDynamicLoading&&!t.filter(a=>a.text===e).length){if(_(e)){this.onFontLoaded(e);return}e=v(e),f([e]),this.loadingFonts=!0,$eventBus.once("webfonts-loaded",this.onFontLoaded),$eventBus.once("webfonts-failed-to-load",this.onFontLoadFailed)}},onFontLoadFailed(){this.loadingFonts=!1,$eventBus.off("webfonts-loaded",this.onFontLoaded)},onFontLoaded(t){this.loadingFonts=!1;const e=this.fonts.find(o=>o.displayCssName.toLowerCase()===t.toLowerCase());e&&(this.$emit("font-selected",e.displayCssName),this.$emit("input",e.displayCssName),$eventBus.off("webfonts-failed-to-load",this.onFontLoadFailed))}}};function S(t,e,o,a,n,s){const l=m("tml-font"),h=m("tml-new-select");return L(),w(h,{name:o.fieldName,label:o.label,options:s.parsedFonts,"max-height":o.maxHeight,"value-as-ref":o.value,searchable:"","searchable-properties":{text:1},"no-search-results":n.loadingFonts?"Searching...":"No results found",onInputAsRef:s.onSelect,onAfterSearch:s.afterSearch},{selected:r(({option:i})=>[c(l,{font:i.value,style:{padding:"0.8em 0.8em"}},{default:r(()=>[u(p(i.text),1)]),_:2},1032,["font"])]),option:r(({option:i})=>[c(l,{font:i.value},{default:r(()=>[u(p(i.text),1)]),_:2},1032,["font"])]),_:1},8,["name","label","options","max-height","value-as-ref","no-search-results","onInputAsRef","onAfterSearch"])}const M=g(x,[["render",S]]);export{M as default}; 2//# sourceMappingURL=TmlFontsList.712cf275.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.