UNPKG

autosuggest-highlight

Version:

Utilities for highlighting text in autosuggest and autocomplete components

1 lines 17.4 kB
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.AutosuggestHighlightParse=n():t.AutosuggestHighlightParse=n()}(this,(function(){return function(){var t={8257:function(t,n,r){var e=r(9212),o=r(5637),i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not a function")}},2569:function(t,n,r){var e=r(794),o=String,i=TypeError;t.exports=function(t){if(e(t))return t;throw i(o(t)+" is not an object")}},3200:function(t,n,r){"use strict";var e=r(4805).forEach,o=r(906)("forEach");t.exports=o?[].forEach:function(t){return e(this,t,arguments.length>1?arguments[1]:void 0)}},5766:function(t,n,r){var e=r(2977),o=r(6782),i=r(1825),u=function(t){return function(n,r,u){var c,f=e(n),a=i(f),s=o(u,a);if(t&&r!=r){for(;a>s;)if((c=f[s++])!=c)return!0}else for(;a>s;s++)if((t||s in f)&&f[s]===r)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},4805:function(t,n,r){var e=r(2938),o=r(7386),i=r(5044),u=r(1324),c=r(1825),f=r(4822),a=o([].push),s=function(t){var n=1==t,r=2==t,o=3==t,s=4==t,p=6==t,l=7==t,v=5==t||p;return function(h,y,g,b){for(var x,m,d=u(h),S=i(d),w=e(y,g),O=c(S),j=0,L=b||f,P=n?L(h,O):r||l?L(h,0):void 0;O>j;j++)if((v||j in S)&&(m=w(x=S[j],j,d),t))if(n)P[j]=m;else if(m)switch(t){case 3:return!0;case 5:return x;case 6:return j;case 2:a(P,x)}else switch(t){case 4:return!1;case 7:a(P,x)}return p?-1:o||s?s:P}};t.exports={forEach:s(0),map:s(1),filter:s(2),some:s(3),every:s(4),find:s(5),findIndex:s(6),filterReject:s(7)}},9269:function(t,n,r){var e=r(6544),o=r(3649),i=r(4061),u=o("species");t.exports=function(t){return i>=51||!e((function(){var n=[];return(n.constructor={})[u]=function(){return{foo:1}},1!==n[t](Boolean).foo}))}},906:function(t,n,r){"use strict";var e=r(6544);t.exports=function(t,n){var r=[][t];return!!r&&e((function(){r.call(null,n||function(){return 1},1)}))}},6917:function(t,n,r){var e=r(7386);t.exports=e([].slice)},5289:function(t,n,r){var e=r(4521),o=r(2097),i=r(794),u=r(3649)("species"),c=Array;t.exports=function(t){var n;return e(t)&&(n=t.constructor,(o(n)&&(n===c||e(n.prototype))||i(n)&&null===(n=n[u]))&&(n=void 0)),void 0===n?c:n}},4822:function(t,n,r){var e=r(5289);t.exports=function(t,n){return new(e(t))(0===n?0:n)}},9624:function(t,n,r){var e=r(7386),o=e({}.toString),i=e("".slice);t.exports=function(t){return i(o(t),8,-1)}},3058:function(t,n,r){var e=r(8191),o=r(9212),i=r(9624),u=r(3649)("toStringTag"),c=Object,f="Arguments"==i(function(){return arguments}());t.exports=e?i:function(t){var n,r,e;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,n){try{return t[n]}catch(t){}}(n=c(t),u))?r:f?i(n):"Object"==(e=i(n))&&o(n.callee)?"Arguments":e}},3478:function(t,n,r){var e=r(2870),o=r(929),i=r(6683),u=r(4615);t.exports=function(t,n,r){for(var c=o(n),f=u.f,a=i.f,s=0;s<c.length;s++){var p=c[s];e(t,p)||r&&e(r,p)||f(t,p,a(n,p))}}},57:function(t,n,r){var e=r(8494),o=r(4615),i=r(4677);t.exports=e?function(t,n,r){return o.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},4677:function(t){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},5999:function(t,n,r){"use strict";var e=r(8734),o=r(4615),i=r(4677);t.exports=function(t,n,r){var u=e(n);u in t?o.f(t,u,i(0,r)):t[u]=r}},3746:function(t,n,r){var e=r(9212),o=r(4615),i=r(9594),u=r(2296);t.exports=function(t,n,r,c){c||(c={});var f=c.enumerable,a=void 0!==c.name?c.name:n;if(e(r)&&i(r,a,c),c.global)f?t[n]=r:u(n,r);else{try{c.unsafe?t[n]&&(f=!0):delete t[n]}catch(t){}f?t[n]=r:o.f(t,n,{value:r,enumerable:!1,configurable:!c.nonConfigurable,writable:!c.nonWritable})}return t}},2296:function(t,n,r){var e=r(7583),o=Object.defineProperty;t.exports=function(t,n){try{o(e,t,{value:n,configurable:!0,writable:!0})}catch(r){e[t]=n}return n}},8494:function(t,n,r){var e=r(6544);t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},6668:function(t,n,r){var e=r(7583),o=r(794),i=e.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},6778:function(t){t.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},9307:function(t,n,r){var e=r(6668)("span").classList,o=e&&e.constructor&&e.constructor.prototype;t.exports=o===Object.prototype?void 0:o},6918:function(t,n,r){var e=r(5897);t.exports=e("navigator","userAgent")||""},4061:function(t,n,r){var e,o,i=r(7583),u=r(6918),c=i.process,f=i.Deno,a=c&&c.versions||f&&f.version,s=a&&a.v8;s&&(o=(e=s.split("."))[0]>0&&e[0]<4?1:+(e[0]+e[1])),!o&&u&&(!(e=u.match(/Edge\/(\d+)/))||e[1]>=74)&&(e=u.match(/Chrome\/(\d+)/))&&(o=+e[1]),t.exports=o},5690:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},7263:function(t,n,r){var e=r(7583),o=r(6683).f,i=r(57),u=r(3746),c=r(2296),f=r(3478),a=r(4451);t.exports=function(t,n){var r,s,p,l,v,h=t.target,y=t.global,g=t.stat;if(r=y?e:g?e[h]||c(h,{}):(e[h]||{}).prototype)for(s in n){if(l=n[s],p=t.dontCallGetSet?(v=o(r,s))&&v.value:r[s],!a(y?s:h+(g?".":"#")+s,t.forced)&&void 0!==p){if(typeof l==typeof p)continue;f(l,p)}(t.sham||p&&p.sham)&&i(l,"sham",!0),u(r,s,l,t)}}},6544:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},2938:function(t,n,r){var e=r(7386),o=r(8257),i=r(8987),u=e(e.bind);t.exports=function(t,n){return o(t),void 0===n?t:i?u(t,n):function(){return t.apply(n,arguments)}}},8987:function(t,n,r){var e=r(6544);t.exports=!e((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},8262:function(t,n,r){var e=r(8987),o=Function.prototype.call;t.exports=e?o.bind(o):function(){return o.apply(o,arguments)}},4340:function(t,n,r){var e=r(8494),o=r(2870),i=Function.prototype,u=e&&Object.getOwnPropertyDescriptor,c=o(i,"name"),f=c&&"something"===function(){}.name,a=c&&(!e||e&&u(i,"name").configurable);t.exports={EXISTS:c,PROPER:f,CONFIGURABLE:a}},7386:function(t,n,r){var e=r(8987),o=Function.prototype,i=o.bind,u=o.call,c=e&&i.bind(u,u);t.exports=e?function(t){return t&&c(t)}:function(t){return t&&function(){return u.apply(t,arguments)}}},5897:function(t,n,r){var e=r(7583),o=r(9212),i=function(t){return o(t)?t:void 0};t.exports=function(t,n){return arguments.length<2?i(e[t]):e[t]&&e[t][n]}},911:function(t,n,r){var e=r(8257);t.exports=function(t,n){var r=t[n];return null==r?void 0:e(r)}},7583:function(t,n,r){var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},2870:function(t,n,r){var e=r(7386),o=r(1324),i=e({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,n){return i(o(t),n)}},4639:function(t){t.exports={}},275:function(t,n,r){var e=r(8494),o=r(6544),i=r(6668);t.exports=!e&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},5044:function(t,n,r){var e=r(7386),o=r(6544),i=r(9624),u=Object,c=e("".split);t.exports=o((function(){return!u("z").propertyIsEnumerable(0)}))?function(t){return"String"==i(t)?c(t,""):u(t)}:u},9734:function(t,n,r){var e=r(7386),o=r(9212),i=r(1314),u=e(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return u(t)}),t.exports=i.inspectSource},2743:function(t,n,r){var e,o,i,u=r(9491),c=r(7583),f=r(7386),a=r(794),s=r(57),p=r(2870),l=r(1314),v=r(9137),h=r(4639),y="Object already initialized",g=c.TypeError,b=c.WeakMap;if(u||l.state){var x=l.state||(l.state=new b),m=f(x.get),d=f(x.has),S=f(x.set);e=function(t,n){if(d(x,t))throw new g(y);return n.facade=t,S(x,t,n),n},o=function(t){return m(x,t)||{}},i=function(t){return d(x,t)}}else{var w=v("state");h[w]=!0,e=function(t,n){if(p(t,w))throw new g(y);return n.facade=t,s(t,w,n),n},o=function(t){return p(t,w)?t[w]:{}},i=function(t){return p(t,w)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(n){var r;if(!a(n)||(r=o(n)).type!==t)throw g("Incompatible receiver, "+t+" required");return r}}}},4521:function(t,n,r){var e=r(9624);t.exports=Array.isArray||function(t){return"Array"==e(t)}},9212:function(t){t.exports=function(t){return"function"==typeof t}},2097:function(t,n,r){var e=r(7386),o=r(6544),i=r(9212),u=r(3058),c=r(5897),f=r(9734),a=function(){},s=[],p=c("Reflect","construct"),l=/^\s*(?:class|function)\b/,v=e(l.exec),h=!l.exec(a),y=function(t){if(!i(t))return!1;try{return p(a,s,t),!0}catch(t){return!1}},g=function(t){if(!i(t))return!1;switch(u(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!v(l,f(t))}catch(t){return!0}};g.sham=!0,t.exports=!p||o((function(){var t;return y(y.call)||!y(Object)||!y((function(){t=!0}))||t}))?g:y},4451:function(t,n,r){var e=r(6544),o=r(9212),i=/#|\.prototype\./,u=function(t,n){var r=f[c(t)];return r==s||r!=a&&(o(n)?e(n):!!n)},c=u.normalize=function(t){return String(t).replace(i,".").toLowerCase()},f=u.data={},a=u.NATIVE="N",s=u.POLYFILL="P";t.exports=u},794:function(t,n,r){var e=r(9212);t.exports=function(t){return"object"==typeof t?null!==t:e(t)}},6268:function(t){t.exports=!1},5871:function(t,n,r){var e=r(5897),o=r(9212),i=r(2447),u=r(7786),c=Object;t.exports=u?function(t){return"symbol"==typeof t}:function(t){var n=e("Symbol");return o(n)&&i(n.prototype,c(t))}},1825:function(t,n,r){var e=r(97);t.exports=function(t){return e(t.length)}},9594:function(t,n,r){var e=r(6544),o=r(9212),i=r(2870),u=r(8494),c=r(4340).CONFIGURABLE,f=r(9734),a=r(2743),s=a.enforce,p=a.get,l=Object.defineProperty,v=u&&!e((function(){return 8!==l((function(){}),"length",{value:8}).length})),h=String(String).split("String"),y=t.exports=function(t,n,r){"Symbol("===String(n).slice(0,7)&&(n="["+String(n).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(n="get "+n),r&&r.setter&&(n="set "+n),(!i(t,"name")||c&&t.name!==n)&&(u?l(t,"name",{value:n,configurable:!0}):t.name=n),v&&r&&i(r,"arity")&&t.length!==r.arity&&l(t,"length",{value:r.arity});try{r&&i(r,"constructor")&&r.constructor?u&&l(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var e=s(t);return i(e,"source")||(e.source=h.join("string"==typeof n?n:"")),t};Function.prototype.toString=y((function(){return o(this)&&p(this).source||f(this)}),"toString")},9021:function(t){var n=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(t){var e=+t;return(e>0?r:n)(e)}},8640:function(t,n,r){var e=r(4061),o=r(6544);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&e&&e<41}))},9491:function(t,n,r){var e=r(7583),o=r(9212),i=r(9734),u=e.WeakMap;t.exports=o(u)&&/native code/.test(i(u))},4615:function(t,n,r){var e=r(8494),o=r(275),i=r(7670),u=r(2569),c=r(8734),f=TypeError,a=Object.defineProperty,s=Object.getOwnPropertyDescriptor;n.f=e?i?function(t,n,r){if(u(t),n=c(n),u(r),"function"==typeof t&&"prototype"===n&&"value"in r&&"writable"in r&&!r.writable){var e=s(t,n);e&&e.writable&&(t[n]=r.value,r={configurable:"configurable"in r?r.configurable:e.configurable,enumerable:"enumerable"in r?r.enumerable:e.enumerable,writable:!1})}return a(t,n,r)}:a:function(t,n,r){if(u(t),n=c(n),u(r),o)try{return a(t,n,r)}catch(t){}if("get"in r||"set"in r)throw f("Accessors not supported");return"value"in r&&(t[n]=r.value),t}},6683:function(t,n,r){var e=r(8494),o=r(8262),i=r(112),u=r(4677),c=r(2977),f=r(8734),a=r(2870),s=r(275),p=Object.getOwnPropertyDescriptor;n.f=e?p:function(t,n){if(t=c(t),n=f(n),s)try{return p(t,n)}catch(t){}if(a(t,n))return u(!o(i.f,t,n),t[n])}},9275:function(t,n,r){var e=r(8356),o=r(5690).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},4012:function(t,n){n.f=Object.getOwnPropertySymbols},2447:function(t,n,r){var e=r(7386);t.exports=e({}.isPrototypeOf)},8356:function(t,n,r){var e=r(7386),o=r(2870),i=r(2977),u=r(5766).indexOf,c=r(4639),f=e([].push);t.exports=function(t,n){var r,e=i(t),a=0,s=[];for(r in e)!o(c,r)&&o(e,r)&&f(s,r);for(;n.length>a;)o(e,r=n[a++])&&(~u(s,r)||f(s,r));return s}},112:function(t,n){"use strict";var r={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,o=e&&!r.call({1:2},1);n.f=o?function(t){var n=e(this,t);return!!n&&n.enumerable}:r},3060:function(t,n,r){"use strict";var e=r(8191),o=r(3058);t.exports=e?{}.toString:function(){return"[object "+o(this)+"]"}},6252:function(t,n,r){var e=r(8262),o=r(9212),i=r(794),u=TypeError;t.exports=function(t,n){var r,c;if("string"===n&&o(r=t.toString)&&!i(c=e(r,t)))return c;if(o(r=t.valueOf)&&!i(c=e(r,t)))return c;if("string"!==n&&o(r=t.toString)&&!i(c=e(r,t)))return c;throw u("Can't convert object to primitive value")}},929:function(t,n,r){var e=r(5897),o=r(7386),i=r(9275),u=r(4012),c=r(2569),f=o([].concat);t.exports=e("Reflect","ownKeys")||function(t){var n=i.f(c(t)),r=u.f;return r?f(n,r(t)):n}},3955:function(t){var n=TypeError;t.exports=function(t){if(null==t)throw n("Can't call method on "+t);return t}},9137:function(t,n,r){var e=r(7836),o=r(8284),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},1314:function(t,n,r){var e=r(7583),o=r(2296),i="__core-js_shared__",u=e[i]||o(i,{});t.exports=u},7836:function(t,n,r){var e=r(6268),o=r(1314);(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.23.4",mode:e?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.23.4/LICENSE",source:"https://github.com/zloirock/core-js"})},6782:function(t,n,r){var e=r(7486),o=Math.max,i=Math.min;t.exports=function(t,n){var r=e(t);return r<0?o(r+n,0):i(r,n)}},2977:function(t,n,r){var e=r(5044),o=r(3955);t.exports=function(t){return e(o(t))}},7486:function(t,n,r){var e=r(9021);t.exports=function(t){var n=+t;return n!=n||0===n?0:e(n)}},97:function(t,n,r){var e=r(7486),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},1324:function(t,n,r){var e=r(3955),o=Object;t.exports=function(t){return o(e(t))}},2670:function(t,n,r){var e=r(8262),o=r(794),i=r(5871),u=r(911),c=r(6252),f=r(3649),a=TypeError,s=f("toPrimitive");t.exports=function(t,n){if(!o(t)||i(t))return t;var r,f=u(t,s);if(f){if(void 0===n&&(n="default"),r=e(f,t,n),!o(r)||i(r))return r;throw a("Can't convert object to primitive value")}return void 0===n&&(n="number"),c(t,n)}},8734:function(t,n,r){var e=r(2670),o=r(5871);t.exports=function(t){var n=e(t,"string");return o(n)?n:n+""}},8191:function(t,n,r){var e={};e[r(3649)("toStringTag")]="z",t.exports="[object z]"===String(e)},5637:function(t){var n=String;t.exports=function(t){try{return n(t)}catch(t){return"Object"}}},8284:function(t,n,r){var e=r(7386),o=0,i=Math.random(),u=e(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+u(++o+i,36)}},7786:function(t,n,r){var e=r(8640);t.exports=e&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},7670:function(t,n,r){var e=r(8494),o=r(6544);t.exports=e&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},3649:function(t,n,r){var e=r(7583),o=r(7836),i=r(2870),u=r(8284),c=r(8640),f=r(7786),a=o("wks"),s=e.Symbol,p=s&&s.for,l=f?s:s&&s.withoutSetter||u;t.exports=function(t){if(!i(a,t)||!c&&"string"!=typeof a[t]){var n="Symbol."+t;c&&i(s,t)?a[t]=s[t]:a[t]=f&&p?p(n):l(n)}return a[t]}},288:function(t,n,r){"use strict";var e=r(7263),o=r(4521),i=r(2097),u=r(794),c=r(6782),f=r(1825),a=r(2977),s=r(5999),p=r(3649),l=r(9269),v=r(6917),h=l("slice"),y=p("species"),g=Array,b=Math.max;e({target:"Array",proto:!0,forced:!h},{slice:function(t,n){var r,e,p,l=a(this),h=f(l),x=c(t,h),m=c(void 0===n?h:n,h);if(o(l)&&(r=l.constructor,(i(r)&&(r===g||o(r.prototype))||u(r)&&null===(r=r[y]))&&(r=void 0),r===g||void 0===r))return v(l,x,m);for(e=new(void 0===r?g:r)(b(m-x,0)),p=0;x<m;x++,p++)x in l&&s(e,p,l[x]);return e.length=p,e}})},6394:function(t,n,r){var e=r(8191),o=r(3746),i=r(3060);e||o(Object.prototype,"toString",i,{unsafe:!0})},5090:function(t,n,r){var e=r(7583),o=r(6778),i=r(9307),u=r(3200),c=r(57),f=function(t){if(t&&t.forEach!==u)try{c(t,"forEach",u)}catch(n){t.forEach=u}};for(var a in o)o[a]&&f(e[a]&&e[a].prototype);f(i)},2560:function(t,n,r){r(288),r(6394),r(5090),t.exports=function(t,n){var r=[];return 0===n.length?r.push({text:t,highlight:!1}):n[0][0]>0&&r.push({text:t.slice(0,n[0][0]),highlight:!1}),n.forEach((function(e,o){var i=e[0],u=e[1];r.push({text:t.slice(i,u),highlight:!0}),o===n.length-1?u<t.length&&r.push({text:t.slice(u,t.length),highlight:!1}):u<n[o+1][0]&&r.push({text:t.slice(u,n[o+1][0]),highlight:!1})})),r}}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,r),i.exports}return r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r(2560)}()}));