@arbetsformedlingen/yrkesvaljaren 2.1.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -2
- package/dist/cjs/core-selector.cjs.entry.js +1 -1
- package/dist/cjs/digi-service-job-selector.cjs.entry.js +86 -36
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/{types-DdzCbiye.js → types-B3W1Y40Q.js} +5 -4
- package/dist/collection/components/core-selector/core-selector.css +47 -51
- package/dist/collection/components/job-selector/job-selector-controller.js +20 -6
- package/dist/collection/components/job-selector/job-selector.css +49 -48
- package/dist/collection/components/job-selector/job-selector.js +66 -30
- package/dist/collection/components/job-selector/logic/adapter.utils.js +5 -4
- package/dist/components/core-selector2.js +1 -1
- package/dist/components/digi-service-job-selector.js +1 -1
- package/dist/components/types.js +1 -1
- package/dist/esm/core-selector.entry.js +1 -1
- package/dist/esm/digi-service-job-selector.entry.js +86 -36
- package/dist/esm/index.js +2 -2
- package/dist/esm/{types-DVos4HHS.js → types-D9zmn-JR.js} +5 -4
- package/dist/types/components/job-selector/job-selector-controller.d.ts +10 -1
- package/dist/types/components/job-selector/job-selector.d.ts +3 -0
- package/dist/types/components/job-selector/logic/adapter.utils.d.ts +1 -1
- package/dist/types/components/job-selector/types.d.ts +17 -2
- package/dist/types/components.d.ts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/yrkesvaljaren/index.esm.js +1 -1
- package/dist/yrkesvaljaren/{p-DVos4HHS.js → p-D9zmn-JR.js} +1 -1
- package/dist/yrkesvaljaren/p-b81496c8.entry.js +1 -0
- package/dist/yrkesvaljaren/p-c2eb633a.entry.js +1 -0
- package/dist/yrkesvaljaren/yrkesvaljaren.esm.js +1 -1
- package/package.json +5 -3
- package/dist/yrkesvaljaren/p-4f5b36c5.entry.js +0 -1
- package/dist/yrkesvaljaren/p-ff349084.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,n,i,r={exports:{}},s=t((e||(e=1,n=r.exports,i=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function o(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function u(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(){for(var n=this.getLevel(),r=0;r<i.length;r++){var s=i[r];this[s]=r<n?t:this.methodFactory(s,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function h(t){return function(){typeof console!==e&&(c.call(this),this[t].apply(this,arguments))}}function a(i,r,s){return function(i){return"debug"===i&&(i="log"),typeof console!==e&&("trace"===i&&n?u:void 0!==console[i]?o(console,i):void 0!==console.log?o(console,"log"):t)}(i)||h.apply(this,arguments)}function l(t,n){var o,u,h,l=this,f="loglevel";function d(){var t;if(typeof window!==e&&f){try{t=window.localStorage[f]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(f),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===l.levels[t]&&(t=void 0),t}}function g(t){var e=t;if("string"==typeof e&&void 0!==l.levels[e.toUpperCase()]&&(e=l.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=l.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?f+=":"+t:"symbol"==typeof t&&(f=void 0),l.name=t,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=n||a,l.getLevel=function(){return null!=h?h:null!=u?u:o},l.setLevel=function(t,n){return h=g(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&f){try{return void(window.localStorage[f]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(t){}}}(h),c.call(l)},l.setDefaultLevel=function(t){u=g(t),d()||l.setLevel(t,!1)},l.resetLevel=function(){h=null,function(){if(typeof window!==e&&f){try{window.localStorage.removeItem(f)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),c.call(l)},l.enableAll=function(t){l.setLevel(l.levels.TRACE,t)},l.disableAll=function(t){l.setLevel(l.levels.SILENT,t)},l.rebuild=function(){if(s!==l&&(o=g(s.getLevel())),c.call(l),s===l)for(var t in r)r[t].rebuild()},o=g(s?s.getLevel():"WARN");var A=d();null!=A&&(h=g(A)),c.call(l)}(s=new l).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new l(t,s.methodFactory)),e};var f=typeof window!==e?window.log:void 0;return s.noConflict=function(){return typeof window!==e&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return r},s.default=s,s},r.exports?r.exports=i():n.log=i()),r.exports));let o=[],u=null;function c(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function h(t){return"string"==typeof t&&t.trim().length>0}function a(t){return void 0===t||"string"==typeof t}function l(t){return!(!c(t)||!Array.isArray(t.data)||0===t.data.length)&&t.data.every((t=>function(t){return!!c(t)&&h(t.id)&&("job-title"===t.type||"occupation-name"===t.type)&&h(t.preferred_label)&&a(t.ssyk_level_4_id)&&a(t.ssyk_code_2012)&&a(t.occupation_name_id)&&a(t.occupation_name_preferred_label)&&(void 0===t.weight||"number"==typeof t.weight&&Number.isFinite(t.weight))&&(void 0===t.search_aliases||Array.isArray(t.search_aliases)&&t.search_aliases.every((t=>"string"==typeof t)))}(t)))}function f(t){if(!l(t))return void s.error("[TaxonomyRegistry] Felaktigt format på taxonomidata vid registrering.");o=function(t){const e=new Map;return t.filter((t=>{const n="job-title"===t.type?t.occupation_name_id??"":"",i=e.get(t.id)??new Set;return!i.has(n)&&(i.add(n),e.set(t.id,i),!0)}))}(t.data).map((t=>({...t})));const e=c(t.metadata)?t.metadata.labour_market_taxonomy_version:void 0;u=void 0!==e?String(e):void 0!==t.taxonomyVersion?String(t.taxonomyVersion):"unknown",s.debug(`[TaxonomyRegistry] Taxonomi version ${u} registrerades med ${o.length} yrken.`)}function d(){return 0===o.length&&s.warn("[TaxonomyRegistry] Ingen taxonomi är registrerad ännu! Anropa registerTaxonomy(data) först."),o}function g(t){return Array.isArray?Array.isArray(t):"[object Array]"===m(t)}function A(t){return null==t?"":function(t){if("string"==typeof t)return t;if("bigint"==typeof t)return t.toString();const e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}function p(t){return"string"==typeof t}function y(t){return"number"==typeof t}function C(t){return"object"==typeof t}function v(t){return null!=t}function w(t){return!t.trim().length}function m(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const M="Invalid doc index: must be a non-negative integer within the bounds of the docs array",F=Object.prototype.hasOwnProperty;var D=class{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{const n=B(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function B(t){let e=null,n=null,i=null,r=1,s=null;if(p(t)||g(t))i=t,e=E(t),n=x(t);else{if(!F.call(t,"name"))throw new Error("Missing name property in key");const o=t.name;if(i=o,F.call(t,"weight")&&void 0!==t.weight&&(r=t.weight,r<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(x(o)));e=E(o),n=x(o),s=t.getFn??null}return{path:e,id:n,weight:r,src:i,getFn:s}}function E(t){return g(t)?t:t.split(".")}function x(t){return g(t)?t.join("."):t}const b=Object.freeze({isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:function(t,e){const n=[];let i=!1;const r=(t,e,s,o)=>{if(v(t))if(e[s]){const u=t[e[s]];if(!v(u))return;if(s===e.length-1&&(p(u)||y(u)||function(t){return!0===t||!1===t||function(t){return C(t)&&null!==t}(t)&&"[object Boolean]"==m(t)}(u)||"bigint"==typeof u))n.push(void 0!==o?{v:A(u),i:o}:A(u));else if(g(u)){i=!0;for(let t=0,n=u.length;t<n;t+=1)r(u[t],e,s+1,t)}else e.length&&r(u,e,s+1,o)}else n.push(void 0!==o?{v:t,i:o}:t)};return r(t,p(e)?e.split("."):e,0),i?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1});var k=class{constructor({getFn:t=b.getFn,fieldNormWeight:e=b.fieldNormWeight}={}){this.norm=function(t=1,e=3){const n=new Map,i=Math.pow(10,e);return{get(e){let r=0,s=!1;for(let t=0;t<e.length;t++)(o=e.charCodeAt(t))>=9&&o<=13||32===o||160===o?s=!1:s||(r++,s=!0);var o;if(0===r&&(r=1),n.has(r))return n.get(r);const u=Math.round(i/Math.pow(r,.5*t))/i;return n.set(r,u),u},clear(){n.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const t=this.docs.length;this.records=new Array(t);let e=0;if(p(this.docs[0]))for(let n=0;n<t;n++){const t=this._createStringRecord(this.docs[n],n);t&&(this.records[e++]=t)}else for(let n=0;n<t;n++)this.records[e++]=this._createObjectRecord(this.docs[n],n);this.records.length=e,this.norm.clear()}add(t,e){if(!Number.isInteger(e)||e<0)throw new Error(M);if(p(t)){const n=this._createStringRecord(t,e);return n&&this.records.push(n),n}const n=this._createObjectRecord(t,e);return this.records.push(n),n}removeAt(t){if(!Number.isInteger(t)||t<0)throw new Error(M);for(let e=0,n=this.records.length;e<n;e+=1)if(this.records[e].i===t){this.records.splice(e,1);break}for(let e=0,n=this.records.length;e<n;e+=1)this.records[e].i>t&&(this.records[e].i-=1)}removeAll(t){const e=new Set;for(const n of t)Number.isInteger(n)&&n>=0&&e.add(n);if(0===e.size)return;this.records=this.records.filter((t=>!e.has(t.i)));const n=Array.from(e).sort(((t,e)=>t-e));for(const t of this.records){let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t.i?e=r+1:i=r}t.i-=e}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(t,e){return!v(t)||w(t)?null:{v:t,i:e,n:this.norm.get(t)}}_createObjectRecord(t,e){const n={i:e,$:{}};for(let e=0,i=this.keys.length;e<i;e++){const i=this.keys[e],r=i.getFn?i.getFn(t):this.getFn(t,i.path);if(v(r))if(g(r)){const t=[];for(let e=0,n=r.length;e<n;e+=1){const n=r[e];if(v(n))if(p(n)){if(!w(n)){const i={v:n,i:e,n:this.norm.get(n)};t.push(i)}}else if(v(n.v)){const e=p(n.v)?n.v:A(n.v);if(!w(e)){const i={v:e,i:n.i,n:this.norm.get(e)};t.push(i)}}}n.$[e]=t}else if(p(r)&&!w(r)){const t={v:r,n:this.norm.get(r)};n.$[e]=t}}return n}toJSON(){return{keys:this.keys.map((({getFn:t,...e})=>e)),records:this.records}}};function S(t,e,{getFn:n=b.getFn,fieldNormWeight:i=b.fieldNormWeight}={}){const r=new k({getFn:n,fieldNormWeight:i});return r.setKeys(t.map(B)),r.setSources(e),r.create(),r}function $(t){const e={};for(let n=0,i=t.length;n<i;n+=1){const r=t.charAt(n);e[r]=(e[r]||0)|1<<i-n-1}return e}function N(t){if(t.length<=1)return t;t.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]));const e=[t[0]];for(let n=1,i=t.length;n<i;n+=1){const i=e[e.length-1],r=t[n];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):e.push(r)}return e}const L={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},I=new RegExp("["+Object.keys(L).join("")+"]","g"),R="function"==typeof String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(I,(t=>L[t])):t=>t;var _=class{constructor(t,{location:e=b.location,threshold:n=b.threshold,distance:i=b.distance,includeMatches:r=b.includeMatches,findAllMatches:s=b.findAllMatches,minMatchCharLength:o=b.minMatchCharLength,isCaseSensitive:u=b.isCaseSensitive,ignoreDiacritics:c=b.ignoreDiacritics,ignoreLocation:h=b.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:u,ignoreDiacritics:c,ignoreLocation:h},t=u?t:t.toLowerCase(),t=c?R(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:$(t),startIndex:e})},l=this.pattern.length;if(l>32){let t=0;const e=l%32,n=l-e;for(;t<n;)a(this.pattern.substr(t,32),t),t+=32;if(e){const t=l-32;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern===t){if(t.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const e={isMatch:!0,score:0};return i&&(e.indices=[[0,t.length-1]]),e}const{location:r,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,ignoreLocation:h}=this.options,a=[];let l=0,f=!1;this.chunks.forEach((({pattern:e,alphabet:n,startIndex:d})=>{const{isMatch:g,score:A,indices:p}=function(t,e,n,{location:i=b.location,distance:r=b.distance,threshold:s=b.threshold,findAllMatches:o=b.findAllMatches,minMatchCharLength:u=b.minMatchCharLength,includeMatches:c=b.includeMatches,ignoreLocation:h=b.ignoreLocation}={}){if(e.length>32)throw new Error("Pattern length exceeds max of 32.");const a=e.length,l=t.length,f=Math.max(0,Math.min(i,l));let d=s,g=f;const A=(t,e)=>{const n=t/a;if(h)return n;const i=Math.abs(f-e);return r?n+i/r:i?1:n},p=u>1||c,y=p?Array(l):[];let C;for(;(C=t.indexOf(e,g))>-1;){const t=A(0,C);if(d=Math.min(t,d),g=C+a,p){let t=0;for(;t<a;)y[C+t]=1,t+=1}}g=-1;let v=[],w=1,m=0,M=a+l;const F=1<<a-1;for(let e=0;e<a;e+=1){let i=0,r=M;for(;i<r;)A(e,f+r)<=d?i=r:M=r,r=Math.floor((M-i)/2+i);M=r;let s=Math.max(1,f-r+1);const u=o?l:Math.min(f+r,l)+a,c=Array(u+2);c[u+1]=(1<<e)-1;for(let i=u;i>=s;i-=1){const r=i-1;if(c[i]=(c[i+1]<<1|1)&n[t[r]],e&&(c[i]|=(v[i+1]|v[i])<<1|1|v[i+1]),c[i]&F&&(w=A(e,r),w<=d)){if(d=w,g=r,m=e,g<=f)break;s=Math.max(1,2*f-g)}}if(A(e+1,f)>d)break;v=c}if(p&&g>=0){const e=Math.min(l-1,g+a-1+m);for(let i=g;i<=e;i+=1)n[t[i]]&&(y[i]=1)}const D={isMatch:g>=0,score:Math.max(.001,w)};if(p){const t=function(t=[],e=b.minMatchCharLength){const n=[];let i=-1,r=-1,s=0;for(let o=t.length;s<o;s+=1){const o=t[s];o&&-1===i?i=s:o||-1===i||(r=s-1,r-i+1>=e&&n.push([i,r]),i=-1)}return t[s-1]&&s-i>=e&&n.push([i,s-1]),n}(y,u);t.length?c&&(D.indices=t):D.isMatch=!1}return D}(t,e,n,{location:r+d,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,includeMatches:i,ignoreLocation:h});g&&(f=!0),l+=A,g&&p&&a.push(...p)}));const d={isMatch:f,score:f?l/this.chunks.length:1};return f&&i&&(d.indices=N(a)),d}};const j=new Set(["fuzzy","include"]),T=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:t=>({type:"exact",search(e){const n=e===t;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:t=>({type:"include",search(e){let n,i=0;const r=[],s=t.length;for(;(n=e.indexOf(t,i))>-1;)i=n+s,r.push([n,i-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:t=>({type:"prefix-exact",search(e){const n=e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:t=>({type:"inverse-prefix-exact",search(e){const n=!e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:t=>({type:"inverse-suffix-exact",search(e){const n=!e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:t=>({type:"suffix-exact",search(e){const n=e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[e.length-t.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:t=>({type:"inverse-exact",search(e){const n=-1===e.indexOf(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(t,e={})=>{const n=new _(t,{location:e.location??b.location,threshold:e.threshold??b.threshold,distance:e.distance??b.distance,includeMatches:e.includeMatches??b.includeMatches,findAllMatches:e.findAllMatches??b.findAllMatches,minMatchCharLength:e.minMatchCharLength??b.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??b.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??b.ignoreDiacritics,ignoreLocation:e.ignoreLocation??b.ignoreLocation});return{type:"fuzzy",search:t=>n.searchIn(t)}}}],z=T.length;function O(t,e){const n=t.match(e);return n?n[1]:null}const W=[];function U(...t){W.push(...t)}function G(t,e){for(let n=0,i=W.length;n<i;n+=1){const i=W[n];if(i.condition(t,e))return new i(t,e)}return new _(t,e)}const J="$and",P="$path",K=t=>!(!t[J]&&!t.$or),Y=t=>({[J]:Object.keys(t).map((e=>({[e]:t[e]})))});function H(t,e,{auto:n=!0}={}){const i=t=>{if(p(t)){const i={keyId:null,pattern:t};return n&&(i.searcher=G(t,e)),i}const r=Object.keys(t),s=(t=>!!t[P])(t);if(!s&&r.length>1&&!K(t))return i(Y(t));if((t=>!g(t)&&C(t)&&!K(t))(t)){const i=s?t[P]:r[0],o=s?t.$val:t[i];if(!p(o))throw new Error((t=>`Invalid value for key ${t}`)(i));const u={keyId:x(i),pattern:o};return n&&(u.searcher=G(o,e)),u}const o={children:[],operator:r[0]};return r.forEach((e=>{const n=t[e];g(n)&&n.forEach((t=>{o.children.push(i(t))}))})),o};return K(t)||(t=Y(t)),i(t)}function q(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){let n=1;return t.forEach((({key:t,norm:i,score:r})=>{const s=t?t.weight:null;n*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(e?1:i))})),n}var V=class{constructor(t,e){this.limit=t,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):this.comparator(t,this.heap[0])<0&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(t){const e=this.heap;for(;t>0;){const n=t-1>>1;if(this.comparator(e[t],e[n])<=0)break;const i=e[t];e[t]=e[n],e[n]=i,t=n}}_sinkDown(t){const e=this.heap,n=e.length;let i=t;do{const r=2*(t=i)+1,s=2*t+2;if(r<n&&this.comparator(e[r],e[i])>0&&(i=r),s<n&&this.comparator(e[s],e[i])>0&&(i=s),i!==t){const n=e[t];e[t]=e[i],e[i]=n}}while(i!==t)}};const Q=/[\p{L}\p{M}\p{N}_]+/gu,X=new WeakSet;function Z({isCaseSensitive:t=!1,ignoreDiacritics:e=!1,tokenize:n}={}){const i=function(t){if("function"==typeof t){let e=!1;return n=>{const i=t(n);if(!e&&(e=!0,!Array.isArray(i)||i.some((t=>"string"!=typeof t))))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(i)?"array containing non-strings":typeof i}.`);return i}}return t instanceof RegExp?(t.global||X.has(e=t)||(X.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`)),e=>e.match(t)||[]):t=>t.match(Q)||[];var e}(n);return{tokenize:n=>(t||(n=n.toLowerCase()),e&&(n=R(n)),i(n))}}function tt(t,e,n,i){const r=i.tokenize(e);if(!r.length)return;t.fieldCount++,t.docFieldCount.set(n,(t.docFieldCount.get(n)||0)+1);const s=new Set(r);let o=t.docTermFieldHits.get(n);o||(o=new Map,t.docTermFieldHits.set(n,o));for(const e of s)o.set(e,(o.get(e)||0)+1),t.df.set(e,(t.df.get(e)||0)+1)}function et(t,e,n,i){const{i:r,v:s,$:o}=e;if(void 0===s){if(o)for(let e=0;e<n;e++){const n=o[e];if(n)if(Array.isArray(n))for(const e of n)tt(t,e.v,r,i);else tt(t,n.v,r,i)}}else tt(t,s,r,i)}function nt(t,e){const n=t.docFieldCount.get(e);if(void 0===n)return;t.fieldCount-=n,t.docFieldCount.delete(e);const i=t.docTermFieldHits.get(e);if(i){for(const[e,n]of i){const i=(t.df.get(e)||0)-n;i<=0?t.df.delete(e):t.df.set(e,i)}t.docTermFieldHits.delete(e)}}function it(t,e){if(0===e.length)return;const n=Array.from(new Set(e)).sort(((t,e)=>t-e));for(const e of n)nt(t,e);const i=t=>{let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t?e=r+1:i=r}return t-e},r=n[0],s=new Map;for(const[e,n]of t.docFieldCount)s.set(e>r?i(e):e,n);t.docFieldCount=s;const o=new Map;for(const[e,n]of t.docTermFieldHits)o.set(e>r?i(e):e,n);t.docTermFieldHits=o}var rt=class{constructor(t,e,n){this.options={...b,...e},this._keyStore=new D(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=G(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof k))throw new Error("Incorrect 'index' type");if(this._myIndex=e||S(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=function(t,e,n){const i={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const r of t)et(i,r,e,n);return i}(this._myIndex.records,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}add(t){if(!v(t))return;this._docs.push(t);const e=this._myIndex.add(t,this._docs.length-1);if(this._invertedIndex&&e){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});!function(t,e,n,i){et(t,e,n,i)}(this._invertedIndex,e,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}remove(t=()=>!1){const e=[],n=[];for(let i=0,r=this._docs.length;i<r;i+=1)t(this._docs[i],i)&&(e.push(this._docs[i]),n.push(i));if(n.length){this._invertedIndex&&it(this._invertedIndex,n);const t=new Set(n);this._docs=this._docs.filter(((e,n)=>!t.has(n))),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return e}removeAt(t){if(!Number.isInteger(t)||t<0||t>=this._docs.length)throw new Error(M);this._invertedIndex&&it(this._invertedIndex,[t]);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map((t=>this._keyStore.get(t.id)||t))}search(t,e){const{limit:n=-1}=e||{},{includeMatches:i,includeScore:r,shouldSort:s,sortFn:o,ignoreFieldNorm:u}=this.options;if(p(t)&&!t.trim()){let t=this._docs.map(((t,e)=>({item:t,refIndex:e})));return y(n)&&n>-1&&(t=t.slice(0,n)),t}const c=s&&y(n)&&n>0&&p(t),h=o,a=(t,e)=>h(t,e)||t.idx-e.idx;let l;if(c){const e=new V(n,a);p(this._docs[0])?this._searchStringList(t,{heap:e,ignoreFieldNorm:u}):this._searchObjectList(t,{heap:e,ignoreFieldNorm:u}),l=e.extractSorted()}else l=p(t)?p(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),function(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){t.forEach((t=>{t.score=q(t.matches,{ignoreFieldNorm:e})}))}(l,{ignoreFieldNorm:u}),s&&l.sort(p(t)?a:h),y(n)&&n>-1&&(l=l.slice(0,n));return function(t,e,{includeMatches:n=b.includeMatches,includeScore:i=b.includeScore}={}){return t.map((t=>{const{idx:r}=t,s={item:e[r],refIndex:r};return n&&(s.matches=function(t){const e=[];return t.matches.forEach((t=>{if(!v(t.indices)||!t.indices.length)return;const n={indices:t.indices,value:t.value};t.key&&(n.key=t.key.id),t.idx>-1&&(n.refIndex=t.idx),e.push(n)})),e}(t)),i&&(s.score=t.score),s}))}(l,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=e?null:[];return s.forEach((({v:t,i:s,n:u})=>{if(!v(t))return;const c=i.searchIn(t);if(c.isMatch){const i={score:c.score,value:t,norm:u,indices:c.indices};r&&(i.matchedMask=c.matchedMask,i.matchedTerms=c.matchedTerms,i.termCount=c.termCount);const h=[i];if(!r||this._coversAllTokens(h)){const i={item:t,idx:s,matches:h};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):o.push(i)}}})),o}_searchLogical(t){const e=H(t,this.options),n=this._normalizedKeys(),i=(t,e,r)=>{if(!("children"in t)){const{keyId:i,searcher:s}=t;let o;return null===i?(o=[],n.forEach(((t,n)=>{o.push(...this._findMatches({key:t,value:e[n],searcher:s}))}))):o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(e,i),searcher:s}),o&&o.length?[{idx:r,item:e,matches:o}]:[]}const{children:s,operator:o}=t,u=[];for(let t=0,n=s.length;t<n;t+=1){const n=i(s[t],e,r);if(n.length)u.push(...n);else if(o===J)return[]}return u},r=this._myIndex.records,s=new Map,o=[];return r.forEach((({$:t,i:n})=>{if(v(t)){const r=i(e,t,n);r.length&&(s.has(n)||(s.set(n,{idx:n,item:t,matches:[]}),o.push(s.get(n))),r.forEach((({matches:t})=>{s.get(n).matches.push(...t)})))}})),o}_searchObjectList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=this._normalizedKeys(),u=e?null:[];return s.forEach((({$:t,i:s})=>{if(!v(t))return;const c=[];let h=!1,a=!1;if(o.forEach(((e,n)=>{const r=this._findMatches({key:e,value:t[n],searcher:i});r.length?(c.push(...r),r[0].hasInverse&&(a=!0)):h=!0})),(!a||!h)&&c.length&&(!r||this._coversAllTokens(c))){const i={idx:s,item:t,matches:c};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):u.push(i)}})),u}_findMatches({key:t,value:e,searcher:n}){if(!v(e))return[];const i=[];if(g(e))e.forEach((({v:e,i:r,n:s})=>{if(!v(e))return;const o=n.searchIn(e);if(o.isMatch){const n={score:o.score,key:t,value:e,idx:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),i.push(n)}}));else{const{v:r,n:s}=e,o=n.searchIn(r);if(o.isMatch){const e={score:o.score,key:t,value:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(e.matchedMask=o.matchedMask,e.matchedTerms=o.matchedTerms,e.termCount=o.termCount),i.push(e)}}return i}_coversAllTokens(t){const e=t.length?t[0].termCount:void 0;if(void 0===e)return!0;if(e<=31){let n=0;for(let e=0;e<t.length;e++)n|=t[e].matchedMask||0;return n===2**e-1}const n=new Set;for(let e=0;e<t.length;e++){const i=t[e].matchedTerms;if(i)for(const t of i)n.add(t)}return n.size===e}};rt.version="7.5.0",rt.createIndex=S,rt.parseIndex=function(t,{getFn:e=b.getFn,fieldNormWeight:n=b.fieldNormWeight}={}){const{keys:i,records:r}=t,s=new k({getFn:e,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(r),s},rt.config=b,rt.match=function(t,e,n){if(n&&n.useTokenSearch)throw new Error("Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.");return G(t,{...b,...n}).searchIn(e)},rt.parseQuery=H,U(class{constructor(t,{isCaseSensitive:e=b.isCaseSensitive,ignoreDiacritics:n=b.ignoreDiacritics,includeMatches:i=b.includeMatches,minMatchCharLength:r=b.minMatchCharLength,ignoreLocation:s=b.ignoreLocation,findAllMatches:o=b.findAllMatches,location:u=b.location,threshold:c=b.threshold,distance:h=b.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:r,findAllMatches:o,ignoreLocation:s,location:u,threshold:c,distance:h},t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern=t,this.query=function(t,e={}){return t.replace(/\\\|/g,"\0").split("|").map((t=>{const n=function(t){const e=[],n=t.length;let i=0;for(;i<n;){for(;i<n&&" "===t[i];)i++;if(i>=n)break;let r=i;for(;r<n&&" "!==t[r]&&'"'!==t[r];)r++;if(r<n&&'"'===t[r]){for(r++;r<n;){if('"'===t[r]){const e=r+1;if(e>=n||" "===t[e]){r++;break}if("$"===t[e]&&(e+1>=n||" "===t[e+1])){r+=2;break}}r++}e.push(t.substring(i,r)),i=r}else{for(;r<n&&" "!==t[r];)r++;e.push(t.substring(i,r)),i=r}}return e}(t.replace(/\u0000/g,"|").trim()).filter((t=>t&&!!t.trim())),i=[];for(let t=0,r=n.length;t<r;t+=1){const r=n[t];let s=!1,o=-1;for(;!s&&++o<z;){const t=T[o],n=O(r,t.multiRegex);n&&(i.push(t.create(n,e)),s=!0)}if(!s)for(o=-1;++o<z;){const t=T[o],n=O(r,t.singleRegex);if(n){i.push(t.create(n,e));break}}}return i}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:r}=this.options;t=i?t:t.toLowerCase(),t=r?R(t):t;let s=0;const o=[];let u=0,c=!1;for(let i=0,r=e.length;i<r;i+=1){const r=e[i];o.length=0,s=0,c=!1;for(let e=0,i=r.length;e<i;e+=1){const i=r[e],{isMatch:h,indices:a,score:l}=i.search(t);if(!h){u=0,s=0,o.length=0,c=!1;break}s+=1,u+=l,i.type.startsWith("inverse")&&(c=!0),n&&(j.has(i.type)?o.push(...a):o.push(a))}if(s){const t={isMatch:!0,score:u/s};return c&&(t.hasInverse=!0),n&&(t.indices=N(o)),t}}return{isMatch:!1,score:1}}}),U(class{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=Z({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});const n=this.analyzer.tokenize(t),{df:i,fieldCount:r}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const t of n){this.termSearchers.push(new _(t,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const n=i.get(t)||0,s=Math.log(1+(r-n+.5)/(n+.5));this.idfWeights.push(s)}this.combineAll="all"===e.tokenMatch,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let n=0,i=0,r=0,s=0;const o=this.combineAll&&!this.useMask?new Set:null;for(let u=0;u<this.termSearchers.length;u++){const c=this.termSearchers[u].searchIn(t),h=this.idfWeights[u];i+=h,c.isMatch&&(r++,n+=h*(1-c.score),c.indices&&e.push(...c.indices),this.combineAll&&(this.useMask?s|=1<<u:o.add(u)))}if(0===r)return{isMatch:!1,score:1};const u={isMatch:!0,score:Math.max(.001,i>0?1-n/i:0)};return this.options.includeMatches&&e.length&&(u.indices=N(e)),this.combineAll&&(this.useMask?u.matchedMask=s:u.matchedTerms=o,u.termCount=this.numTerms),u}}),rt.use=function(...t){t.forEach((t=>U(t)))};var st=rt;const ot=1,ut=100,ct=20,ht={keys:["preferred_label"],includeScore:!0,ignoreDiacritics:!0,ignoreFieldNorm:!0,threshold:.6,minMatchCharLength:1,ignoreLocation:!0,distance:100},at="T.ex. målare, florist, kock",lt={format:(t,e,n)=>{const i=function(t,e){if(!t)return[];if(!e||0===e.trim().length)return[{text:t,isMatch:!1}];const n=t.toLowerCase(),i=e.toLowerCase().split(/\s+/).filter((t=>t.length>0)),r=new Set;if(i.forEach((t=>{let e=0;for(;-1!==(e=n.indexOf(t,e));){for(let n=0;n<t.length;n++)r.add(e+n);e+=t.length}})),0===r.size&&i.forEach((e=>{const n=function(t,e){const n=t.toLowerCase(),i=e.length;let r=99,s=-1,o=0;const u=Math.max(3,i-2),c=Math.min(n.length,i+2);for(let t=0;t<=n.length-u;t++)for(let i=u;i<=c&&t+i<=n.length;i++){const u=ft(e,n.slice(t,t+i));u<r&&(r=u,s=t,o=i)}return r<=Math.max(2,Math.floor(.25*i))&&-1!==s?{start:s,length:o}:null}(t,e);if(n)for(let t=0;t<n.length;t++)r.add(n.start+t)})),0===r.size)return[{text:t,isMatch:!1}];const s=[];let o="",u=r.has(0);for(let e=0;e<t.length;e++){const n=r.has(e);n!==u?(o.length>0&&s.push({text:o,isMatch:u}),o=t[e],u=n):o+=t[e]}return o.length>0&&s.push({text:o,isMatch:u}),s}(t,e);return n?[...i,{text:" ",isMatch:!1},{text:`(${n})`,isMetadata:!0}]:i}};function ft(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}s.setLevel(s.levels.DEBUG);const dt=t=>t?t.toLowerCase().trim():"";function gt(t,e){return t.id&&e.id?t.id===e.id&&(t.occupationId??t.occupation_name_id??"")===(e.occupationId??e.occupation_name_id??""):t.rawLabel===e.rawLabel}function At(t){return t.sort(((t,e)=>{const n=t.score??0,i=e.score??0;if(n!==i)return i-n;const r=t.weight??0,s=e.weight??0;return r!==s?s-r:t.displayLabel.localeCompare(e.displayLabel,"sv")}))}function pt(t){return t.map((t=>t.isMatch?`<strong>${t.text}</strong>`:t.isMetadata?`<span class="occupation-variant-label">${t.text}</span>`:t.text)).join("")}const yt=t=>t?t.replace(/ (\([^)]+\))/g,' <span class="occupation-variant-label">$1</span>'):"";function Ct(t,e,n){return t===e?1:n.length>1?n.every((e=>t.includes(e)))?.98:null:t.startsWith(e)?.99:t.includes(e)?.95:null}function vt(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}function wt(t,e){const n=t.toLowerCase().trim(),i=e.toLowerCase().trim();return i.includes(" ")?vt(n,i)<=Math.max(2,Math.floor(.25*n.length))&&Math.abs(n.length-i.length)<=2:null!==function(t,e){const n=t.toLowerCase(),i=e.length;let r=99;const s=Math.max(3,i-2),o=Math.min(n.length,i+2);for(let t=0;t<=n.length-s;t++)for(let i=s;i<=o&&t+i<=n.length;i++){const s=vt(e,n.slice(t,t+i));s<r&&(r=s)}return r<=Math.max(2,Math.floor(.25*i))?r:null}(i,n)}function mt(t,e){return(t.search_aliases??[]).some((t=>dt(t)===e))}function Mt(t,e,n){const i=function(t){return t.occupation_name_preferred_label?`${t.preferred_label||""} (${t.occupation_name_preferred_label})`:t.preferred_label||""}(t),r=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,type:t.type,preferred_label:t.preferred_label||"",rawLabel:t.preferred_label||"",displayLabel:i,highlightedLabel:pt(r),displaySegments:r,weight:t.weight??0,score:n,occupationId:t.occupation_name_id,occupationLabel:t.occupation_name_preferred_label,ssyk_level_4_id:t.ssyk_level_4_id,ssyk_code_2012:t.ssyk_code_2012}}function Ft(t){return"job-title"===t.type?`${t.id}|${t.occupation_name_id??""}`:t.id}function Dt(t,e,n,i){if(!n)return[];if(!e||!Array.isArray(e))return s.warn("[searchConcepts] Ogiltig items array."),[];if(!t||t.length<1)return[];const r=dt(t),o=r.split(" ").filter((t=>t.length>0)),u=[],c=new Set;for(const n of e){const e=Ct(dt(n.preferred_label),r,o),i=mt(n,r)?1:e;null!==i&&(u.push(Mt(n,t,i)),c.add(Ft(n)))}if(u.length>0)return At(u).slice(0,i);if(n){const e=n.search(r);if(0===e.length)return[];const s=e[0].score??1,o=[];let u=!1;for(const n of e){const e=Ft(n.item);if(c.has(e))continue;const i=n.score??1,h=1-i;if(h<.4)continue;if(i>s+.12)continue;const a=dt(n.item.preferred_label),l=n.item.weight??0,f=wt(r,a);f&&i<=.25&&(u=!0);let d=.7*h+.1*l;f&&(d+=.12);const g=Math.min(.84,Math.max(.4,d));o.push(Mt(n.item,t,g)),c.add(e)}const h=At(o);if(0===h.length)return[];const a=u?Math.min(5,i):Math.min(3,i);return h.slice(0,a)}return[]}const Bt={toGenericItem:t=>({id:t.id,label:t.preferred_label||"",description:t.occupation_name_preferred_label,metadata:{original:t,type:t.type,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}),searchResultToGenericItem(t,e){const n=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,label:t.preferred_label||"",displaySegments:n,highlightedLabel:pt(n),metadata:{original:t,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}},fromGenericItem:t=>({id:t.id,preferred_label:t.label,weight:t.metadata?.weight,...t.metadata?.original}),toPublicSelection(t){const e=t.id||"",n=t.preferred_label||t.rawLabel||"";if(!e)return{type:"manual-input",id:null,preferred_label:n};if("job-title"!==t.type&&"occupation-name"!==t.type)throw new Error(`Ogiltig intern yrkestyp för ${e}: ${t.type}`);const i={type:t.type,id:e,preferred_label:n};t.ssyk_code_2012&&(i.ssyk_code_2012=t.ssyk_code_2012);const r=t.occupation_name_id||t.occupationId,s=t.occupation_name_preferred_label||t.occupationLabel;return"job-title"===t.type&&r&&s&&(i.related={type:"occupation-name",id:r,preferred_label:s}),i}};class Et{fuseInstance=null;items=[];constructor(t){this.items=t,this.fuseInstance=new st(t,ht)}search(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>Bt.toPublicSelection(t))):[]}searchAsGeneric(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>({id:t.id,label:t.displayLabel,description:t.occupationLabel,group:"job-title"===t.type?"Yrke":"Yrkesgrupp",metadata:{originalResult:t,highlightedLabel:t.highlightedLabel,score:t.score,weight:t.weight}}))):[]}updateData(t){this.items=t,this.fuseInstance=new st(t,ht)}}class xt extends Error{code;invalidIds;constructor(t,e,n){super(t),this.name="InvalidSelectionError",this.code=e,this.invalidIds=n}}export{ut as D,xt as I,lt as L,ct as M,at as P,Et as T,Bt as a,l as b,ot as c,yt as d,d as g,gt as i,s as l,f as r,pt as s}
|
|
1
|
+
function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e,n,i,r={exports:{}},s=t((e||(e=1,n=r.exports,i=function(){var t=function(){},e="undefined",n=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],r={},s=null;function o(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function u(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function c(){for(var n=this.getLevel(),r=0;r<i.length;r++){var s=i[r];this[s]=r<n?t:this.methodFactory(s,n,this.name)}if(this.log=this.debug,typeof console===e&&n<this.levels.SILENT)return"No console available for logging"}function h(t){return function(){typeof console!==e&&(c.call(this),this[t].apply(this,arguments))}}function a(i,r,s){return function(i){return"debug"===i&&(i="log"),typeof console!==e&&("trace"===i&&n?u:void 0!==console[i]?o(console,i):void 0!==console.log?o(console,"log"):t)}(i)||h.apply(this,arguments)}function l(t,n){var o,u,h,l=this,f="loglevel";function d(){var t;if(typeof window!==e&&f){try{t=window.localStorage[f]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,i=encodeURIComponent(f),r=n.indexOf(i+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r+i.length+1))[1])}catch(t){}return void 0===l.levels[t]&&(t=void 0),t}}function g(t){var e=t;if("string"==typeof e&&void 0!==l.levels[e.toUpperCase()]&&(e=l.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=l.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?f+=":"+t:"symbol"==typeof t&&(f=void 0),l.name=t,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=n||a,l.getLevel=function(){return null!=h?h:null!=u?u:o},l.setLevel=function(t,n){return h=g(t),!1!==n&&function(t){var n=(i[t]||"silent").toUpperCase();if(typeof window!==e&&f){try{return void(window.localStorage[f]=n)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"="+n+";"}catch(t){}}}(h),c.call(l)},l.setDefaultLevel=function(t){u=g(t),d()||l.setLevel(t,!1)},l.resetLevel=function(){h=null,function(){if(typeof window!==e&&f){try{window.localStorage.removeItem(f)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),c.call(l)},l.enableAll=function(t){l.setLevel(l.levels.TRACE,t)},l.disableAll=function(t){l.setLevel(l.levels.SILENT,t)},l.rebuild=function(){if(s!==l&&(o=g(s.getLevel())),c.call(l),s===l)for(var t in r)r[t].rebuild()},o=g(s?s.getLevel():"WARN");var A=d();null!=A&&(h=g(A)),c.call(l)}(s=new l).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=r[t];return e||(e=r[t]=new l(t,s.methodFactory)),e};var f=typeof window!==e?window.log:void 0;return s.noConflict=function(){return typeof window!==e&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return r},s.default=s,s},r.exports?r.exports=i():n.log=i()),r.exports));let o=[],u=null;function c(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)}function h(t){return"string"==typeof t&&t.trim().length>0}function a(t){return void 0===t||"string"==typeof t}function l(t){return!(!c(t)||!Array.isArray(t.data)||0===t.data.length)&&t.data.every((t=>function(t){return!!c(t)&&h(t.id)&&("job-title"===t.type||"occupation-name"===t.type)&&h(t.preferred_label)&&a(t.ssyk_level_4_id)&&a(t.ssyk_code_2012)&&a(t.occupation_name_id)&&a(t.occupation_name_preferred_label)&&(void 0===t.weight||"number"==typeof t.weight&&Number.isFinite(t.weight))&&(void 0===t.search_aliases||Array.isArray(t.search_aliases)&&t.search_aliases.every((t=>"string"==typeof t)))}(t)))}function f(t){if(!l(t))return void s.error("[TaxonomyRegistry] Felaktigt format på taxonomidata vid registrering.");o=function(t){const e=new Map;return t.filter((t=>{const n="job-title"===t.type?t.occupation_name_id??"":"",i=e.get(t.id)??new Set;return!i.has(n)&&(i.add(n),e.set(t.id,i),!0)}))}(t.data).map((t=>({...t})));const e=c(t.metadata)?t.metadata.labour_market_taxonomy_version:void 0;u=void 0!==e?String(e):void 0!==t.taxonomyVersion?String(t.taxonomyVersion):"unknown",s.debug(`[TaxonomyRegistry] Taxonomi version ${u} registrerades med ${o.length} yrken.`)}function d(){return 0===o.length&&s.warn("[TaxonomyRegistry] Ingen taxonomi är registrerad ännu! Anropa registerTaxonomy(data) först."),o}function g(t){return Array.isArray?Array.isArray(t):"[object Array]"===m(t)}function A(t){return null==t?"":function(t){if("string"==typeof t)return t;if("bigint"==typeof t)return t.toString();const e=t+"";return"0"==e&&1/t==-1/0?"-0":e}(t)}function p(t){return"string"==typeof t}function y(t){return"number"==typeof t}function C(t){return"object"==typeof t}function v(t){return null!=t}function w(t){return!t.trim().length}function m(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const M="Invalid doc index: must be a non-negative integer within the bounds of the docs array",F=Object.prototype.hasOwnProperty;var D=class{constructor(t){this._keys=[],this._keyMap={};let e=0;t.forEach((t=>{const n=B(t);this._keys.push(n),this._keyMap[n.id]=n,e+=n.weight})),this._keys.forEach((t=>{t.weight/=e}))}get(t){return this._keyMap[t]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function B(t){let e=null,n=null,i=null,r=1,s=null;if(p(t)||g(t))i=t,e=E(t),n=x(t);else{if(!F.call(t,"name"))throw new Error("Missing name property in key");const o=t.name;if(i=o,F.call(t,"weight")&&void 0!==t.weight&&(r=t.weight,r<=0))throw new Error((t=>`Property 'weight' in key '${t}' must be a positive integer`)(x(o)));e=E(o),n=x(o),s=t.getFn??null}return{path:e,id:n,weight:r,src:i,getFn:s}}function E(t){return g(t)?t:t.split(".")}function x(t){return g(t)?t.join("."):t}const b=Object.freeze({isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:"any",getFn:function(t,e){const n=[];let i=!1;const r=(t,e,s,o)=>{if(v(t))if(e[s]){const u=t[e[s]];if(!v(u))return;if(s===e.length-1&&(p(u)||y(u)||function(t){return!0===t||!1===t||function(t){return C(t)&&null!==t}(t)&&"[object Boolean]"==m(t)}(u)||"bigint"==typeof u))n.push(void 0!==o?{v:A(u),i:o}:A(u));else if(g(u)){i=!0;for(let t=0,n=u.length;t<n;t+=1)r(u[t],e,s+1,t)}else e.length&&r(u,e,s+1,o)}else n.push(void 0!==o?{v:t,i:o}:t)};return r(t,p(e)?e.split("."):e,0),i?n:n[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1});var k=class{constructor({getFn:t=b.getFn,fieldNormWeight:e=b.fieldNormWeight}={}){this.norm=function(t=1,e=3){const n=new Map,i=Math.pow(10,e);return{get(e){let r=0,s=!1;for(let t=0;t<e.length;t++)(o=e.charCodeAt(t))>=9&&o<=13||32===o||160===o?s=!1:s||(r++,s=!0);var o;if(0===r&&(r=1),n.has(r))return n.get(r);const u=Math.round(i/Math.pow(r,.5*t))/i;return n.set(r,u),u},clear(){n.clear()}}}(e,3),this.getFn=t,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(t=[]){this.docs=t}setIndexRecords(t=[]){this.records=t}setKeys(t=[]){this.keys=t,this._keysMap={},t.forEach(((t,e)=>{this._keysMap[t.id]=e}))}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;const t=this.docs.length;this.records=new Array(t);let e=0;if(p(this.docs[0]))for(let n=0;n<t;n++){const t=this._createStringRecord(this.docs[n],n);t&&(this.records[e++]=t)}else for(let n=0;n<t;n++)this.records[e++]=this._createObjectRecord(this.docs[n],n);this.records.length=e,this.norm.clear()}add(t,e){if(!Number.isInteger(e)||e<0)throw new Error(M);if(p(t)){const n=this._createStringRecord(t,e);return n&&this.records.push(n),n}const n=this._createObjectRecord(t,e);return this.records.push(n),n}removeAt(t){if(!Number.isInteger(t)||t<0)throw new Error(M);for(let e=0,n=this.records.length;e<n;e+=1)if(this.records[e].i===t){this.records.splice(e,1);break}for(let e=0,n=this.records.length;e<n;e+=1)this.records[e].i>t&&(this.records[e].i-=1)}removeAll(t){const e=new Set;for(const n of t)Number.isInteger(n)&&n>=0&&e.add(n);if(0===e.size)return;this.records=this.records.filter((t=>!e.has(t.i)));const n=Array.from(e).sort(((t,e)=>t-e));for(const t of this.records){let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t.i?e=r+1:i=r}t.i-=e}}getValueForItemAtKeyId(t,e){return t[this._keysMap[e]]}size(){return this.records.length}_createStringRecord(t,e){return!v(t)||w(t)?null:{v:t,i:e,n:this.norm.get(t)}}_createObjectRecord(t,e){const n={i:e,$:{}};for(let e=0,i=this.keys.length;e<i;e++){const i=this.keys[e],r=i.getFn?i.getFn(t):this.getFn(t,i.path);if(v(r))if(g(r)){const t=[];for(let e=0,n=r.length;e<n;e+=1){const n=r[e];if(v(n))if(p(n)){if(!w(n)){const i={v:n,i:e,n:this.norm.get(n)};t.push(i)}}else if(v(n.v)){const e=p(n.v)?n.v:A(n.v);if(!w(e)){const i={v:e,i:n.i,n:this.norm.get(e)};t.push(i)}}}n.$[e]=t}else if(p(r)&&!w(r)){const t={v:r,n:this.norm.get(r)};n.$[e]=t}}return n}toJSON(){return{keys:this.keys.map((({getFn:t,...e})=>e)),records:this.records}}};function S(t,e,{getFn:n=b.getFn,fieldNormWeight:i=b.fieldNormWeight}={}){const r=new k({getFn:n,fieldNormWeight:i});return r.setKeys(t.map(B)),r.setSources(e),r.create(),r}function $(t){const e={};for(let n=0,i=t.length;n<i;n+=1){const r=t.charAt(n);e[r]=(e[r]||0)|1<<i-n-1}return e}function N(t){if(t.length<=1)return t;t.sort(((t,e)=>t[0]-e[0]||t[1]-e[1]));const e=[t[0]];for(let n=1,i=t.length;n<i;n+=1){const i=e[e.length-1],r=t[n];r[0]<=i[1]+1?i[1]=Math.max(i[1],r[1]):e.push(r)}return e}const L={ł:"l",Ł:"L",đ:"d",Đ:"D",ø:"o",Ø:"O",ħ:"h",Ħ:"H",ŧ:"t",Ŧ:"T",ı:"i",ß:"ss"},I=new RegExp("["+Object.keys(L).join("")+"]","g"),R="function"==typeof String.prototype.normalize?t=>t.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,"").replace(I,(t=>L[t])):t=>t;var _=class{constructor(t,{location:e=b.location,threshold:n=b.threshold,distance:i=b.distance,includeMatches:r=b.includeMatches,findAllMatches:s=b.findAllMatches,minMatchCharLength:o=b.minMatchCharLength,isCaseSensitive:u=b.isCaseSensitive,ignoreDiacritics:c=b.ignoreDiacritics,ignoreLocation:h=b.ignoreLocation}={}){if(this.options={location:e,threshold:n,distance:i,includeMatches:r,findAllMatches:s,minMatchCharLength:o,isCaseSensitive:u,ignoreDiacritics:c,ignoreLocation:h},t=u?t:t.toLowerCase(),t=c?R(t):t,this.pattern=t,this.chunks=[],!this.pattern.length)return;const a=(t,e)=>{this.chunks.push({pattern:t,alphabet:$(t),startIndex:e})},l=this.pattern.length;if(l>32){let t=0;const e=l%32,n=l-e;for(;t<n;)a(this.pattern.substr(t,32),t),t+=32;if(e){const t=l-32;a(this.pattern.substr(t),t)}}else a(this.pattern,0)}searchIn(t){const{isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i}=this.options;if(t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern===t){if(t.length<this.options.minMatchCharLength)return{isMatch:!1,score:1};const e={isMatch:!0,score:0};return i&&(e.indices=[[0,t.length-1]]),e}const{location:r,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,ignoreLocation:h}=this.options,a=[];let l=0,f=!1;this.chunks.forEach((({pattern:e,alphabet:n,startIndex:d})=>{const{isMatch:g,score:A,indices:p}=function(t,e,n,{location:i=b.location,distance:r=b.distance,threshold:s=b.threshold,findAllMatches:o=b.findAllMatches,minMatchCharLength:u=b.minMatchCharLength,includeMatches:c=b.includeMatches,ignoreLocation:h=b.ignoreLocation}={}){if(e.length>32)throw new Error("Pattern length exceeds max of 32.");const a=e.length,l=t.length,f=Math.max(0,Math.min(i,l));let d=s,g=f;const A=(t,e)=>{const n=t/a;if(h)return n;const i=Math.abs(f-e);return r?n+i/r:i?1:n},p=u>1||c,y=p?Array(l):[];let C;for(;(C=t.indexOf(e,g))>-1;){const t=A(0,C);if(d=Math.min(t,d),g=C+a,p){let t=0;for(;t<a;)y[C+t]=1,t+=1}}g=-1;let v=[],w=1,m=0,M=a+l;const F=1<<a-1;for(let e=0;e<a;e+=1){let i=0,r=M;for(;i<r;)A(e,f+r)<=d?i=r:M=r,r=Math.floor((M-i)/2+i);M=r;let s=Math.max(1,f-r+1);const u=o?l:Math.min(f+r,l)+a,c=Array(u+2);c[u+1]=(1<<e)-1;for(let i=u;i>=s;i-=1){const r=i-1;if(c[i]=(c[i+1]<<1|1)&n[t[r]],e&&(c[i]|=(v[i+1]|v[i])<<1|1|v[i+1]),c[i]&F&&(w=A(e,r),w<=d)){if(d=w,g=r,m=e,g<=f)break;s=Math.max(1,2*f-g)}}if(A(e+1,f)>d)break;v=c}if(p&&g>=0){const e=Math.min(l-1,g+a-1+m);for(let i=g;i<=e;i+=1)n[t[i]]&&(y[i]=1)}const D={isMatch:g>=0,score:Math.max(.001,w)};if(p){const t=function(t=[],e=b.minMatchCharLength){const n=[];let i=-1,r=-1,s=0;for(let o=t.length;s<o;s+=1){const o=t[s];o&&-1===i?i=s:o||-1===i||(r=s-1,r-i+1>=e&&n.push([i,r]),i=-1)}return t[s-1]&&s-i>=e&&n.push([i,s-1]),n}(y,u);t.length?c&&(D.indices=t):D.isMatch=!1}return D}(t,e,n,{location:r+d,distance:s,threshold:o,findAllMatches:u,minMatchCharLength:c,includeMatches:i,ignoreLocation:h});g&&(f=!0),l+=A,g&&p&&a.push(...p)}));const d={isMatch:f,score:f?l/this.chunks.length:1};return f&&i&&(d.indices=N(a)),d}};const j=new Set(["fuzzy","include"]),T=[{type:"exact",multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:t=>({type:"exact",search(e){const n=e===t;return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"include",multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:t=>({type:"include",search(e){let n,i=0;const r=[],s=t.length;for(;(n=e.indexOf(t,i))>-1;)i=n+s,r.push([n,i-1]);const o=!!r.length;return{isMatch:o,score:o?0:1,indices:r}}})},{type:"prefix-exact",multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:t=>({type:"prefix-exact",search(e){const n=e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,t.length-1]}}})},{type:"inverse-prefix-exact",multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:t=>({type:"inverse-prefix-exact",search(e){const n=!e.startsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"inverse-suffix-exact",multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:t=>({type:"inverse-suffix-exact",search(e){const n=!e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"suffix-exact",multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:t=>({type:"suffix-exact",search(e){const n=e.endsWith(t);return{isMatch:n,score:n?0:1,indices:[e.length-t.length,e.length-1]}}})},{type:"inverse-exact",multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:t=>({type:"inverse-exact",search(e){const n=-1===e.indexOf(t);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}})},{type:"fuzzy",multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(t,e={})=>{const n=new _(t,{location:e.location??b.location,threshold:e.threshold??b.threshold,distance:e.distance??b.distance,includeMatches:e.includeMatches??b.includeMatches,findAllMatches:e.findAllMatches??b.findAllMatches,minMatchCharLength:e.minMatchCharLength??b.minMatchCharLength,isCaseSensitive:e.isCaseSensitive??b.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics??b.ignoreDiacritics,ignoreLocation:e.ignoreLocation??b.ignoreLocation});return{type:"fuzzy",search:t=>n.searchIn(t)}}}],z=T.length;function O(t,e){const n=t.match(e);return n?n[1]:null}const W=[];function U(...t){W.push(...t)}function G(t,e){for(let n=0,i=W.length;n<i;n+=1){const i=W[n];if(i.condition(t,e))return new i(t,e)}return new _(t,e)}const J="$and",P="$path",K=t=>!(!t[J]&&!t.$or),Y=t=>({[J]:Object.keys(t).map((e=>({[e]:t[e]})))});function H(t,e,{auto:n=!0}={}){const i=t=>{if(p(t)){const i={keyId:null,pattern:t};return n&&(i.searcher=G(t,e)),i}const r=Object.keys(t),s=(t=>!!t[P])(t);if(!s&&r.length>1&&!K(t))return i(Y(t));if((t=>!g(t)&&C(t)&&!K(t))(t)){const i=s?t[P]:r[0],o=s?t.$val:t[i];if(!p(o))throw new Error((t=>`Invalid value for key ${t}`)(i));const u={keyId:x(i),pattern:o};return n&&(u.searcher=G(o,e)),u}const o={children:[],operator:r[0]};return r.forEach((e=>{const n=t[e];g(n)&&n.forEach((t=>{o.children.push(i(t))}))})),o};return K(t)||(t=Y(t)),i(t)}function q(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){let n=1;return t.forEach((({key:t,norm:i,score:r})=>{const s=t?t.weight:null;n*=Math.pow(0===r&&s?Number.EPSILON:r,(s||1)*(e?1:i))})),n}var V=class{constructor(t,e){this.limit=t,this.heap=[],this.comparator=e}get size(){return this.heap.length}insert(t){this.size<this.limit?(this.heap.push(t),this._bubbleUp(this.size-1)):this.comparator(t,this.heap[0])<0&&(this.heap[0]=t,this._sinkDown(0))}extractSorted(){return this.heap.sort(this.comparator)}_bubbleUp(t){const e=this.heap;for(;t>0;){const n=t-1>>1;if(this.comparator(e[t],e[n])<=0)break;const i=e[t];e[t]=e[n],e[n]=i,t=n}}_sinkDown(t){const e=this.heap,n=e.length;let i=t;do{const r=2*(t=i)+1,s=2*t+2;if(r<n&&this.comparator(e[r],e[i])>0&&(i=r),s<n&&this.comparator(e[s],e[i])>0&&(i=s),i!==t){const n=e[t];e[t]=e[i],e[i]=n}}while(i!==t)}};const Q=/[\p{L}\p{M}\p{N}_]+/gu,X=new WeakSet;function Z({isCaseSensitive:t=!1,ignoreDiacritics:e=!1,tokenize:n}={}){const i=function(t){if("function"==typeof t){let e=!1;return n=>{const i=t(n);if(!e&&(e=!0,!Array.isArray(i)||i.some((t=>"string"!=typeof t))))throw new Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(i)?"array containing non-strings":typeof i}.`);return i}}return t instanceof RegExp?(t.global||X.has(e=t)||(X.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`)),e=>e.match(t)||[]):t=>t.match(Q)||[];var e}(n);return{tokenize:n=>(t||(n=n.toLowerCase()),e&&(n=R(n)),i(n))}}function tt(t,e,n,i){const r=i.tokenize(e);if(!r.length)return;t.fieldCount++,t.docFieldCount.set(n,(t.docFieldCount.get(n)||0)+1);const s=new Set(r);let o=t.docTermFieldHits.get(n);o||(o=new Map,t.docTermFieldHits.set(n,o));for(const e of s)o.set(e,(o.get(e)||0)+1),t.df.set(e,(t.df.get(e)||0)+1)}function et(t,e,n,i){const{i:r,v:s,$:o}=e;if(void 0===s){if(o)for(let e=0;e<n;e++){const n=o[e];if(n)if(Array.isArray(n))for(const e of n)tt(t,e.v,r,i);else tt(t,n.v,r,i)}}else tt(t,s,r,i)}function nt(t,e){const n=t.docFieldCount.get(e);if(void 0===n)return;t.fieldCount-=n,t.docFieldCount.delete(e);const i=t.docTermFieldHits.get(e);if(i){for(const[e,n]of i){const i=(t.df.get(e)||0)-n;i<=0?t.df.delete(e):t.df.set(e,i)}t.docTermFieldHits.delete(e)}}function it(t,e){if(0===e.length)return;const n=Array.from(new Set(e)).sort(((t,e)=>t-e));for(const e of n)nt(t,e);const i=t=>{let e=0,i=n.length;for(;e<i;){const r=e+i>>>1;n[r]<t?e=r+1:i=r}return t-e},r=n[0],s=new Map;for(const[e,n]of t.docFieldCount)s.set(e>r?i(e):e,n);t.docFieldCount=s;const o=new Map;for(const[e,n]of t.docTermFieldHits)o.set(e>r?i(e):e,n);t.docTermFieldHits=o}var rt=class{constructor(t,e,n){this.options={...b,...e},this._keyStore=new D(this.options.keys),this._docs=t,this._myIndex=null,this._invertedIndex=null,this.setCollection(t,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(t){if(this._lastQuery===t)return this._lastSearcher;const e=G(t,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=t,this._lastSearcher=e,e}setCollection(t,e){if(this._docs=t,e&&!(e instanceof k))throw new Error("Incorrect 'index' type");if(this._myIndex=e||S(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=function(t,e,n){const i={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(const r of t)et(i,r,e,n);return i}(this._myIndex.records,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}add(t){if(!v(t))return;this._docs.push(t);const e=this._myIndex.add(t,this._docs.length-1);if(this._invertedIndex&&e){const t=Z({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});!function(t,e,n,i){et(t,e,n,i)}(this._invertedIndex,e,this._myIndex.keys.length,t)}this._invalidateSearcherCache()}remove(t=()=>!1){const e=[],n=[];for(let i=0,r=this._docs.length;i<r;i+=1)t(this._docs[i],i)&&(e.push(this._docs[i]),n.push(i));if(n.length){this._invertedIndex&&it(this._invertedIndex,n);const t=new Set(n);this._docs=this._docs.filter(((e,n)=>!t.has(n))),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return e}removeAt(t){if(!Number.isInteger(t)||t<0||t>=this._docs.length)throw new Error(M);this._invertedIndex&&it(this._invertedIndex,[t]);const e=this._docs.splice(t,1)[0];return this._myIndex.removeAt(t),this._invalidateSearcherCache(),e}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}_normalizedKeys(){return this._myIndex.keys.map((t=>this._keyStore.get(t.id)||t))}search(t,e){const{limit:n=-1}=e||{},{includeMatches:i,includeScore:r,shouldSort:s,sortFn:o,ignoreFieldNorm:u}=this.options;if(p(t)&&!t.trim()){let t=this._docs.map(((t,e)=>({item:t,refIndex:e})));return y(n)&&n>-1&&(t=t.slice(0,n)),t}const c=s&&y(n)&&n>0&&p(t),h=o,a=(t,e)=>h(t,e)||t.idx-e.idx;let l;if(c){const e=new V(n,a);p(this._docs[0])?this._searchStringList(t,{heap:e,ignoreFieldNorm:u}):this._searchObjectList(t,{heap:e,ignoreFieldNorm:u}),l=e.extractSorted()}else l=p(t)?p(this._docs[0])?this._searchStringList(t):this._searchObjectList(t):this._searchLogical(t),function(t,{ignoreFieldNorm:e=b.ignoreFieldNorm}){t.forEach((t=>{t.score=q(t.matches,{ignoreFieldNorm:e})}))}(l,{ignoreFieldNorm:u}),s&&l.sort(p(t)?a:h),y(n)&&n>-1&&(l=l.slice(0,n));return function(t,e,{includeMatches:n=b.includeMatches,includeScore:i=b.includeScore}={}){return t.map((t=>{const{idx:r}=t,s={item:e[r],refIndex:r};return n&&(s.matches=function(t){const e=[];return t.matches.forEach((t=>{if(!v(t.indices)||!t.indices.length)return;const n={indices:t.indices,value:t.value};t.key&&(n.key=t.key.id),t.idx>-1&&(n.refIndex=t.idx),e.push(n)})),e}(t)),i&&(s.score=t.score),s}))}(l,this._docs,{includeMatches:i,includeScore:r})}_searchStringList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=e?null:[];return s.forEach((({v:t,i:s,n:u})=>{if(!v(t))return;const c=i.searchIn(t);if(c.isMatch){const i={score:c.score,value:t,norm:u,indices:c.indices};r&&(i.matchedMask=c.matchedMask,i.matchedTerms=c.matchedTerms,i.termCount=c.termCount);const h=[i];if(!r||this._coversAllTokens(h)){const i={item:t,idx:s,matches:h};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):o.push(i)}}})),o}_searchLogical(t){const e=H(t,this.options),n=this._normalizedKeys(),i=(t,e,r)=>{if(!("children"in t)){const{keyId:i,searcher:s}=t;let o;return null===i?(o=[],n.forEach(((t,n)=>{o.push(...this._findMatches({key:t,value:e[n],searcher:s}))}))):o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(e,i),searcher:s}),o&&o.length?[{idx:r,item:e,matches:o}]:[]}const{children:s,operator:o}=t,u=[];for(let t=0,n=s.length;t<n;t+=1){const n=i(s[t],e,r);if(n.length)u.push(...n);else if(o===J)return[]}return u},r=this._myIndex.records,s=new Map,o=[];return r.forEach((({$:t,i:n})=>{if(v(t)){const r=i(e,t,n);r.length&&(s.has(n)||(s.set(n,{idx:n,item:t,matches:[]}),o.push(s.get(n))),r.forEach((({matches:t})=>{s.get(n).matches.push(...t)})))}})),o}_searchObjectList(t,{heap:e,ignoreFieldNorm:n}={}){const i=this._getSearcher(t),r=this.options.useTokenSearch&&"all"===this.options.tokenMatch,{records:s}=this._myIndex,o=this._normalizedKeys(),u=e?null:[];return s.forEach((({$:t,i:s})=>{if(!v(t))return;const c=[];let h=!1,a=!1;if(o.forEach(((e,n)=>{const r=this._findMatches({key:e,value:t[n],searcher:i});r.length?(c.push(...r),r[0].hasInverse&&(a=!0)):h=!0})),(!a||!h)&&c.length&&(!r||this._coversAllTokens(c))){const i={idx:s,item:t,matches:c};e?(i.score=q(i.matches,{ignoreFieldNorm:n}),e.insert(i)):u.push(i)}})),u}_findMatches({key:t,value:e,searcher:n}){if(!v(e))return[];const i=[];if(g(e))e.forEach((({v:e,i:r,n:s})=>{if(!v(e))return;const o=n.searchIn(e);if(o.isMatch){const n={score:o.score,key:t,value:e,idx:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),i.push(n)}}));else{const{v:r,n:s}=e,o=n.searchIn(r);if(o.isMatch){const e={score:o.score,key:t,value:r,norm:s,indices:o.indices,hasInverse:o.hasInverse};void 0!==o.termCount&&(e.matchedMask=o.matchedMask,e.matchedTerms=o.matchedTerms,e.termCount=o.termCount),i.push(e)}}return i}_coversAllTokens(t){const e=t.length?t[0].termCount:void 0;if(void 0===e)return!0;if(e<=31){let n=0;for(let e=0;e<t.length;e++)n|=t[e].matchedMask||0;return n===2**e-1}const n=new Set;for(let e=0;e<t.length;e++){const i=t[e].matchedTerms;if(i)for(const t of i)n.add(t)}return n.size===e}};rt.version="7.5.0",rt.createIndex=S,rt.parseIndex=function(t,{getFn:e=b.getFn,fieldNormWeight:n=b.fieldNormWeight}={}){const{keys:i,records:r}=t,s=new k({getFn:e,fieldNormWeight:n});return s.setKeys(i),s.setIndexRecords(r),s},rt.config=b,rt.match=function(t,e,n){if(n&&n.useTokenSearch)throw new Error("Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.");return G(t,{...b,...n}).searchIn(e)},rt.parseQuery=H,U(class{constructor(t,{isCaseSensitive:e=b.isCaseSensitive,ignoreDiacritics:n=b.ignoreDiacritics,includeMatches:i=b.includeMatches,minMatchCharLength:r=b.minMatchCharLength,ignoreLocation:s=b.ignoreLocation,findAllMatches:o=b.findAllMatches,location:u=b.location,threshold:c=b.threshold,distance:h=b.distance}={}){this.query=null,this.options={isCaseSensitive:e,ignoreDiacritics:n,includeMatches:i,minMatchCharLength:r,findAllMatches:o,ignoreLocation:s,location:u,threshold:c,distance:h},t=e?t:t.toLowerCase(),t=n?R(t):t,this.pattern=t,this.query=function(t,e={}){return t.replace(/\\\|/g,"\0").split("|").map((t=>{const n=function(t){const e=[],n=t.length;let i=0;for(;i<n;){for(;i<n&&" "===t[i];)i++;if(i>=n)break;let r=i;for(;r<n&&" "!==t[r]&&'"'!==t[r];)r++;if(r<n&&'"'===t[r]){for(r++;r<n;){if('"'===t[r]){const e=r+1;if(e>=n||" "===t[e]){r++;break}if("$"===t[e]&&(e+1>=n||" "===t[e+1])){r+=2;break}}r++}e.push(t.substring(i,r)),i=r}else{for(;r<n&&" "!==t[r];)r++;e.push(t.substring(i,r)),i=r}}return e}(t.replace(/\u0000/g,"|").trim()).filter((t=>t&&!!t.trim())),i=[];for(let t=0,r=n.length;t<r;t+=1){const r=n[t];let s=!1,o=-1;for(;!s&&++o<z;){const t=T[o],n=O(r,t.multiRegex);n&&(i.push(t.create(n,e)),s=!0)}if(!s)for(o=-1;++o<z;){const t=T[o],n=O(r,t.singleRegex);if(n){i.push(t.create(n,e));break}}}return i}))}(this.pattern,this.options)}static condition(t,e){return e.useExtendedSearch}searchIn(t){const e=this.query;if(!e)return{isMatch:!1,score:1};const{includeMatches:n,isCaseSensitive:i,ignoreDiacritics:r}=this.options;t=i?t:t.toLowerCase(),t=r?R(t):t;let s=0;const o=[];let u=0,c=!1;for(let i=0,r=e.length;i<r;i+=1){const r=e[i];o.length=0,s=0,c=!1;for(let e=0,i=r.length;e<i;e+=1){const i=r[e],{isMatch:h,indices:a,score:l}=i.search(t);if(!h){u=0,s=0,o.length=0,c=!1;break}s+=1,u+=l,i.type.startsWith("inverse")&&(c=!0),n&&(j.has(i.type)?o.push(...a):o.push(a))}if(s){const t={isMatch:!0,score:u/s};return c&&(t.hasInverse=!0),n&&(t.indices=N(o)),t}}return{isMatch:!1,score:1}}}),U(class{static condition(t,e){return e.useTokenSearch}constructor(t,e){this.options=e,this.analyzer=Z({isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,tokenize:e.tokenize});const n=this.analyzer.tokenize(t),{df:i,fieldCount:r}=e._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(const t of n){this.termSearchers.push(new _(t,{location:e.location,threshold:e.threshold,distance:e.distance,includeMatches:e.includeMatches,findAllMatches:e.findAllMatches,minMatchCharLength:e.minMatchCharLength,isCaseSensitive:e.isCaseSensitive,ignoreDiacritics:e.ignoreDiacritics,ignoreLocation:!0}));const n=i.get(t)||0,s=Math.log(1+(r-n+.5)/(n+.5));this.idfWeights.push(s)}this.combineAll="all"===e.tokenMatch,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(t){if(!this.termSearchers.length)return{isMatch:!1,score:1};const e=[];let n=0,i=0,r=0,s=0;const o=this.combineAll&&!this.useMask?new Set:null;for(let u=0;u<this.termSearchers.length;u++){const c=this.termSearchers[u].searchIn(t),h=this.idfWeights[u];i+=h,c.isMatch&&(r++,n+=h*(1-c.score),c.indices&&e.push(...c.indices),this.combineAll&&(this.useMask?s|=1<<u:o.add(u)))}if(0===r)return{isMatch:!1,score:1};const u={isMatch:!0,score:Math.max(.001,i>0?1-n/i:0)};return this.options.includeMatches&&e.length&&(u.indices=N(e)),this.combineAll&&(this.useMask?u.matchedMask=s:u.matchedTerms=o,u.termCount=this.numTerms),u}}),rt.use=function(...t){t.forEach((t=>U(t)))};var st=rt;const ot=1,ut=100,ct=20,ht={keys:["preferred_label"],includeScore:!0,ignoreDiacritics:!0,ignoreFieldNorm:!0,threshold:.6,minMatchCharLength:1,ignoreLocation:!0,distance:100},at="T.ex. målare, florist, kock",lt={format:(t,e,n)=>{const i=function(t,e){if(!t)return[];if(!e||0===e.trim().length)return[{text:t,isMatch:!1}];const n=t.toLowerCase(),i=e.toLowerCase().split(/\s+/).filter((t=>t.length>0)),r=new Set;if(i.forEach((t=>{let e=0;for(;-1!==(e=n.indexOf(t,e));){for(let n=0;n<t.length;n++)r.add(e+n);e+=t.length}})),0===r.size&&i.forEach((e=>{const n=function(t,e){const n=t.toLowerCase(),i=e.length;let r=99,s=-1,o=0;const u=Math.max(3,i-2),c=Math.min(n.length,i+2);for(let t=0;t<=n.length-u;t++)for(let i=u;i<=c&&t+i<=n.length;i++){const u=ft(e,n.slice(t,t+i));u<r&&(r=u,s=t,o=i)}return r<=Math.max(2,Math.floor(.25*i))&&-1!==s?{start:s,length:o}:null}(t,e);if(n)for(let t=0;t<n.length;t++)r.add(n.start+t)})),0===r.size)return[{text:t,isMatch:!1}];const s=[];let o="",u=r.has(0);for(let e=0;e<t.length;e++){const n=r.has(e);n!==u?(o.length>0&&s.push({text:o,isMatch:u}),o=t[e],u=n):o+=t[e]}return o.length>0&&s.push({text:o,isMatch:u}),s}(t,e);return n?[...i,{text:" ",isMatch:!1},{text:`(${n})`,isMetadata:!0}]:i}};function ft(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}s.setLevel(s.levels.DEBUG);const dt=t=>t?t.toLowerCase().trim():"";function gt(t,e){return t.id&&e.id?t.id===e.id&&(t.occupationId??t.occupation_name_id??"")===(e.occupationId??e.occupation_name_id??""):t.rawLabel===e.rawLabel}function At(t){return t.sort(((t,e)=>{const n=t.score??0,i=e.score??0;if(n!==i)return i-n;const r=t.weight??0,s=e.weight??0;return r!==s?s-r:t.displayLabel.localeCompare(e.displayLabel,"sv")}))}function pt(t){return t.map((t=>t.isMatch?`<strong>${t.text}</strong>`:t.isMetadata?`<span class="occupation-variant-label">${t.text}</span>`:t.text)).join("")}const yt=t=>t?t.replace(/ (\([^)]+\))/g,' <span class="occupation-variant-label">$1</span>'):"";function Ct(t,e,n){return t===e?1:n.length>1?n.every((e=>t.includes(e)))?.98:null:t.startsWith(e)?.99:t.includes(e)?.95:null}function vt(t,e){const n=t.length,i=e.length,r=Array.from({length:n+1},(()=>new Array(i+1).fill(0)));for(let t=0;t<=n;t++)r[t][0]=t;for(let t=0;t<=i;t++)r[0][t]=t;for(let s=1;s<=n;s++)for(let n=1;n<=i;n++)r[s][n]=t[s-1]===e[n-1]?r[s-1][n-1]:1+Math.min(r[s-1][n],r[s][n-1],r[s-1][n-1]);return r[n][i]}function wt(t,e){const n=t.toLowerCase().trim(),i=e.toLowerCase().trim();return i.includes(" ")?vt(n,i)<=Math.max(2,Math.floor(.25*n.length))&&Math.abs(n.length-i.length)<=2:null!==function(t,e){const n=t.toLowerCase(),i=e.length;let r=99;const s=Math.max(3,i-2),o=Math.min(n.length,i+2);for(let t=0;t<=n.length-s;t++)for(let i=s;i<=o&&t+i<=n.length;i++){const s=vt(e,n.slice(t,t+i));s<r&&(r=s)}return r<=Math.max(2,Math.floor(.25*i))?r:null}(i,n)}function mt(t,e){return(t.search_aliases??[]).some((t=>dt(t)===e))}function Mt(t,e,n){const i=function(t){return t.occupation_name_preferred_label?`${t.preferred_label||""} (${t.occupation_name_preferred_label})`:t.preferred_label||""}(t),r=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,type:t.type,preferred_label:t.preferred_label||"",rawLabel:t.preferred_label||"",displayLabel:i,highlightedLabel:pt(r),displaySegments:r,weight:t.weight??0,score:n,occupationId:t.occupation_name_id,occupationLabel:t.occupation_name_preferred_label,ssyk_level_4_id:t.ssyk_level_4_id,ssyk_code_2012:t.ssyk_code_2012}}function Ft(t){return"job-title"===t.type?`${t.id}|${t.occupation_name_id??""}`:t.id}function Dt(t,e,n,i){if(!n)return[];if(!e||!Array.isArray(e))return s.warn("[searchConcepts] Ogiltig items array."),[];if(!t||t.length<1)return[];const r=dt(t),o=r.split(" ").filter((t=>t.length>0)),u=[],c=new Set;for(const n of e){const e=Ct(dt(n.preferred_label),r,o),i=mt(n,r)?1:e;null!==i&&(u.push(Mt(n,t,i)),c.add(Ft(n)))}if(u.length>0)return At(u).slice(0,i);if(n){const e=n.search(r);if(0===e.length)return[];const s=e[0].score??1,o=[];let u=!1;for(const n of e){const e=Ft(n.item);if(c.has(e))continue;const i=n.score??1,h=1-i;if(h<.4)continue;if(i>s+.12)continue;const a=dt(n.item.preferred_label),l=n.item.weight??0,f=wt(r,a);f&&i<=.25&&(u=!0);let d=.7*h+.1*l;f&&(d+=.12);const g=Math.min(.84,Math.max(.4,d));o.push(Mt(n.item,t,g)),c.add(e)}const h=At(o);if(0===h.length)return[];const a=u?Math.min(5,i):Math.min(3,i);return h.slice(0,a)}return[]}const Bt={toGenericItem:t=>({id:t.id,label:t.preferred_label||"",description:t.occupation_name_preferred_label,metadata:{original:t,type:t.type,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}),searchResultToGenericItem(t,e){const n=lt.format(t.preferred_label||"",e,t.occupation_name_preferred_label);return{id:t.id,label:t.preferred_label||"",displaySegments:n,highlightedLabel:pt(n),metadata:{original:t,ssyk_level_4_id:t.ssyk_level_4_id,weight:t.weight}}},fromGenericItem:t=>({id:t.id,preferred_label:t.label,weight:t.metadata?.weight,...t.metadata?.original}),toPublicSelection(t,e){const n=t.id||"",i=t.preferred_label||t.rawLabel||"";if(!n)return{type:"manual-input",id:null,preferred_label:i};if("job-title"!==t.type&&"occupation-name"!==t.type)throw new Error(`Ogiltig intern yrkestyp för ${n}: ${t.type}`);const r={type:t.type,id:n,preferred_label:i};t.ssyk_code_2012&&(r.ssyk_code_2012=t.ssyk_code_2012);const s=t.occupation_name_id||t.occupationId;if("job-title"===t.type&&s){const n=t.occupation_name_preferred_label?.trim()||t.occupationLabel?.trim();r.related={type:"occupation-name",id:s,preferred_label:n||e?.(s)||s}}return r}};class Et{fuseInstance=null;items=[];constructor(t){this.items=t,this.fuseInstance=new st(t,ht)}search(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>Bt.toPublicSelection(t))):[]}searchAsGeneric(t,e=20){return this.fuseInstance?Dt(t,this.items,this.fuseInstance,e).map((t=>({id:t.id,label:t.displayLabel,description:t.occupationLabel,group:"job-title"===t.type?"Yrke":"Yrkesgrupp",metadata:{originalResult:t,highlightedLabel:t.highlightedLabel,score:t.score,weight:t.weight}}))):[]}updateData(t){this.items=t,this.fuseInstance=new st(t,ht)}}class xt extends Error{code;invalidIds;constructor(t,e,n){super(t),this.name="InvalidSelectionError",this.code=e,this.invalidIds=n}}export{ut as D,xt as I,lt as L,ct as M,at as P,Et as T,Bt as a,l as b,ot as c,yt as d,d as g,gt as i,s as l,f as r,pt as s}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h as i,r as t,c as e,a as s}from"./p-vJ-tamti.js";import{A as o}from"./p-DHK95AvZ.js";const a={search:'<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width:100%;height:100%"><path d="M25.645 22.437l-5.063-5.053a1.22 1.22 0 00-.864-.355h-.827a10.477 10.477 0 002.234-6.487C21.125 4.719 16.397 0 10.562 0 4.729 0 0 4.719 0 10.542c0 5.823 4.728 10.542 10.563 10.542 2.452 0 4.707-.831 6.5-2.23v.826c0 .324.126.633.355.862l5.063 5.053c.477.476 1.25.476 1.721 0l1.437-1.435a1.22 1.22 0 00.006-1.723zm-15.082-5.408c-3.59 0-6.5-2.899-6.5-6.487a6.49 6.49 0 016.5-6.487c3.59 0 6.5 2.899 6.5 6.487a6.49 6.49 0 01-6.5 6.487z" fill="currentColor" fill-rule="nonzero"/></svg>',check:'<svg width="23" height="18" viewBox="0 0 23 18" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width:100%;height:100%"><path d="M20.547.18L7.315 13.627 2.453 8.686a.597.597 0 00-.853 0L.177 10.132a.62.62 0 000 .868l6.711 6.82c.236.24.618.24.854 0L22.823 2.493a.62.62 0 000-.867L21.4.18a.597.597 0 00-.853 0z" fill="currentColor"/></svg>',x:'<svg width="12" height="12" viewBox="0 0 12 12" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="width:100%;height:100%"><g stroke="currentColor" stroke-width="2" fill="none" fill-rule="evenodd" stroke-linecap="square"><path d="M2 2l7.986 7.986M9.986 2L2 9.986"/></g></svg>'},r=({name:t,class:e})=>i("span",{class:{"af-icon":!0,"af-icon--default-size":!e,..."string"==typeof e?{[e]:!0}:e},"aria-hidden":"true",innerHTML:a[t]}),n=({label:t,forId:e,description:s,required:o=!1})=>i("div",{class:"af-form-label"},i("label",{class:"af-form-label__label",htmlFor:e},t,o?" *":""),s&&i("span",{class:"af-form-label__description"},s)),l=({text:t,breakWords:e=!1,onRemove:s})=>i("span",{class:"af-tag"},i("button",{type:"button",class:"af-tag__button","aria-label":`Ta bort ${t}`,onClick:i=>{i.preventDefault(),s()}},i("span",{class:{"af-tag__text":!0,"af-tag__text--break":e}},t),i(r,{name:"x",class:"af-tag__remove-icon"})));function c(i,t=!1){if(!i||t||i.manualInputBlocked)return!1;const e=i.inputValue.trim();return""!==e&&!i.suggestions.some((i=>i.label.toLowerCase()===e.toLowerCase()))}function h(i,t,e){return e<=0?-1:"down"===i?t<e-1?t+1:t:t>0?t-1:-1}const d=class{constructor(i){t(this,i),this.csInput=e(this,"csInput"),this.csSelect=e(this,"csSelect"),this.csClear=e(this,"csClear"),this.csRemoveItem=e(this,"csRemoveItem"),this.csBlur=e(this,"csBlur"),this.csEditSelection=e(this,"csEditSelection"),this.csFocus=e(this,"csFocus"),this.csLoadMore=e(this,"csLoadMore"),this.csClearHistory=e(this,"csClearHistory"),this.csRequestHistory=e(this,"csRequestHistory")}static RESULT_ANNOUNCEMENT_DELAY_MS=1200;static ERROR_AFTER_COLLAPSE_DELAY_MS=400;static ACTIVE_DESCENDANT_DELAY_MS=75;static LIVE_REGION_RESTORE_DELAY_MS=100;historyRequestTimer;resultAnnouncementTimer;resultRestoreTimer;validationRestoreTimer;validationRestoreDelayMs=0;activeDescendantTimer;disconnectedCallback(){clearTimeout(this.historyRequestTimer),this.historyRequestTimer=void 0,this.clearResultAnnouncement(),clearTimeout(this.validationRestoreTimer),this.validationRestoreTimer=void 0,this.validationRestoreDelayMs=0,this.isValidationMessageHidden=!1,this.clearDeferredActiveDescendant()}static nextId=0;get hostElement(){return s(this)}state;config={disabled:!1,placeholder:"Sök...",minLength:1,maxResults:20,enableMultiple:!1,showSearchIcon:!0,requireSelection:!0,size:"medium"};label="";labelDescription;componentId="cs-"+d.nextId++;size="medium";csInput;csSelect;csClear;csRemoveItem;csBlur;csEditSelection;csFocus;csLoadMore;csClearHistory;csRequestHistory;afFocused=!1;activeIndex=-1;isFocusedInternal=!1;isNavigatingWithKeyboard=!1;resultAnnouncement="";isValidationMessageHidden=!1;isActiveDescendantDeferred=!1;hasTypedSinceFocus=!1;isKeyboardNavigationActive=!1;hasPendingResultAnnouncement=!1;renderedExpanded=!1;expandedAtManualSelect=!1;async setFocus(){if(this.inputRef){this.inputRef.focus();const i=this.inputRef.value.length;this.inputRef.setSelectionRange(i,i)}else this.shouldFocusAfterRender=!0}inputRef;listRef;shouldFocusAfterRender=!1;handleKeyDown=i=>{if(this.config.disabled)return void i.preventDefault();if(!this.state)return;if("Tab"===i.key&&(this.hasTypedSinceFocus=!1),"BUTTON"===i.target?.tagName)return;if("ArrowUp"!==i.key&&"ArrowDown"!==i.key&&"Enter"!==i.key&&"Escape"!==i.key&&(this.isKeyboardNavigationActive=!1,this.isNavigatingWithKeyboard=!1),"itemSelected"===this.state.status&&"Tab"!==i.key&&"Shift"!==i.key&&!i.ctrlKey&&!i.metaKey)return void this.csEditSelection.emit();if("searching"!==this.state.status&&"multiSelect"!==this.state.status)return;const t=this.state.suggestions,e=c(this.state,this.config.requireSelection),s=t.length+(e?1:0);switch(i.key){case"ArrowDown":if(s>0){i.preventDefault(),this.cancelPendingResultAnnouncement();const e=this.renderedExpanded;this.isFocusedInternal=!0,this.isKeyboardNavigationActive=!0,this.isNavigatingWithKeyboard=!0,this.activeIndex=h("down",this.activeIndex,s),e||this.deferActiveDescendant(),this.scrollToActive(),this.activeIndex>=t.length-3&&this.csLoadMore.emit()}else this.csFocus.emit();break;case"ArrowUp":if(s>0){i.preventDefault(),this.activeIndex>=0&&this.cancelPendingResultAnnouncement();const t=this.renderedExpanded,e=this.activeIndex,o=this.isNavigatingWithKeyboard;this.isKeyboardNavigationActive=!0,this.isNavigatingWithKeyboard=!0,this.activeIndex=h("up",this.activeIndex,s),this.activeIndex>=0?(t||this.deferActiveDescendant(),this.scrollToActive()):(this.isKeyboardNavigationActive=!1,this.isNavigatingWithKeyboard=!1,e>=0&&o&&this.announceReturnToInput())}break;case" ":case"Enter":if(" "===i.key&&-1===this.activeIndex)return;if("Enter"!==i.key||!this.state.manualInputBlocked||this.activeIndex>=0&&this.activeIndex<t.length)if(this.activeIndex>=0&&this.activeIndex<t.length){i.preventDefault();const e=t[this.activeIndex];this.shouldFocusAfterRender=!0,e.isSelected?this.csRemoveItem.emit(e):this.csSelect.emit(e)}else e&&this.activeIndex===t.length&&this.isNavigatingWithKeyboard?(i.preventDefault(),this.handleManualSelect()):"Enter"===i.key&&(e||t.length>0)&&(i.preventDefault(),this.isNavigatingWithKeyboard=!0);else i.preventDefault(),this.reannounceValidationMessage();break;case"Escape":this.activeIndex=-1,this.clearDeferredActiveDescendant(),this.clearResultAnnouncement(),this.csClear.emit()}};markResultAnnouncementPending(i){""!==i.trim()?(clearTimeout(this.resultAnnouncementTimer),this.resultAnnouncementTimer=void 0,clearTimeout(this.resultRestoreTimer),this.resultRestoreTimer=void 0,this.hasPendingResultAnnouncement=!0):this.clearResultAnnouncement()}scheduleResultAnnouncement(i,t){this.hasPendingResultAnnouncement&&i&&""!==i.inputValue.trim()&&(this.isNavigatingWithKeyboard||void 0!==i.resultsQuery&&i.resultsQuery!==i.inputValue||t&&!d.hasNewResult(t,i)||(clearTimeout(this.resultAnnouncementTimer),this.resultAnnouncementTimer=setTimeout((()=>{this.resultAnnouncementTimer=void 0,this.announceResultCount()}),d.RESULT_ANNOUNCEMENT_DELAY_MS)))}static hasNewResult(i,t){return i.inputValue!==t.inputValue||i.resultsQuery!==t.resultsQuery||i.hasMoreResults!==t.hasMoreResults||i.suggestions.length!==t.suggestions.length||t.suggestions.some(((t,e)=>{const s=i.suggestions[e];return t.id!==s.id||t.label!==s.label||!!t.isSelected!=!!s.isSelected}))}deferActiveDescendant(){clearTimeout(this.activeDescendantTimer),this.isActiveDescendantDeferred=!0,this.activeDescendantTimer=setTimeout((()=>{this.activeDescendantTimer=void 0,this.isActiveDescendantDeferred=!1}),d.ACTIVE_DESCENDANT_DELAY_MS)}clearDeferredActiveDescendant(){clearTimeout(this.activeDescendantTimer),this.activeDescendantTimer=void 0,this.isActiveDescendantDeferred=!1}announceReturnToInput(){this.clearDeferredActiveDescendant();const i=this.state.inputValue.trim(),t=[this.label,i].filter(Boolean).join(", ");t&&this.setResultAnnouncement(t)}cancelPendingResultAnnouncement(){clearTimeout(this.resultAnnouncementTimer),this.resultAnnouncementTimer=void 0,clearTimeout(this.resultRestoreTimer),this.resultRestoreTimer=void 0,this.hasPendingResultAnnouncement=!1}announceResultCount(){this.hasPendingResultAnnouncement=!1,this.state&&this.isFocusedInternal&&"itemSelected"!==this.state.status&&!this.isNavigatingWithKeyboard?this.setResultAnnouncement(function(i,t={}){if(!i||""===i.inputValue.trim())return"";const e=i.suggestions.filter((i=>!i.isSelected)).length;if(e>0)return`${i.hasMoreResults??(t.maxResults&&i.suggestions.length>=t.maxResults)?"Minst ":""}${e} förslag. Använd pil ned för att välja.`;if(!c(i,t.requireSelection))return"Inga förslag.";switch(t.manualInputMode){case"feedback":return"Inga förslag. Använd pil ned för att skicka in texten som förslag.";case"combined":return"Inga förslag. Använd pil ned för att använda texten och skicka in den som förslag.";default:return"Inga förslag. Använd pil ned för att använda texten."}}(this.state,this.config)):this.clearResultAnnouncement()}setResultAnnouncement(i){if(clearTimeout(this.resultRestoreTimer),this.resultRestoreTimer=void 0,""!==i&&i===this.resultAnnouncement)return this.resultAnnouncement="",void(this.resultRestoreTimer=setTimeout((()=>{this.resultRestoreTimer=void 0,this.resultAnnouncement=i}),d.LIVE_REGION_RESTORE_DELAY_MS));this.resultAnnouncement=i}clearResultAnnouncement(){clearTimeout(this.resultAnnouncementTimer),this.resultAnnouncementTimer=void 0,clearTimeout(this.resultRestoreTimer),this.resultRestoreTimer=void 0,this.hasPendingResultAnnouncement=!1,this.resultAnnouncement=""}reannounceValidationMessage(){"error"===this.state.validation&&this.state.message&&this.showValidationMessageAfter(d.LIVE_REGION_RESTORE_DELAY_MS)}showValidationMessageAfter(i){this.validationRestoreTimer&&i<=this.validationRestoreDelayMs||(clearTimeout(this.validationRestoreTimer),this.isValidationMessageHidden=!0,this.validationRestoreDelayMs=i,this.validationRestoreTimer=setTimeout((()=>{this.validationRestoreTimer=void 0,this.validationRestoreDelayMs=0,this.isValidationMessageHidden=!1}),i))}onWrapperFocusIn=()=>{this.config.disabled||this.state&&this.isFocusedInternal||this.state&&(this.isFocusedInternal=!0,this.activeIndex=-1,this.isNavigatingWithKeyboard=!1,this.isKeyboardNavigationActive=!1,this.hasTypedSinceFocus=!1,this.csFocus.emit(),""===this.state.inputValue.trim()&&this.csRequestHistory.emit())};onWrapperFocusOut=()=>{this.shouldFocusAfterRender||requestAnimationFrame((()=>{const i=this.hostElement.shadowRoot,t=i?.activeElement||document.activeElement;t&&this.hostElement.contains(t)||i&&i.contains(t)||(this.isFocusedInternal=!1,this.activeIndex=-1,this.clearResultAnnouncement(),this.clearDeferredActiveDescendant(),this.isNavigatingWithKeyboard=!1,this.isKeyboardNavigationActive=!1,this.hasTypedSinceFocus=!1,this.csBlur.emit())}))};handleAfFocusedChange(i){this.isFocusedInternal=i,i&&this.hostElement.shadowRoot?.activeElement!==this.inputRef&&(this.shouldFocusAfterRender=!0)}handleConfigChange(i){i.disabled&&(this.isFocusedInternal=!1,this.activeIndex=-1,this.shouldFocusAfterRender=!1,this.isNavigatingWithKeyboard=!1,this.isKeyboardNavigationActive=!1,this.hasTypedSinceFocus=!1)}handleStateChange(i,t){const e=function({activeIndex:i,newState:t,oldState:e,requireSelection:s=!1}){if(e&&t.inputValue!==e.inputValue)return{activeIndex:-1,shouldRestoreFocus:!1};let o=i;"multiSelect"===t.status&&"multiSelect"===e?.status&&t.selectedItems.length>e.selectedItems.length&&(o=0);const a=c(e,s),r=Boolean(e&&a&&i===e.suggestions.length),n=c(t,s),l=t.suggestions.length+(n?1:0);return r?o=n?t.suggestions.length:-1:0===l?o=-1:o>=l&&(o=l-1),{activeIndex:o,shouldRestoreFocus:"itemSelected"===t.status&&"itemSelected"!==e?.status}}({activeIndex:this.activeIndex,newState:i,oldState:t,requireSelection:this.config.requireSelection});if(this.activeIndex=e.activeIndex,e.shouldRestoreFocus&&(this.shouldFocusAfterRender=!0),this.scheduleResultAnnouncement(i,t),i?.manualInputBlocked&&!t?.manualInputBlocked&&"error"===i.validation){const i=this.renderedExpanded||this.expandedAtManualSelect;this.expandedAtManualSelect=!1,i&&!this.isComboboxExpanded()&&this.showValidationMessageAfter(d.ERROR_AFTER_COLLAPSE_DELAY_MS)}}componentDidUpdate(){this.shouldFocusAfterRender&&this.performFocusRestoration()}performFocusRestoration(i=0){if(this.config.disabled)this.shouldFocusAfterRender=!1;else if(this.inputRef){this.isFocusedInternal=!0,this.inputRef.focus();const t=this.hostElement.shadowRoot?.activeElement;if(t===this.inputRef||i>20){const i=this.inputRef.value.length;this.inputRef.setSelectionRange(i,i),this.shouldFocusAfterRender=!1}else requestAnimationFrame((()=>this.performFocusRestoration(i+1)))}}isComboboxExpanded(){if(!this.state||"itemSelected"===this.state.status)return!1;const i=this.state.suggestions.length>0||c(this.state,this.config.requireSelection),t=this.hasTypedSinceFocus&&this.state.inputValue.trim().length>0;return i&&this.isSuggestionsListRendered()&&(this.isNavigatingWithKeyboard||t)}isSuggestionsListRendered(){if(!this.state||!this.isFocusedInternal||"itemSelected"===this.state.status)return!1;const i=this.state.inputValue.trim().length>0;return this.state.suggestions.length>0||c(this.state,this.config.requireSelection)||i}handleScroll(i){if(!this.config.enableInfiniteScroll)return;const t=i.target;t.scrollHeight-(t.scrollTop+t.clientHeight)<50&&this.csLoadMore.emit()}handleMouseMove=i=>{0===i.movementX&&0===i.movementY||this.isKeyboardNavigationActive&&(this.isKeyboardNavigationActive=!1,this.isNavigatingWithKeyboard=!1)};handleMouseLeave=()=>{this.isKeyboardNavigationActive||(this.activeIndex=-1)};scrollToActive(){if(!this.listRef||!this.state)return;if(-1===this.activeIndex)return void(this.listRef.scrollTop=0);const i=this.listRef.querySelector("#"+(this.activeIndex===this.state.suggestions.length?`${this.componentId}-list-option-manual-input`:`${this.componentId}-list-option-${this.activeIndex}`));if(!i)return;const t=this.listRef.getBoundingClientRect(),e=i.getBoundingClientRect();e.bottom>t.bottom?this.listRef.scrollTop+=e.bottom-t.bottom:e.top<t.top&&(this.listRef.scrollTop-=t.top-e.top)}handleManualSelect(){const i={id:"",label:this.state.inputValue.trim(),metadata:{type:"ManualInput"}};this.expandedAtManualSelect=this.renderedExpanded,this.config.isFeedback?(this.isFocusedInternal=!1,this.shouldFocusAfterRender=!1,this.activeIndex=-1,this.isKeyboardNavigationActive=!1,this.isNavigatingWithKeyboard=!1):this.shouldFocusAfterRender=!0,this.csSelect.emit(i),this.config.enableMultiple&&""===this.state?.inputValue?.trim()&&this.csRequestHistory.emit()}render(){if(!this.state)return null;const t="itemSelected"===this.state.status;return i("div",{class:{"core-selector-wrapper":!0,"is-disabled":!!this.config.disabled},"aria-disabled":this.config.disabled?"true":"false",onKeyDown:i=>this.handleKeyDown(i),onMouseMove:this.handleMouseMove,onFocusin:this.onWrapperFocusIn,onFocusout:this.onWrapperFocusOut},this.label&&i(n,{label:this.label,forId:`${this.componentId}-input`,description:this.labelDescription}),this.labelDescription&&i("div",{id:`${this.componentId}-description`,class:"visually-hidden"},this.labelDescription),this.state&&"loading"===this.state.status&&i("div",{class:"loading-indicator"},"Laddar..."),this.state&&"error"===this.state.status&&i("div",{class:"error-message"},this.state.message),this.state&&["searching","itemSelected","multiSelect"].includes(this.state.status)&&i("div",{class:"combobox-container"},this.renderSearchContainer(),this.isFocusedInternal&&!t&&this.renderSuggestionsList()),i("div",{id:`${this.componentId}-validation-alert`,role:"alert"},this.state&&"error"===this.state.validation&&"itemSelected"!==this.state.status&&i(o,{id:`${this.componentId}-validation-message`,variant:"error",class:"selector-validation-message"},this.isValidationMessageHidden?i("span",{class:"af-validation-message__placeholder","aria-hidden":"true"},this.state.message):this.state.message)),this.state&&"success"===this.state.validation&&"itemSelected"!==this.state.status&&i(o,{id:`${this.componentId}-validation-message`,variant:"success",class:"selector-validation-message"},this.state.message),i("div",{id:`${this.componentId}-result-count`,class:"visually-hidden",role:"status","aria-live":"polite","aria-atomic":"true"},this.resultAnnouncement))}renderSearchContainer(){const t="itemSelected"===this.state.status,e=t?this.state.selectedItem?.label||"":this.state.inputValue,s="multiSelect"===this.state.status,o=e.length>0,a=s&&this.state.selectedItems.length>0,n=this.isComboboxExpanded();this.renderedExpanded=n;const c=n&&this.activeIndex>=0&&this.isNavigatingWithKeyboard&&!this.isActiveDescendantDeferred?this.activeIndex===this.state.suggestions.length?`${this.componentId}-list-option-manual-input`:`${this.componentId}-list-option-${this.activeIndex}`:void 0,h=`${this.componentId}-validation-message`,d=this.state&&"error"===this.state.validation&&this.state.message,g=[];!!this.labelDescription&&0===e.length&&g.push(`${this.componentId}-description`),d&&g.push(h);const p=g.length>0?g.join(" "):void 0;return i("div",{class:{"search-container":!0,"is-inactive-selected":t,"multi-search-container":s,"has-tags":a,"has-validation-error":"error"===this.state?.validation,"has-positive-validation":!t&&"success"===this.state?.validation},onClick:()=>{this.config.disabled||(t?this.csEditSelection.emit():""===this.state.inputValue.trim()&&this.csRequestHistory.emit())}},s&&this.state.selectedItems.length>0&&i("div",{class:"selected-tags-wrapper"},this.state.selectedItems.map((t=>i(l,{key:t.id,text:t.label,breakWords:!0,onRemove:()=>{this.shouldFocusAfterRender=!0,this.csRemoveItem.emit(t)}})))),i("div",{class:"input-controls-wrapper"},i(r,{name:"search",class:{"search-icon-container":!0,"selector-search-icon":!0,"is-hidden":!this.config.showSearchIcon||o||a}}),i("div",{class:{"input-area":!0,"has-value":!this.config.showSearchIcon||o||a}},t&&i("span",{class:"selected-text-in-box"},e),!t&&!o&&this.config.placeholder&&i("span",{class:"selector-placeholder-overlay","aria-hidden":"true"},this.config.placeholder),i("input",{class:{"selector-input-field":!0,"visually-hidden-selected":t},ref:i=>this.inputRef=i,id:`${this.componentId}-input`,type:"text",value:e,maxLength:120,onFocus:()=>{this.config.disabled||this.isFocusedInternal||(this.isFocusedInternal=!0,this.activeIndex=-1,this.isNavigatingWithKeyboard=!1,this.isKeyboardNavigationActive=!1,this.hasTypedSinceFocus=!1,this.csFocus.emit(),this.state&&""===this.state.inputValue.trim()&&this.csRequestHistory.emit())},onInput:i=>{if(this.config.disabled)return;this.isKeyboardNavigationActive=!1,this.isNavigatingWithKeyboard=!1,this.isFocusedInternal=!0;const t=i.target.value;this.hasTypedSinceFocus=!0,this.clearDeferredActiveDescendant(),this.markResultAnnouncementPending(t),this.csInput.emit(t)},autocomplete:"off",role:"combobox","aria-label":this.label,"aria-autocomplete":"list","aria-haspopup":"listbox","aria-expanded":n?"true":"false","aria-controls":n?`${this.componentId}-listbox`:void 0,"aria-activedescendant":c,"aria-invalid":d?"true":"false","aria-describedby":p,readOnly:t,disabled:!!this.config.disabled})),i("button",{type:"button",class:{"clear-button":!0,"is-visible":o||t},tabIndex:o||t?0:-1,disabled:!!this.config.disabled,"aria-label":"Rensa inmatad text",onMouseDown:i=>i.preventDefault(),onClick:i=>{i.stopPropagation(),this.config.disabled||(this.isFocusedInternal=!0,this.clearResultAnnouncement(),this.csInput.emit(""),this.shouldFocusAfterRender=!0,this.csClear.emit(),this.csRequestHistory.emit())}},i(r,{name:"x"}))))}renderSuggestionsList(){if("itemSelected"===this.state.status)return null;const t=Boolean(this.state.inputValue&&this.state.inputValue.trim().length>0),e=c(this.state,this.config.requireSelection),s=Boolean(this.state.suggestions&&this.state.suggestions.length>0),o=t&&!s&&!e;if(!s&&!e&&!o)return null;const a=this.state.listHeader||this.config.listHeader,n=this.state.showHistoryHeader||this.state.isHistoryView&&this.config.showHistoryHeader;return i("div",{class:"suggestions-box-container"},i("div",{class:{"suggestions-box":!0,"is-keyboard-nav":this.isNavigatingWithKeyboard},ref:i=>this.listRef=i,onScroll:i=>this.handleScroll(i),onMouseLeave:this.handleMouseLeave},(a||n)&&i("div",{class:"list-header-container"},i("slot",{name:"suggestions-overlay"}),a&&i("div",{class:"list-header"},i("span",null,a)),n&&i("div",{class:"list-header history-header"},i("span",null,"Din privata historik")," - ",i("button",{type:"button",class:"history-clear-link","aria-label":"Rensa historik",disabled:!!this.config.disabled,onMouseDown:i=>i.preventDefault(),onClick:()=>{this.config.disabled||this.csClearHistory.emit()}},"Rensa"))),!a&&!n&&i("slot",{name:"suggestions-overlay"}),i("div",{id:`${this.componentId}-listbox`,role:"listbox"},o&&i("div",{class:"suggestion-item no-results"},"Inga resultat matchade din sökning"),this.state.suggestions.map(((t,e)=>i("div",{key:t.id?`${t.id}|${t.label}`:e,role:"option",id:`${this.componentId}-list-option-${e}`,"aria-selected":!!t.isSelected,"aria-current":e===this.activeIndex?"true":"false",class:{"suggestion-item":!0,"active-suggestion":e===this.activeIndex,"is-selected":!!t.isSelected,"is-keyboard-focus":e===this.activeIndex&&this.isNavigatingWithKeyboard},onMouseDown:i=>{i.preventDefault(),this.config.disabled||(this.shouldFocusAfterRender=!0,t.isSelected?this.csRemoveItem.emit(t):this.csSelect.emit(t),this.config.enableMultiple&&(clearTimeout(this.historyRequestTimer),this.historyRequestTimer=setTimeout((()=>{this.csRequestHistory.emit(),this.historyRequestTimer=void 0}),50)))},onMouseMove:this.handleMouseMove,onMouseEnter:()=>{this.config.disabled||this.isKeyboardNavigationActive||(this.isNavigatingWithKeyboard=!1,t.isSelected||(this.activeIndex=e))}},i(r,{name:"check",class:"selection-indicator-icon"}),i("span",null,t.displaySegments?t.displaySegments.map(((t,e)=>i("span",{key:e,class:{"match-highlight":!!t.isMatch,"metadata-dimmed":!!t.isMetadata}},t.text))):t.label)))),c(this.state,this.config.requireSelection)&&i("div",{role:"option",id:`${this.componentId}-list-option-manual-input`,class:{"suggestion-item":!0,"active-suggestion":this.activeIndex===this.state.suggestions.length,"is-keyboard-focus":this.activeIndex===this.state.suggestions.length&&this.isNavigatingWithKeyboard},onMouseDown:i=>{i.preventDefault(),this.config.disabled||this.handleManualSelect()},onMouseMove:this.handleMouseMove,onMouseEnter:()=>{this.config.disabled||this.isKeyboardNavigationActive||(this.isNavigatingWithKeyboard=!1,this.activeIndex=this.state.suggestions.length)}},i("span",null,"feedback"===this.config.manualInputMode?i("span",null,'Skicka in "',i("strong",null,this.state.inputValue.trim()),'" som förslag på ',this.config.feedbackTargetName||"yrke"," som saknas."):i("span",null,'Använd "',i("strong",null,this.state.inputValue.trim()),"combined"===this.config.manualInputMode?'" och skicka in förslaget till Arbetsförmedlingen':'"'))))))}static get delegatesFocus(){return!0}static get watchers(){return{afFocused:[{handleAfFocusedChange:0}],config:[{handleConfigChange:0}],state:[{handleStateChange:0}]}}};d.style=":host{--digi--grayscale-0:#ffffff;--digi--grayscale-50:#fbfbfb;--digi--grayscale-100:#f4f4f4;--digi--grayscale-200:#ededed;--digi--grayscale-300:#e4e4e4;--digi--grayscale-400:#dddddd;--digi--grayscale-500:#cacaca;--digi--grayscale-600:#acacac;--digi--grayscale-700:#757575;--digi--grayscale-800:#5c5c5c;--digi--grayscale-900:#333333;--digi--grayscale-1000:#000000;--digi--global--color--cta--link--base:#1616b2;--digi--global--color--function--danger--base:#da0000;--digi--global--color--function--success--base:#008a20;--digi--global--color--function--success--lightest-3:#d4edda;--digi--global--color--function--warning--base:#ffe200;--af-text-color:var(--digi--color--text--primary, var(--digi--grayscale-900));--digi--global--typography--font-family--default:\"Open Sans\", Arial, sans-serif;--digi--global--typography--font-size--base:1rem;--digi--global--typography--font-size--small:0.875rem;--digi--global--typography--font-weight--regular:400;--digi--global--typography--font-weight--semibold:600;--digi--global--typography--font-weight--bold:700;--digi--global--typography--line-height--base:1.5;--digi--typography--label--font-size--desktop:1rem;--digi--typography--label--font-weight--desktop:600;--digi--typography--label--line-height--desktop:1.5;--digi--typography--label-description--font-size--desktop:1rem;--digi--typography--label-description--line-height--desktop:1.5;--digi--typography--tag--font-size--desktop:0.875rem;--digi--gutter--icon:0.625rem;--digi--gutter--smaller:0.75rem;--digi--gutter--small:0.875rem;--digi--gutter--medium:1rem;--digi--border-width--primary:1px;--digi--border-style--primary:solid;--digi--border-radius--primary:0;--digi--border-radius--secondary:6px;--af-tag-color:var(--digi--color--text--interactive--brand-primary, #091d54);--af-tag-background:var(--digi--color--background--interactive--default--secondary, var(--digi--grayscale-0));--af-tag-hover-background:var(--digi--color--background--interactive--hover--secondary, #ddf1fc)}.af-form-label{color:var(--af-text-color);display:flex;flex-direction:column;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--label--font-size--desktop);margin-bottom:0.5rem}.af-form-label__label{cursor:pointer;display:block;font-weight:var(--digi--typography--label--font-weight--desktop);line-height:var(--digi--typography--label--line-height--desktop)}.af-form-label__description{display:block;font-size:var(--digi--typography--label-description--font-size--desktop);line-height:var(--digi--typography--label-description--line-height--desktop);max-width:35rem}.af-validation-message{align-items:center;display:flex;flex-wrap:wrap}.af-validation-message__icon{flex:0 0 auto;height:1.25em;margin-inline-end:var(--digi--gutter--icon);width:1.25em}.af-validation-message__icon--success,.af-validation-message__icon--error{background-color:var(--af-validation-icon-color, currentColor);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}.af-validation-message__icon--success{--af-validation-icon-color:var(--digi--color--icon--validation--success, var(--digi--global--color--function--success--base));-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E\")}.af-validation-message__icon--error{--af-validation-icon-color:var(--digi--color--icon--validation--error, var(--digi--global--color--function--danger--base));-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E\")}.af-validation-message__icon--warning{background:center / contain no-repeat url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='6.75' fill='%23333'/%3E%3Cpath d='m18 9c0 4.9717-4.0298 9-9 9-4.9702 0-9-4.0283-9-9 0-4.9688 4.0298-9 9-9 4.9702 0 9 4.0312 9 9zm-9 1.8145c-0.92196 0-1.6694 0.7474-1.6694 1.6694 0 0.92196 0.7474 1.6694 1.6694 1.6694s1.6694-0.7474 1.6694-1.6694c0-0.92196-0.7474-1.6694-1.6694-1.6694zm-1.3157-1.065c0.012593 0.23095 0.20355 0.41175 0.43483 0.41175h1.7618c0.23128 0 0.42224-0.1808 0.43483-0.41175l0.2692-4.9355c0.013609-0.24946-0.18501-0.45922-0.43483-0.45922h-2.3002c-0.24982 0-0.4484 0.20976-0.43479 0.45922l0.2692 4.9355z' fill='%23FFE200'/%3E%3C/svg%3E\");position:relative;top:3px}.af-validation-message__text{color:var(--af-text-color);flex:1;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--tag--font-size--desktop);transform:translateY(1px)}.af-validation-message__placeholder{visibility:hidden}.af-tag{display:block;max-width:100%;min-width:0}.af-tag__button{align-items:center;background:var(--af-tag-background);border:var(--digi--border-width--primary) var(--digi--border-style--primary) var(--af-tag-color);border-radius:var(--digi--border-radius--secondary);color:var(--af-tag-color);cursor:pointer;display:inline-flex;font-family:var(--digi--global--typography--font-family--default);font-size:0.875rem;font-weight:var(--digi--global--typography--font-weight--semibold);gap:10px;height:auto;max-width:100%;min-height:unset;min-width:0;padding:6px 8px;text-align:left;white-space:normal}.af-tag__button:hover{background:var(--af-tag-hover-background)}.af-tag__button:focus-visible{background:var(--af-tag-hover-background);border-color:var(--af-tag-color);outline:2px solid var(--digi--color--text--primary, var(--digi--grayscale-1000));outline-offset:2px;box-shadow:0 0 0 5px var(--digi--color--background--primary, var(--digi--grayscale-0))}.af-tag__button:active{background:var(--af-tag-hover-background)}.af-tag__text{display:inline-block;max-width:100%;min-width:0;white-space:normal}.af-tag__text--break{overflow-wrap:anywhere;word-break:break-word}.af-icon{display:flex !important;min-height:1.4em !important;align-items:center !important}.af-icon--default-size{width:12px !important;height:12px !important}.af-tag__remove-icon{flex:0 0 auto;height:1em;width:1em}.af-icon.af-tag__remove-icon{min-height:0 !important}:host{--selector-width:var(--cs-width, 100%);--selector-min-width:var(--cs-min-width, 200px);--selector-max-width:var(--cs-max-width, none);--selector-height:var(--cs-height, auto);--selector-min-height:var(--cs-min-height, auto);--selector-max-height:var(--cs-max-height, none);--selector-font-family:var(--global-font-family, 'Open Sans', sans-serif);--selector-font-size:var(--cs-font-size, 1rem);--selector-text-color:var(--cs-text-color, var(--digi--color--text--primary, #212529));--selector-placeholder-color:var(--cs-placeholder-color, var(--digi--color--text--description, #6c757d));--selector-border-color:var(--cs-border-color, var(--digi--color--border--interactive--default--on-input, #d1d5db));--selector-focus-border-color:var(--cs-focus-border-color, #86b7fe);--selector-focus-shadow:var(--cs-focus-shadow, 0 0 0 0.25rem rgba(13, 110, 253, 0.25));--selector-background-color:var(--cs-background-color, var(--digi--color--background--interactive--default--input-elements, #fff));--selector-icon-color:var(--cs-icon-color, var(--digi--color--icon--primary, #6c757d));--selector-clear-button-color:var(--cs-clear-button-color, var(--digi--color--icon--primary, #6c757d));--selector-clear-button-hover-color:var(--cs-clear-button-hover-color, var(--digi--color--icon--primary, #212529));--selector-suggestion-background-color:var(--cs-suggestion-background-color, var(--digi--color--background--dropdown, #fff));--selector-suggestion-border-color:var(--cs-suggestion-border-color, var(--digi--color--divider--primary, #ced4da));--selector-suggestion-hover-background:var(--cs-suggestion-hover-background, var(--digi--color--background--interactive--hover--quarternary, #e9ecef));--selector-suggestion-active-background:var(--cs-suggestion-active-background, var(--digi--color--background--interactive--hover--quarternary, #dde4eb));--selector-suggestion-text-color:var(--cs-suggestion-text-color, var(--digi--color--text--primary, #212529));--selector-suggestion-highlight-weight:var(--cs-suggestion-highlight-weight, bold);--selector-error-color:var(--cs-error-color, var(--digi--color--border--interactive--validation--error, #dc3545));--selector-loading-color:var(--cs-loading-color, var(--digi--color--text--description, #6c757d));--selector-container-min-height:40px;--selector-padding-y:6px;--selector-padding-x:10px;--selector-icon-size:1.1em;--selector-gap:6px;--cs-row-height:32px;display:flex;flex-direction:column;width:var(--selector-width);min-width:var(--selector-min-width);max-width:var(--selector-max-width);height:var(--selector-height);min-height:var(--selector-min-height);max-height:var(--selector-max-height);font-family:var(--selector-font-family);font-size:var(--selector-font-size);color:var(--selector-text-color);position:relative}:host([cs-size=\"small\"]){--selector-container-min-height:32px;--selector-padding-y:2px;--selector-icon-size:1em;--selector-gap:4px;--cs-row-height:28px}:host([cs-size=\"medium\"]){--selector-container-min-height:40px;--selector-padding-y:6px;--cs-row-height:32px}:host([cs-size=\"large\"]){--selector-container-min-height:48px;--selector-padding-y:10px;--selector-icon-size:1.25em;--selector-gap:8px;--cs-row-height:40px}*{box-sizing:border-box}.core-selector-wrapper{display:flex;flex-direction:column;flex:1;min-height:inherit}.af-form-label{margin-bottom:0.5rem}.search-container{display:flex;align-items:center;flex-wrap:wrap;gap:6px;border:1px solid var(--digi--color--border--interactive--default--on-input, #757575);border-radius:0px;padding:var(--selector-padding-y) var(--selector-padding-x);flex:1;min-height:var(--selector-container-min-height);cursor:text;background-color:var(--selector-background-color);position:relative;overflow:hidden}.search-container:focus-within{outline:2px solid var(--digi--color--text--primary, black);outline-offset:2px}.search-container.is-inactive-selected .selector-input-field{caret-color:transparent;cursor:default}.is-inactive-selected+.suggestions-box-container{display:none !important}.search-container.is-inactive-selected .search-icon-container{display:none}.search-container.is-inactive-selected .input-area{padding-left:0}.input-controls-wrapper{position:relative;width:100%;display:flex;align-items:center}.search-icon-container{position:absolute;left:0;top:50%;width:20px;height:20px;transform:translateY(-50%);z-index:1;pointer-events:none;display:flex;align-items:center;justify-content:center;transition:transform 0.2s ease-in-out, opacity 0.2s ease-in-out;opacity:1;max-height:100%}.search-icon-container.is-hidden{opacity:0;transform:translateY(-50%) scale(0.7)}.selector-search-icon{color:var(--digi--color--icon--primary, #333);display:block;flex:0 0 auto;width:20px;height:20px}.clear-button>span{color:var(--digi--color--icon--primary, #333)}.input-area{position:relative;flex:1;min-width:0;padding-left:27px;display:flex;align-items:center;transition:padding-left 0.2s ease-in-out}.input-area.has-value{padding-left:0}.selector-placeholder-overlay{position:absolute;left:27px;right:0;top:50%;transform:translateY(-50%);color:var(--selector-placeholder-color);font-family:inherit;font-size:var(--selector-font-size);line-height:normal;padding:1px 2px;pointer-events:none;user-select:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;transition:left 0.2s ease-in-out}.input-area.has-value .selector-placeholder-overlay{left:0}.selector-input-field{position:relative;z-index:1;width:100%;font-family:inherit;font-size:var(--selector-font-size);color:inherit;border:none;outline:none;background:transparent;transition:padding-right 0.2s ease-in-out}.search-container.has-input .selector-input-field{padding-right:0}.selector-input-field::placeholder{color:var(--selector-placeholder-color);opacity:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.clear-button{position:static;flex-shrink:0;opacity:0;pointer-events:none;z-index:2;background:none;border:none;padding:0;margin:0;height:20px;width:20px;cursor:pointer;color:var(--selector-clear-button-color);line-height:1;display:flex;align-items:center;transition:color 0.2s ease-in-out, opacity 0.2s ease-in-out}.clear-button.is-visible{opacity:1;pointer-events:auto}.clear-button:hover,.clear-button:focus{color:var(--selector-clear-button-hover-color);outline:none}.search-container.multi-search-container{display:flex;flex-direction:column;gap:0.5rem;align-items:stretch;padding-top:var(--selector-padding-y);padding-bottom:var(--selector-padding-y);width:100%;max-width:100%}.selected-tags-wrapper{display:flex;flex-wrap:wrap;gap:0.5rem;width:100%;max-width:100%;box-sizing:border-box}.selected-tags-wrapper .af-tag{display:block;max-width:100%;min-width:0}.selected-tags-wrapper .af-tag__button{white-space:normal !important;height:auto !important;text-align:left !important;word-break:break-word !important;overflow-wrap:anywhere !important;max-width:100% !important}.search-container.single-value-display{display:flex;align-items:center;flex-wrap:nowrap;gap:0.5rem;min-height:var(--selector-container-min-height);padding:var(--selector-padding-y) var(--selector-padding-x)}.selected-text-in-box{flex-grow:1;white-space:normal;word-break:break-word;min-width:0;line-height:inherit}.search-container.single-value-display .clear-button{position:static;transform:none;opacity:1;pointer-events:auto;flex-shrink:0}.combobox-container{position:relative;margin-top:0;display:flex;flex-direction:column;flex:1}.suggestions-box-container{position:absolute;top:100%;left:0;right:0;z-index:100}.suggestions-box-container.is-hidden-list{z-index:101;pointer-events:none}.suggestions-box{position:relative;background-color:var(--digi--color--background--dropdown, white);border:1px solid var(--selector-suggestion-border-color);border-radius:4px;box-shadow:0 2px 6px 0 var(--digi--color--misc--dropshadow, rgba(0, 0, 0, 0.15));overflow-y:auto;margin:2px 0px;max-height:calc(var(--max-visible-rows, 10) * var(--cs-row-height) + 40px)}.suggestion-item{display:flex;align-items:center;min-height:var(--cs-row-height);height:auto;padding:6px 1rem;font-size:inherit;line-height:1.25;cursor:pointer;color:var(--selector-suggestion-text-color);list-style:none;transition:background-color 0.15s ease, color 0.15s ease;white-space:normal !important;word-break:break-word !important;overflow-wrap:anywhere !important;position:relative;z-index:1;box-sizing:border-box}.suggestion-item>span{transition:font-weight 0.2s ease, transform 0.2s ease;display:inline;vertical-align:middle;white-space:normal;word-break:break-word;overflow-wrap:anywhere}.suggestion-item:hover,.suggestion-item.active-suggestion{background-color:var(--selector-suggestion-active-background)}.suggestions-box.is-keyboard-nav .suggestion-item:hover:not(.active-suggestion){background-color:transparent}.suggestion-item.active-suggestion.is-keyboard-focus{outline:1px solid var(--digi--color--text--primary, black);outline-offset:-1px}.suggestion-item.is-selected{color:var(--selector-suggestion-text-color) !important;cursor:default;background-color:var(--digi--color--background--interactive--selected--tertiary, #f2f2f2) !important}.suggestion-item.is-selected span{font-weight:600}.selection-indicator-icon{width:0;height:20px;opacity:0;transform:scale(0.5);margin-right:0;transition:width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), margin-right 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);color:var(--digi--color--icon--primary, var(--digi--grayscale-800, #333));flex-shrink:0;display:flex;align-items:center;justify-content:center;overflow:hidden}.suggestion-item.is-selected .selection-indicator-icon{width:24px;opacity:1;transform:scale(1);margin-right:8px}.suggestion-item.is-selected.active-suggestion{background-color:var(--digi--color--background--interactive--selected--tertiary, #f2f2f2) !important}.suggestion-item .suggestion-text strong,.suggestion-item .match-highlight{font-weight:var(--selector-suggestion-highlight-weight);color:inherit;display:inline}.metadata-dimmed,.occupation-variant-label{font-size:1rem;color:var(--digi--color--text--description, var(--digi--grayscale-700, #757575));margin-left:0.25rem;display:inline;vertical-align:baseline;line-height:inherit;white-space:normal}.suggestion-item.no-results{color:var(--selector-placeholder-color);cursor:default;padding:0.5rem 1rem;font-style:italic;text-align:center;height:auto}.search-container.has-validation-error{border-color:var(--selector-error-color);border-width:2px;background-color:var(--digi--color--background--interactive--validation--error, #fef3f2)}.search-container.has-positive-validation{border-color:var(--digi--color--border--interactive--validation--success, #155724);background-color:var(--digi--color--background--interactive--validation--success, #d4edda)}.status-message{margin-top:0.5rem}.selector-validation-message{margin-top:0.5rem;display:block}.visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}input::-webkit-search-decoration,input::-webkit-search-cancel-button,input::-webkit-search-results-button,input::-webkit-search-results-decoration{-webkit-appearance:none;display:none}input::-ms-clear{display:none;width:0;height:0}.list-header-container{position:sticky;top:0;z-index:10;background-color:var(--digi--color--background--secondary-muted, #f8f9fa);border-bottom:1px solid var(--selector-suggestion-border-color);min-height:auto;display:flex;flex-direction:column}.list-header-container ::slotted([slot=\"suggestions-overlay\"]){position:absolute !important;top:0;left:0;width:100%;height:100%;z-index:20}.suggestions-box>::slotted([slot=\"suggestions-overlay\"]){position:sticky !important;top:0;left:0;width:100%;z-index:20}.list-header{display:flex;align-items:center;min-height:var(--cs-row-height);padding:6px 1rem;font-size:0.875rem;line-height:1.25;color:var(--digi--color--text--description, var(--digi--grayscale-700, #757575));border-bottom:1px solid var(--selector-suggestion-border-color, #ced4da)}.list-header span{font-size:0.875rem;font-weight:normal}.history-clear-link{color:var(--digi--color--text--interactive--tertiary, var(--digi--grayscale-900, #333333));text-decoration:underline;cursor:pointer;margin-left:0.25rem;background:transparent;border:0;padding:0;font:inherit}.history-clear-link:hover{color:var(--digi--color--text--primary, var(--digi--grayscale-900, #222))}@keyframes cs-shrink-fade{from{opacity:1}to{opacity:1}}@keyframes cs-collapse{from{height:auto}to{height:auto}}.cs-toast{position:absolute;top:0;left:0;width:100%;height:100%;z-index:20;display:flex;align-items:center;justify-content:center;gap:8px;background-color:var(--digi--color--background--pop-out, #f8fdf0);animation:cs-toastSlideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;pointer-events:none;box-sizing:border-box}.cs-toast.is-closing{animation:cs-toastSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards}.cs-toast-text{margin:0;font-size:0.875rem;font-weight:500;color:var(--digi--color--text--primary, #2e7d32)}@keyframes cs-toastSlideDown{from{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes cs-toastSlideUp{from{transform:translateY(0)}to{transform:translateY(-100%)}}.selector-input-field.visually-hidden-selected{position:absolute;opacity:0;pointer-events:none;width:1px;height:1px;overflow:hidden}";export{d as core_selector}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t,r as i,c as e,h as s,F as a}from"./p-vJ-tamti.js";import{l as r,g as o,T as n,D as l,L as c,s as d,i as h,M as u,a as g,b as m,P as p,c as v,I as f,r as b,d as y}from"./p-D9zmn-JR.js";import{A as k}from"./p-DHK95AvZ.js";function w(t){return t.replace(/\b(?:(?:19|20)\d{2}|\d{2})(?:0[1-9]|1[0-2])(?:0[1-9]|[1-2][0-9]|3[0-1]|6[1-9]|[7-8][0-9]|9[0-1]) ?[-+]? ?\d{4}\b/g,"[personnummer]")}function S(t){return t.replace(/(?<![\p{L}\p{N}._%+-])[\p{L}\p{N}._%+-]+@(?:[\p{L}\p{N}-]+\.)+\p{L}{2,}(?![\p{L}\p{N}])/gu,"[e-post]")}function x(t){let i=t.replace(/(?:\+46|\b0046|\b46)[ .-]*(?:\(0\)[ .-]*)?[1-9](?:[ ./-]*\d){6,9}\b/g,"[telefonnummer]");return i=i.replace(/\(0\d{1,3}\)[ .-]*\d(?:[ ./-]*\d){4,7}\b/g,"[telefonnummer]"),i=i.replace(/\b(?!\d{1,2}[./]\d{1,2}[./]\d{2,4}\b)0[1-9](?:[ ./-]*\d){6,9}\b/g,"[telefonnummer]"),i}function C(t){return t.replace(/\bSE ?\d{2}(?: ?\d{4}){5}\b/gi,"[kontonummer]")}function I(t){return t.normalize("NFKC").replace(/[\u00AD\u200B-\u200D\u2060\uFEFF]/g,"").replace(/[\u2010-\u2015\u2212\uFE58\uFE63\uFF0D]/g,"-").replace(/\s+/g," ").trim()}function L(t){const i=I(t);let e=S(i);return e=C(e),e=w(e),e=x(e),e!==i}function H(t,i=160){if(!t||"string"!=typeof t)return"";let e=I(t);return 0===e.length?"":(e=function(t){return t.replace(/\b(?:https?:\/\/|www\.)\S+/gi,"[url]").replace(/\b[a-z0-9-]+(?:\.[a-z0-9-]+)*\.(?:se|com|nu|org|net|io|eu|info)\/\S*/g,"[url]")}(e),e=S(e),e=C(e),e=w(e),e=x(e),e=function(t){return t.replace(/(?<![\p{L}\p{N}])(?!\d{4}-\d{2}-\d{2}(?!\p{N})|\d{1,2}[./]\d{1,2}[./]\d{2,4}(?!\p{N}))\d(?:[ .-]?\d){7,}(?![\p{N}])/gu,"[nummer]")}(e),e=function(t){const i="gatan|vägen|gränd|stigen|allén|torget|gata",e=new RegExp(`(?<![\\p{L}\\p{N}_])(?:\\p{L}+(?:${i})|\\p{L}+\\s+(?:${i}))\\s+\\d{1,4}(?:\\s?[A-Za-z])?(?![\\p{L}\\p{N}_])`,"giu");return t.replace(e,"[adress]").replace(/\b\d{3} ?\d{2}\s+(?!(?:[Kk]r|[Kk]ronor|SEK|[Ee]uro|[Tt]immar|[Ss]tycken|[Ss]t)(?![\p{L}]))[A-ZÅÄÖ]\p{Ll}+/gu,"[postadress]")}(e),e=function(t){const i="[A-ZÅÄÖÉ]\\p{Ll}+(?:-[A-ZÅÄÖÉ]\\p{Ll}+)?",e=new RegExp(`(?<![\\p{L}\\p{N}_])((?:[Jj]ag\\s+heter|[Mm]itt\\s+(?:för|efter)?namn\\s+(?:är|e)|[Mm]vh|[Hh]älsningar|[Vv]änliga\\s+hälsningar|[Mm]ed\\s+vänlig\\s+hälsning)[,:]?\\s+)${i}(?:\\s+${i})?(?![\\p{L}\\p{N}_])`,"gu");return t.replace(e,((t,i)=>`${i}[namn]`))}(e),e=e.replace(/\s+/g," ").trim(),e.length>i&&(e=e.slice(0,i).trim()),e)}function _(t){return H(t,120)}function V(t){return H(t,160)}let z=null;const E={saveHistory(t){z=t;try{localStorage.setItem("job-selector_history",JSON.stringify(t)),r.debug("[HistoryService] saveHistory - History saved.")}catch(t){r.error("Kunde inte spara historik.",t)}},loadHistory(){if(z)return z;try{const t=localStorage.getItem("job-selector_history");if(t)return z=JSON.parse(t),z}catch(t){r.error("Kunde inte läsa historik.",t)}return z=[],z},clearHistory(){z=[];try{localStorage.removeItem("job-selector_history"),r.debug("[HistoryService] clearHistory - History cleared.")}catch(t){r.error("Kunde inte rensa historik.",t)}}};class D{callbacks;config;cappedResults;state={status:"loading"};taxonomyData=[];popularItems=[];searchEngine=null;debounceTimer;validationTimer;isTouched=!1;activeErrorType=null;constructor(t,i){this.callbacks=t,this.config=i}getState(){return this.state}getActiveErrorType(){return this.activeErrorType}updateConfig(t){this.config={...this.config,...t},void 0===t.required&&void 0===t.requireSelection||this.runValidation()}getTaxonomyData(){if(this.taxonomyData.length>0)return this.taxonomyData;const t=o();return t&&t.length>0&&(r.debug("[Controller] getTaxonomyData - Late initializing from registry"),this.taxonomyData=t,this.popularItems=this.computePopularItems(this.taxonomyData),this.searchEngine=new n(this.taxonomyData)),this.taxonomyData}destroy(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.validationTimer&&(clearTimeout(this.validationTimer),this.validationTimer=void 0)}async initialize(t){r.debug("[Controller] initialize - START",{hasInitialData:!!t}),this.updateState({status:"loading"});const i=t&&t.length>0?t:o();i&&i.length>0?(r.debug("[Controller] initialize - Loaded taxonomy from registry"),this.setStateToActive(i,"registry",(new Date).toISOString())):(r.warn("[Controller] initialize - No taxonomy found in registry. Has registerTaxonomy() been called?"),this.updateState({status:"error",message:"Kunde inte hitta yrkesdata. Kontrollera att komponenten är initierad korrekt."}))}handleFocus(){this.isTouched=!0}setStateToActive(t,i,e){this.taxonomyData=t,this.popularItems=this.computePopularItems(this.taxonomyData),this.searchEngine=new n(this.taxonomyData);const s={dataSource:i,dataSourceDate:e};this.updateState(this.config.enableMultiple?{status:"multiSelect",inputValue:"",selectedItems:[],suggestions:[],validation:"idle",...s}:{status:"searching",inputValue:"",suggestions:[],validation:"idle",...s})}handleInput(t){this.isTouched=!0,r.debug("[Controller] handleInput - Value:",t);const i="error"===this.state.validation||"from-error"===this.state.validationContext?"from-error":void 0;if(clearTimeout(this.debounceTimer),""===t.trim()){const t="itemSelected"===this.state.status;return this.updateState(this.config.enableMultiple?{status:"multiSelect",inputValue:"",selectedItems:"selectedItems"in this.state?this.state.selectedItems:[],suggestions:[],validation:"idle",validationContext:i,...this.getCommonState()}:{status:"searching",inputValue:"",suggestions:[],validation:"idle",validationContext:i,...this.getCommonState()}),t&&this.callbacks.onEmitSelection([]),void this.showHistory()}switch(this.state.status){case"multiSelect":case"multiSelectShowingHistory":this.updateState({status:"multiSelect",inputValue:t,selectedItems:"selectedItems"in this.state?this.state.selectedItems:[],suggestions:"suggestions"in this.state?this.state.suggestions:"historyItems"in this.state?this.state.historyItems:[],validation:"idle",validationContext:i,dataSource:"dataSource"in this.state?this.state.dataSource:void 0,dataSourceDate:"dataSourceDate"in this.state?this.state.dataSourceDate:void 0});break;case"itemSelected":case"searching":case"showingHistory":this.updateState({status:"searching",inputValue:t,suggestions:"suggestions"in this.state?this.state.suggestions:"historyItems"in this.state?this.state.historyItems:[],validation:"idle",validationContext:i,dataSource:"dataSource"in this.state?this.state.dataSource:void 0,dataSourceDate:"dataSourceDate"in this.state?this.state.dataSourceDate:void 0});break;case"loading":case"error":return;default:return this.state}t.length>=this.config.minLength&&(this.debounceTimer=setTimeout((()=>this.performSearch(t)),l))}performSearch(t){if(this.searchEngine)switch(this.state.status){case"searching":case"multiSelect":{const i=this.config.maxResults,e=this.searchEngine.searchAsGeneric(t,i+1),s=e.slice(0,i).flatMap((t=>t.metadata?.originalResult?[t.metadata.originalResult]:[]));this.cappedResults=e.length>i?s:void 0,this.updateState({...this.state,suggestions:s});break}case"loading":case"error":case"itemSelected":case"showingHistory":case"multiSelectShowingHistory":return;default:return this.state}}addToHistory(t){if(!this.config.history)return;const i=E.loadHistory(),e=c.format(t.rawLabel,"",t.occupationLabel),s={...t,displaySegments:e,highlightedLabel:d(e)},a=i.filter((t=>!h(t,s))),r=[s,...a].slice(0,this.config.maxHistoryItems);E.saveHistory(r)}clearHistory(){E.clearHistory(),this.showHistory(!0)}computePopularItems(t,i=this.config.maxResults||u){if(!t||0===t.length)return[];if(!t.some((t=>"number"==typeof t.weight&&t.weight>0)))return t.slice(0,i);const e=[...t].sort(((t,i)=>(i.weight??0)-(t.weight??0))),s=new Set,a=[];for(const t of e){const e=t.occupation_name_preferred_label||t.preferred_label;if(s.has(e)||(s.add(e),a.push(t)),a.length===i)break}return a}showHistory(t=!1){if("loading"===this.state.status||"error"===this.state.status)return;if(!this.config.history)return;const i=E.loadHistory();let e=i,s=!1;0===i.length&&(!1===this.config.popular?e=[]:(0===this.popularItems.length&&this.taxonomyData.length>0&&(this.popularItems=this.computePopularItems(this.taxonomyData)),e=this.popularItems.map((t=>this.toSearchResult(t))),s=!0));const a=e.filter((t=>"ManualInput"===t.type?!0===this.config.manualInput:this.taxonomyData.some((i=>i.id===t.id)))).map((t=>{const i=c.format(t.rawLabel,"",t.occupationLabel);return{...t,displaySegments:i,highlightedLabel:d(i)}})),{dataSource:r,dataSourceDate:o}=this.getCommonState(),n="inputValue"in this.state?this.state.inputValue:"";(t||""===n.trim()||"showingHistory"===this.state.status||"multiSelectShowingHistory"===this.state.status)&&this.updateState(this.config.enableMultiple?{status:"multiSelectShowingHistory",selectedItems:"selectedItems"in this.state?this.state.selectedItems:[],historyItems:a,inputValue:n,validation:"validation"in this.state?this.state.validation:"idle",validationContext:"error"===this.state.validation||"from-error"===this.state.validationContext?"from-error":void 0,dataSource:r,dataSourceDate:o,isPopularView:s}:{status:"showingHistory",historyItems:a,inputValue:n,validation:"validation"in this.state?this.state.validation:"idle",validationContext:"error"===this.state.validation||"from-error"===this.state.validationContext?"from-error":void 0,dataSource:r,dataSourceDate:o,isPopularView:s})}selectItem(t){r.debug("[Controller] selectItem",t),this.isTouched=!0,this.addToHistory(t);const i="error"===this.state.validation||"from-error"===this.state.validationContext?"from-error":void 0;switch(this.state.status){case"multiSelect":case"multiSelectShowingHistory":{const e="dataSource"in this.state?this.state.dataSource:void 0,s="dataSourceDate"in this.state?this.state.dataSourceDate:void 0,a="selectedItems"in this.state?this.state.selectedItems:[];if(a.findIndex((i=>h(i,t)))>-1)return;const r=[...a,t];this.updateState({...this.state,status:"multiSelect",selectedItems:r,inputValue:"",suggestions:[],validation:"idle",validationContext:i,dataSource:e,dataSourceDate:s}),this.callbacks.onEmitSelection(r.map((t=>this.toPublicSelection(t)))),this.showHistory(!0);break}case"searching":case"showingHistory":this.updateState({status:"itemSelected",selectedItem:t,inputValue:t.preferred_label,validation:"idle",validationContext:i,dataSource:"dataSource"in this.state?this.state.dataSource:void 0,dataSourceDate:"dataSourceDate"in this.state?this.state.dataSourceDate:void 0}),this.callbacks.onEmitSelection(this.toPublicSelection(t)),this.config.enableMultiple&&this.showHistory(!0);break;case"loading":case"error":break;case"itemSelected":this.updateState({...this.state,status:"itemSelected",selectedItem:t,inputValue:t.preferred_label,validation:"idle",validationContext:i,dataSource:"dataSource"in this.state?this.state.dataSource:void 0,dataSourceDate:"dataSourceDate"in this.state?this.state.dataSourceDate:void 0}),this.callbacks.onEmitSelection(this.toPublicSelection(t));break;default:r.warn("[Controller] selectItem - Unexpected state:",this.state)}this.runValidation()}clearSelection(){"itemSelected"===this.state.status&&(this.isTouched=!0,this.updateState({status:"searching",inputValue:this.state.inputValue||"",suggestions:[],validation:"idle",...this.getCommonState()}),this.callbacks.onEmitSelection([]),this.showHistory(),this.runValidation())}removeItem(t){switch(this.state.status){case"multiSelect":case"multiSelectShowingHistory":{const i=this.state.selectedItems.filter((i=>!h(i,t)));this.isTouched=!0,this.updateState({...this.state,selectedItems:i}),this.callbacks.onEmitSelection(i.map((t=>this.toPublicSelection(t)))),""===("inputValue"in this.state?this.state.inputValue:"")&&this.showHistory(),this.runValidation();break}}}handleBlur(){if(this.isTouched=!0,"searching"===this.state.status){const t=(this.state.inputValue||"").trim();if(""!==t){const i=this.findExactMatch(t);if(i)return void this.selectItem(this.toSearchResult(i))}}switch(this.state.status){case"searching":case"showingHistory":this.updateState({...this.state,status:"searching",inputValue:"inputValue"in this.state?this.state.inputValue:"",suggestions:[]});break;case"multiSelect":case"multiSelectShowingHistory":this.updateState({...this.state,status:"multiSelect",inputValue:"inputValue"in this.state?this.state.inputValue:"",suggestions:[]});break;case"loading":case"error":case"itemSelected":break;default:return this.state}this.runValidation()}runValidation(t=!1){if(t&&(this.isTouched=!0),!this.isTouched)return!0;if("loading"===this.state.status||"error"===this.state.status)return!0;const i=this.checkHasValue();let e=!0,s=null;const a="searching"===this.state.status||"multiSelect"===this.state.status||"multiSelectShowingHistory"===this.state.status,r=""!==("inputValue"in this.state?this.state.inputValue:"").trim();a&&r?(e=!1,s="invalidInput"):this.config.required&&!i&&(e=!1,s="required"),this.activeErrorType=s;const o="error"===this.state.validation||"from-error"===this.state.validationContext;let n;switch(n=e?o&&i?"success":"idle":"invalidInput"===s||t||o?"error":"idle","success"===n&&(clearTimeout(this.validationTimer),this.validationTimer=setTimeout((()=>{const t="validation"in this.state&&"success"===this.state.validation;["itemSelected","multiSelect","multiSelectShowingHistory"].includes(this.state.status)&&t&&this.updateState({...this.state,validation:"idle",validationContext:void 0}),this.validationTimer=void 0}),3e3)),this.state.status){case"searching":case"showingHistory":case"multiSelect":case"multiSelectShowingHistory":this.updateState({...this.state,validation:n});break;case"itemSelected":"error"!==n&&this.updateState({...this.state,validation:n});break;default:return this.state}return this.callbacks.onEmitValidation({isValid:e,errorType:s}),e}selectItemById(t){if(!t||this.config.enableMultiple||!this.taxonomyData)return;const i=this.taxonomyData.find((i=>i.id===t));if(i){const t=this.toSearchResult(i);this.updateState({status:"itemSelected",selectedItem:t,inputValue:t.preferred_label,validation:"idle",dataSource:"dataSource"in this.state?this.state.dataSource:void 0,dataSourceDate:"dataSourceDate"in this.state?this.state.dataSourceDate:void 0})}this.runValidation()}selectItemsByIds(t){if(!t||!this.config.enableMultiple||!this.taxonomyData)return;const i=t.map((t=>this.taxonomyData.find((i=>i.id===t))));if(i.some((t=>!t)))return;const e=i.filter((t=>!!t)).map((t=>this.toSearchResult(t)));switch(this.state.status){case"multiSelect":case"multiSelectShowingHistory":this.updateState({...this.state,selectedItems:e})}this.runValidation()}setSelection(t){const i=[];let e;const s=t.map((t=>{if(null!==t.id){const s=this.taxonomyData.filter((i=>i.id===t.id));if(0===s.length)return void i.push(t.id);const a=t.related?.id;let r;return a?(r=s.find((t=>t.occupation_name_id===a)),r||t.exact||1!==s.length||(r=s[0])):t.exact&&1!==s.length||(r=s[0]),r?this.toSearchResult(r):(i.push(t.id),void(t.exact&&(e??=t)))}return this.createManualInputItem(t.preferred_label)}));if(i.length>0)return e?{ok:!1,invalidIds:i,reference:e}:{ok:!1,invalidIds:i};const a=s,r=a.filter((t=>t.id));if(r.some(((t,i)=>r.findIndex((i=>h(i,t)))!==i)))return{ok:!1,invalidIds:[],duplicate:!0};const o=this.getCommonState();if(this.config.enableMultiple)this.updateState({...this.state,status:"multiSelect",selectedItems:a,inputValue:"",suggestions:[],validation:"idle",...o});else if(1===a.length){const t=a[0];this.updateState({status:"itemSelected",selectedItem:t,inputValue:t.preferred_label,validation:"idle",...o})}else this.updateState({status:"searching",inputValue:"",suggestions:[],validation:"idle",...o});return this.runValidation(),{ok:!0,selection:a.map((t=>this.toPublicSelection(t)))}}editSelection(){const t=this.state.selectedItem;if("itemSelected"!==this.state.status||!t||!this.searchEngine)return;const i=t.displayLabel,{dataSource:e,dataSourceDate:s}=this.state,a=this.searchEngine.searchAsGeneric(i,this.config.maxResults).flatMap((t=>t.metadata?.originalResult?[t.metadata.originalResult]:[]));this.updateState({status:"searching",inputValue:i,suggestions:a,validation:"idle",dataSource:e,dataSourceDate:s})}checkHasValue(){switch(this.state.status){case"itemSelected":return!0;case"multiSelect":case"multiSelectShowingHistory":return this.state.selectedItems.length>0;case"searching":case"showingHistory":return!this.config.requireSelection&&""!==("inputValue"in this.state?this.state.inputValue:"").trim();case"loading":case"error":return!1;default:return this.state}}getCommonState(){return{dataSource:"dataSource"in this.state?this.state.dataSource:void 0,dataSourceDate:"dataSourceDate"in this.state?this.state.dataSourceDate:void 0}}resetMultiSelection(){const t=this.getCommonState();this.updateState({...this.state,status:"multiSelect",selectedItems:[],inputValue:"",suggestions:[],validation:"idle",...t}),this.callbacks.onEmitSelection([])}updateState(t){this.state=t,this.callbacks.onStateChange(t)}toSearchResult(t){return{...t,rawLabel:t.preferred_label,displayLabel:t.occupation_name_preferred_label?`${t.preferred_label} (${t.occupation_name_preferred_label})`:t.preferred_label,highlightedLabel:t.preferred_label,score:3,occupationLabel:t.occupation_name_preferred_label,occupationId:t.occupation_name_id,ssyk_level_4_id:t.ssyk_level_4_id,ssyk_code_2012:t.ssyk_code_2012}}toPublicSelection(t){return g.toPublicSelection(t,(t=>this.taxonomyData.find((i=>i.id===t&&"occupation-name"===i.type))?.preferred_label?.trim()))}createManualInputItem(t){return{id:"",type:"ManualInput",preferred_label:t,rawLabel:t,displayLabel:t,highlightedLabel:t,score:1}}findExactMatch(t){const i=t.trim().toLowerCase(),e=this.taxonomyData.find((t=>!!t.occupation_name_preferred_label&&`${t.preferred_label} (${t.occupation_name_preferred_label})`.toLowerCase()===i));if(e)return e;const s=this.taxonomyData.filter((t=>t.preferred_label.toLowerCase()===i));return 1===s.length?s[0]:void 0}handleFreeTextSelection(t){if(!t)return;this.isTouched=!0;const i=this.findExactMatch(t);this.selectItem(i?this.toSearchResult(i):this.createManualInputItem(t))}hasMoreResults(t){return!!this.cappedResults&&t===this.cappedResults}loadMore(){this.config.maxResults+=10;const t="inputValue"in this.state?this.state.inputValue:"";t&&this.performSearch(t)}resetSearch(){switch(this.state.status){case"searching":case"multiSelect":this.updateState({...this.state,inputValue:"",suggestions:[]}),this.showHistory(!0);break;case"showingHistory":case"multiSelectShowingHistory":this.updateState({...this.state,inputValue:""});break;case"itemSelected":this.clearSelection()}}}r.setLevel(r.levels.SILENT);const j=/^[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{4}_[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{3}_[123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ]{3}$/;function M(t,i){return JSON.stringify([t,i??null])}const T=class{get hostElement(){return t(this)}internals;name="yrkesvaljaren";taxonomyUrl;placeholder=p;label="Välj yrke";disabled=!1;enableMultiple=!1;showSearchIcon=!0;errorMessage;labelDescription;required=!1;manualInput=!1;feedback=!1;afOnSubmitJobSuggestion;suggestionState=null;history=!0;popular=!0;maxHistoryItems=10;enableSelectionAnimation=!1;afFocused=!1;populateInputOnSelect=!1;maxVisibleRows;minLength=v;maxResults=20;shouldFocusSuggestionInput=!1;shouldFocusConfirmation=!1;timers=new Set;schedule(t,i){const e=setTimeout((()=>{this.timers.delete(e),t()}),i);this.timers.add(e)}get requireSelection(){return!(this.manualInput||this.feedback)}size="medium";constructor(t){i(this,t),this.afOnSubmitJobSuggestion=e(this,"afOnSubmitJobSuggestion"),this.afJobSelectedEmitter=e(this,"afJobSelected"),this.dataLoadFailedEmitter=e(this,"afJobDataLoadFailed"),this.validationChangeEmitter=e(this,"afJobValidationChange"),t.$hostElement$["s-ei"]?this.internals=t.$hostElement$["s-ei"]:(this.internals=t.$hostElement$.attachInternals(),t.$hostElement$["s-ei"]=this.internals),r.debug("[JobSelector] Constructor - enableMultiple:",this.enableMultiple)}state={status:"loading"};activeErrorType=null;animatingItemId=null;animationTimer;cloneSelection(t){return t.map((t=>null===t.id?{...t}:{...t,related:t.related?{...t.related}:void 0}))}rebuildValidJobIds(){const t=this.controller?.getTaxonomyData?.()??this.taxonomyData??[];this.validJobIds=new Set(t.map((t=>t.id)).filter(Boolean))}validateSelectionCandidate(t){const i="string"==typeof t?[t]:Array.isArray(t)?t:null;if(!i)return{ok:!1,reason:"invalid-input"};const e=i.some((t=>"string"==typeof t)),s=i.some((t=>"object"==typeof t&&null!==t));if(e&&s||i.some((t=>"string"!=typeof t&&("object"!=typeof t||null===t))))return{ok:!1,reason:"invalid-input"};const a=[],r=[],o=[],n=[];for(const t of i){if("string"==typeof t){const i=t.trim();if(!i)return{ok:!1,reason:"invalid-input"};if(j.test(i))r.push(i),o.push(M(i)),a.push({id:i});else{if(!this.manualInput)return{ok:!1,reason:"manual-input-disabled"};n.push(i),a.push({type:"manual-input",id:null,preferred_label:i})}continue}if(!t||"object"!=typeof t)return{ok:!1,reason:"invalid-input"};const i=t;if("string"==typeof i.id){const t=i.id.trim(),e=void 0===i.type&&void 0===i.preferred_label;if(!t||!e&&("job-title"!==i.type&&"occupation-name"!==i.type||"string"!=typeof i.preferred_label||!i.preferred_label.trim()))return{ok:!1,reason:"invalid-input"};let s;if(void 0!==i.related){const t=i.related;if(!(t&&"object"==typeof t&&"string"==typeof t.id&&t.id.trim()&&(e||"occupation-name"===t.type&&"string"==typeof t.preferred_label&&t.preferred_label.trim())))return{ok:!1,reason:"invalid-input"};s=t.id.trim()}r.push(t),o.push(M(t,s)),a.push({id:t,related:s?{id:s}:void 0,exact:e})}else{if(null!==i.id||"manual-input"!==i.type)return{ok:!1,reason:"invalid-input"};{if("string"!=typeof i.preferred_label||!i.preferred_label.trim())return{ok:!1,reason:"invalid-input"};if(!this.manualInput)return{ok:!1,reason:"manual-input-disabled"};const t=i.preferred_label.trim();n.push(t),a.push({type:"manual-input",id:null,preferred_label:t})}}}if(!this.enableMultiple&&a.length>1)return{ok:!1,reason:"multiple-disabled"};if(new Set(o).size!==o.length)return{ok:!1,reason:"duplicate-taxonomy-id"};if(new Set(n).size!==n.length)return{ok:!1,reason:"duplicate-manual-label"};const l=r.filter((t=>!this.validJobIds.has(t)));return l.length>0?{ok:!1,reason:"unknown-id",invalidIds:l}:{ok:!0,selection:a}}describeSelectionRejection(t){switch(t.reason){case"invalid-input":return"setSelection accepterar en sträng, en array med strängar eller en array med valobjekt eller referenser som { id, related: { id } }.";case"invalid-reference":{const{id:i,related:e}=t.reference;return e?`Yrkesbenämningen ${e.id} hör inte till valet ${i} i den laddade yrkesdatan.`:`Jobbtiteln ${i} hör till flera yrkesbenämningar. Ange yrkesbenämningens id i related.id.`}case"data-unavailable":return"setSelection kan inte användas eftersom yrkesdata inte kunde laddas.";case"duplicate-taxonomy-id":return"selection får inte innehålla samma yrke två gånger (samma taxonomi-id och related.id).";case"duplicate-manual-label":return"selection får inte innehålla dubbla manuella labels.";case"multiple-disabled":return'flera värden kräver af-enable-multiple="true".';case"manual-input-disabled":return'manual-val kräver af-manual-input="true".';case"unknown-id":return`okända Concept ID:n: ${t.invalidIds?.join(", ")}`}}errorCodeForRejection(t){switch(t){case"unknown-id":return"unknown-id";case"manual-input-disabled":return"manual-input-disabled";case"multiple-disabled":return"multiple-disabled";default:return"invalid-input"}}rejectSelection(t,i){const e=this.describeSelectionRejection(i);return console.error(`[Yrkesväljaren] Ogiltig selection: ${e} Värdet accepterades inte; senaste giltiga val behålls.`,{selection:t,previousSelection:this.lastAcceptedSelection}),this.activeErrorType="invalidInput",this.validationChangeEmitter.emit({isValid:!1,errorType:"invalidInput"}),this.updateValidity(!1),new f(e,this.errorCodeForRejection(i.reason),i.invalidIds)}syncAcceptedSelection(t,i){const e=this.cloneSelection(t);if(this.exactSelectionKeys=new Set(e.flatMap(((t,e)=>{if(null===t.id)return[];const s=M(t.id,t.related?.id),a=i?.[e];return(a?null!==a.id&&a.exact:this.exactSelectionKeys.has(s))?[s]:[]}))),this.lastAcceptedSelection=e,"invalidInput"===this.activeErrorType){const t=e.length>0||!this.required,i=t?null:"required";this.activeErrorType=i,this.validationChangeEmitter.emit({isValid:t,errorType:i}),this.updateValidity(t)}}applySelection(t){if(!this.controller)throw this.rejectSelection(t,{ok:!1,reason:"data-unavailable"});const i=this.validateSelectionCandidate(t);if(!i.ok)throw this.rejectSelection(t,i);const e=this.controller.setSelection(i.selection);if(!e.ok)throw this.rejectSelectionResolution(t,e);return this.syncAcceptedSelection(e.selection,i.selection),this.cloneSelection(e.selection)}rejectSelectionResolution(t,i){return this.rejectSelection(t,i.duplicate?{ok:!1,reason:"duplicate-taxonomy-id"}:i.reference?{ok:!1,reason:"invalid-reference",reference:i.reference}:{ok:!1,reason:"unknown-id",invalidIds:i.invalidIds})}watchRequired(t){this.controller.updateConfig({required:t})}watchManualInputOrFeedback(){this.feedback||(this.suggestionState=null),this.controller.updateConfig({requireSelection:this.requireSelection,manualInput:this.manualInput})}watchHistory(t){this.controller.updateConfig({history:t})}watchPopular(t){this.controller.updateConfig({popular:t})}watchEnableMultiple(t){this.controller.updateConfig({enableMultiple:t})}watchDisabled(t){t&&(this.afFocused=!1)}watchTaxonomyData(t){this.controller&&t&&t.length>0&&this.controller.initialize(t).then((()=>{this.rebuildValidJobIds(),this.restoreAcceptedSelectionAfterDataUpdate()}))}taxonomyData=[];afJobSelectedEmitter;syncFormValue(){if(this.state)if(this.enableMultiple){const t="multiSelect"===this.state.status||"multiSelectShowingHistory"===this.state.status?this.state.selectedItems:[],i=new FormData;t.forEach((t=>{i.append(this.name,t.id||t.rawLabel)})),this.internals.setFormValue(i)}else{const t="itemSelected"===this.state.status?this.state.selectedItem:null;this.internals.setFormValue(t?t.id||t.rawLabel:null)}}handleFormValidationSync(t){this.updateValidity(t.detail.isValid)}dataLoadFailedEmitter;validationChangeEmitter;static nextId=0;componentId="job-selector-"+T.nextId++;observer;controller;validJobIds=new Set;lastAcceptedSelection=[];exactSelectionKeys=new Set;restoreAcceptedSelectionAfterDataUpdate(){if(0===this.lastAcceptedSelection.length)return;const t=this.lastAcceptedSelection.map((t=>null===t.id?t:{id:t.id,related:t.related,exact:this.exactSelectionKeys.has(M(t.id,t.related?.id))})),i=this.controller.setSelection(t);i.ok?this.syncAcceptedSelection(i.selection,t):this.rejectSelectionResolution(this.lastAcceptedSelection,i)}async componentWillLoad(){r.setLevel(r.levels.WARN);const t=o();if(!(this.taxonomyData&&this.taxonomyData.length>0||t&&t.length>0)){this.state={status:"loading"};try{const t=await async function({taxonomyUrl:t,fetcher:i=t=>fetch(t)}){const e=t??"https://d3hng02m5bee8m.cloudfront.net/yrkesvaljaren/latest.json";r.debug(`[JobSelector] Hämtar yrkesdata från: ${e}`);const s=await i(e);if(!s.ok)throw new Error(`Kunde inte ladda yrkesdata från ${e}: ${s.status} ${s.statusText}`);const a=await s.json();if(!m(a))throw new Error("Yrkesdatan har ett ogiltigt format.");return a}({taxonomyUrl:this.taxonomyUrl});b(t),r.debug("[JobSelector] Data-laddning lyckades.")}catch(t){return r.error("[JobSelector] Fel vid data-laddning:",t),this.state={status:"error",message:"Kunde inte ladda yrkesdata."},void this.dataLoadFailedEmitter.emit({error:t instanceof Error?t:new Error(String(t))})}}this.controller=new D({onStateChange:t=>{this.state={...t},this.syncFormValue()},onEmitSelection:t=>{const i=t?Array.isArray(t)?t:[t]:[];this.syncAcceptedSelection(i),this.afJobSelectedEmitter.emit(i)},onEmitValidation:t=>{this.activeErrorType=t.errorType,this.validationChangeEmitter.emit(t)},onEmitDataLoadFailed:t=>{this.dataLoadFailedEmitter.emit({error:t})},onEmitStatusChange:()=>{}},{enableMultiple:this.enableMultiple,required:this.required,requireSelection:this.requireSelection,manualInput:this.manualInput,history:this.history,popular:this.popular,maxHistoryItems:this.maxHistoryItems,minLength:this.minLength,maxResults:this.maxResults}),await this.controller.initialize(this.taxonomyData),this.taxonomyData=this.controller.getTaxonomyData(),this.rebuildValidJobIds(),"invalidInput"===this.activeErrorType?this.updateValidity(!1):this.required&&0===this.lastAcceptedSelection.length?this.internals.setValidity({customError:!0},this.errorMessage||"Välj ett yrke från listan."):this.internals.setValidity({})}componentDidLoad(){this.handleHashFocus()}componentDidRender(){if(this.shouldFocusSuggestionInput&&"form"===this.suggestionState?.status){this.shouldFocusSuggestionInput=!1;const t=this.hostElement.shadowRoot?.querySelector(`#${this.componentId}-suggestion-motivation-input`);t&&this.schedule((()=>t.focus()),50)}this.shouldFocusConfirmation&&"submitted"===this.suggestionState?.status&&(this.shouldFocusConfirmation=!1,this.hostElement.shadowRoot?.querySelector(".yv-suggestion-close-btn")?.focus())}disconnectedCallback(){this.observer&&this.observer.disconnect(),this.controller&&this.controller.destroy(),clearTimeout(this.animationTimer),this.animationTimer=void 0,this.timers.forEach((t=>clearTimeout(t))),this.timers.clear()}handleHashFocus(){const t=window.location.hash;if(!t)return;const i=t.substring(1),e=this.hostElement.getAttribute("id");e&&i===e&&(this.setFocus(),this.hostElement.scrollIntoView({behavior:"smooth",block:"center"}),history.replaceState(null,"",window.location.pathname+window.location.search))}trackedSelectedJobs(){return this.lastAcceptedSelection.flatMap((t=>"manual-input"!==t.type?[t]:L(t.preferred_label)?[]:[{...t,preferred_label:_(t.preferred_label)}]))}emitJobSuggestion(t,i){const e={selectedJobs:this.trackedSelectedJobs(),suggestionJob:_(t),suggestionMotivation:V(i)};this.afOnSubmitJobSuggestion.emit(e)}closeSuggestion(){this.suggestionState=null,this.shouldFocusSuggestionInput=!1,this.setFocus()}submitSuggestion(){if(!this.suggestionState||!this.feedback)return;const{term:t,motivation:i}=this.suggestionState;if(L(i||""))return this.suggestionState={...this.suggestionState,piiError:!0},void(this.shouldFocusSuggestionInput=!0);this.emitJobSuggestion(t,i),this.shouldFocusSuggestionInput=!1,this.shouldFocusConfirmation=!0,this.suggestionState={status:"submitted",term:(t||"").trim(),motivation:""}}handleInput(t){this.afFocused=!0,"pii-blocked"===this.suggestionState?.status&&(this.suggestionState=null),this.controller.handleInput(t.detail)}handleCsSelect(t){this.afFocused=!0;const i=t.detail;this.enableSelectionAnimation&&(this.animatingItemId=i.id,clearTimeout(this.animationTimer),this.animationTimer=setTimeout((()=>{this.animatingItemId=null,this.animationTimer=void 0}),600));const e=i.metadata?.original;if(e&&"displayLabel"in e)"pii-blocked"===this.suggestionState?.status&&(this.suggestionState=null),this.controller.selectItem(e);else{if("ManualInput"===i.metadata?.type){const t=i.label;return this.feedback&&L(t)?void(this.suggestionState={status:"pii-blocked",term:"",motivation:""}):(this.manualInput&&this.controller.handleFreeTextSelection(t),this.feedback?(this.afFocused=!1,this.shouldFocusSuggestionInput=!0,this.suggestionState={status:"form",term:t,motivation:""},void(this.manualInput||this.controller.resetSearch())):void 0)}this.controller.selectItem({id:i.id,type:"unknown",preferred_label:i.label,rawLabel:i.label,displayLabel:i.label,highlightedLabel:i.highlightedLabel||i.label,score:1})}}handleCsClear(){"pii-blocked"===this.suggestionState?.status&&(this.suggestionState=null),this.controller.resetSearch()}handleCsClearHistory(){this.controller.clearHistory()}handleCsRequestHistory(){this.controller.showHistory()}handleCsLoadMore(){this.controller.loadMore()}handleCsRemoveItem(t){const i=t.detail,e=i.metadata?.original;e&&"displayLabel"in e&&this.controller.removeItem(e)}handleCsFocus(){this.afFocused=!0,this.controller.handleFocus()}handleCsBlur(){this.afFocused=!1,this.controller.handleBlur(),this.validate()}handleCsEditSelection(){this.afFocused=!0,this.controller.editSelection()}async updateData(){r.debug("[JobSelector] updateData called"),await this.controller.initialize(),this.taxonomyData=this.controller.getTaxonomyData(),this.rebuildValidJobIds(),this.restoreAcceptedSelectionAfterDataUpdate()}async setSelection(t){return this.applySelection(t)}async setFocus(){const t=this.hostElement.shadowRoot?.querySelector("core-selector");t&&"function"==typeof t.setFocus&&await t.setFocus()}async validate(t=!1){const i=await this.controller.runValidation(t);return this.updateValidity(i),i}async checkValidity(){return this.internals.checkValidity()}async reportValidity(){return this.internals.reportValidity()}async getValidity(){return this.internals.validity}async getValidationMessage(){return this.internals.validationMessage}updateValidity(t){t?this.internals.setValidity({}):this.internals.setValidity({customError:!0},"invalidInput"===this.activeErrorType?this.errorMessage||"Komponenten har fått ett ogiltigt värde.":this.errorMessage||"Välj ett yrke från listan.")}_mapSearchResultToGenericItem(t){const i=this.enableMultiple?("multiSelect"===this.state.status||"multiSelectShowingHistory"===this.state.status)&&this.state.selectedItems.some((i=>h(i,t))):"itemSelected"===this.state.status&&!!this.state.selectedItem&&h(this.state.selectedItem,t);return{id:t.id,label:t.displayLabel,isSelected:this.animatingItemId===t.id||i,highlightedLabel:t.highlightedLabel,displaySegments:t.displaySegments,group:"occupation-name"===t.type?"Yrkesgrupper":"Yrkesbenämningar",metadata:{original:t}}}_mapStateToSelectorState(t){let i,e,s,a,r,o="loading",n="",l=[],c=[],d="idle",u=this.errorMessage||"";switch("validation"in t&&t.validation&&(d=t.validation,"error"===t.validation?"required"===this.activeErrorType||"invalidInput"===this.activeErrorType?u=this.errorMessage||"Välj ett yrke från listan.":this.errorMessage&&(u=this.errorMessage):"success"===t.validation&&(u="Tack!")),"message"in t&&t.message&&(u=t.message),"validationContext"in t&&(s=t.validationContext),t.status){case"loading":o="loading";break;case"error":o="error";break;case"searching":o="searching",n=t.inputValue,l=t.suggestions.map((t=>this._mapSearchResultToGenericItem(t))),i=this.controller?.hasMoreResults(t.suggestions);break;case"showingHistory":o="searching",n=t.inputValue||"",l=t.historyItems.map((t=>this._mapSearchResultToGenericItem(t)));break;case"itemSelected":o="itemSelected",e=this._mapSearchResultToGenericItem(t.selectedItem),e.highlightedLabel=y(e.label),n=t.inputValue||"";break;case"multiSelect":o="multiSelect",n=t.inputValue,l=t.suggestions.map((t=>this._mapSearchResultToGenericItem(t))),c=t.selectedItems.map((t=>this._mapSearchResultToGenericItem(t))),i=this.controller?.hasMoreResults(t.suggestions);break;case"multiSelectShowingHistory":o="multiSelect",n=t.inputValue||"",l=t.historyItems.map((t=>this._mapSearchResultToGenericItem(t))),c=t.selectedItems.map((t=>this._mapSearchResultToGenericItem(t)))}const g="showingHistory"===t.status||"multiSelectShowingHistory"===t.status;return"multiSelect"===o||"itemSelected"===o||"searching"===o?(c.length>0&&(l=l.filter((t=>!c.some((i=>{const e=i.metadata?.original,s=t.metadata?.original;return e&&s&&"rawLabel"in e&&"rawLabel"in s?h(e,s):i.id&&t.id?i.id===t.id:i.label===t.label}))))),g&&l.length>0?t.isPopularView?(a="Populära sökningar",r=!1):(r=!0,a=void 0):(a=void 0,r=!1)):(a=void 0,r=!1),"pii-blocked"===this.suggestionState?.status&&(d="error",u="Texten verkar innehålla personuppgifter, till exempel personnummer, e-post eller telefonnummer. Skriv bara yrket du vill föreslå."),{status:o,inputValue:n,suggestions:l,selectedItem:e,selectedItems:c,validation:d,validationContext:s,message:u,listHeader:a,showHistoryHeader:r,isHistoryView:g,manualInputBlocked:"pii-blocked"===this.suggestionState?.status,hasMoreResults:i}}render(){const t=this._mapStateToSelectorState(this.state),i={disabled:this.disabled,placeholder:this.placeholder,minLength:this.minLength,maxResults:this.maxResults,enableMultiple:this.enableMultiple,showSearchIcon:this.showSearchIcon,requireSelection:this.requireSelection,size:this.size,enableSelectionAnimation:this.enableSelectionAnimation,populateInputOnSelect:this.populateInputOnSelect,maxVisibleRows:this.maxVisibleRows,manualInputBehavior:"select",showHistoryHeader:this.history&&!t.listHeader,listHeader:t.listHeader,enableInfiniteScroll:!0,isFeedback:this.feedback,manualInputMode:this.manualInput&&this.feedback?"combined":this.feedback?"feedback":"manual",feedbackTargetName:"yrke"};return s("div",{key:"d2042c1c0e5e76d8dfeedd2691de20d6fcf49c27",class:"job-selector-wrapper"},"error"===this.state.status?s("div",{class:"error-message"},s(k,{variant:"error",role:"alert"},this.state.message||"Ett fel uppstod.")):s(a,null,s("core-selector",{id:this.componentId,componentId:this.componentId,state:t,config:i,label:this.label,labelDescription:this.labelDescription,size:this.size,afFocused:this.afFocused}),this.suggestionState&&"pii-blocked"!==this.suggestionState.status&&s("div",{key:"yv-suggestion-box",class:"yv-suggestion-box",role:"region","aria-label":"Föreslå saknat yrke"},"form"===this.suggestionState.status?s("div",{class:"yv-suggestion-form"},s("div",{class:"yv-suggestion-title",id:`${this.componentId}-suggestion-title`},'Motivera varför "',s("strong",null,this.suggestionState.term),'" bör läggas till som yrke (frivilligt):'),s("div",{class:"yv-motivation-container"},s("div",{class:"yv-motivation-field-wrapper"},s("textarea",{id:`${this.componentId}-suggestion-motivation-input`,"aria-labelledby":`${this.componentId}-suggestion-title`,"aria-describedby":this.suggestionState.piiError?`${this.componentId}-motivation-pii-error ${this.componentId}-motivation-counter`:`${this.componentId}-motivation-counter`,"aria-invalid":this.suggestionState.piiError?"true":"false",class:"yv-motivation-input",value:this.suggestionState.motivation,maxLength:160,rows:2,ref:t=>{t&&(t.style.height="auto",t.style.height=`${Math.max(t.scrollHeight,44)}px`)},onInput:t=>{const i=t.target;i.style.height="auto",i.style.height=`${Math.max(i.scrollHeight,44)}px`,this.suggestionState&&(this.suggestionState={...this.suggestionState,motivation:i.value,piiError:!1})}}),s("div",{id:`${this.componentId}-motivation-counter`,class:"yv-motivation-counter"},(this.suggestionState.motivation||"").length,"/160")),this.suggestionState.piiError&&s("div",{id:`${this.componentId}-motivation-pii-error`,class:"yv-suggestion-pii-error",role:"alert"},"Motiveringen verkar innehålla personuppgifter, till exempel personnummer, e-post eller telefonnummer. Ta bort dem för att kunna skicka."),s("div",{class:"yv-suggestion-actions"},s("button",{type:"button",class:"yv-suggestion-submit-btn","aria-label":`Skicka förslag för "${this.suggestionState.term}" till Arbetsförmedlingen`,onClick:()=>this.submitSuggestion()},"Skicka"),s("button",{type:"button",class:"yv-suggestion-cancel-btn","aria-label":"Avbryt förslag",onClick:()=>this.closeSuggestion()},"Avbryt")))):"submitted"===this.suggestionState.status?s("div",{class:"yv-suggestion-success"},s("span",null,'Förslaget "',s("strong",null,this.suggestionState.term),'" har skickats in till Arbetsförmedlingen.'),s("button",{type:"button",class:"yv-suggestion-close-btn","aria-label":"Stäng bekräftelse",onClick:()=>this.closeSuggestion()},"Stäng")):null),s("div",{key:"yv-suggestion-live-region",class:"yv-sr-only",role:"status","aria-live":"polite"},"submitted"===this.suggestionState?.status?`Förslaget "${this.suggestionState.term}" har skickats in till Arbetsförmedlingen.`:"")))}static get delegatesFocus(){return!0}static get formAssociated(){return!0}static get watchers(){return{required:[{watchRequired:0}],manualInput:[{watchManualInputOrFeedback:0}],feedback:[{watchManualInputOrFeedback:0}],history:[{watchHistory:0}],popular:[{watchPopular:0}],enableMultiple:[{watchEnableMultiple:0}],disabled:[{watchDisabled:0}],taxonomyData:[{watchTaxonomyData:0}]}}};T.style=":host{--digi--grayscale-0:#ffffff;--digi--grayscale-50:#fbfbfb;--digi--grayscale-100:#f4f4f4;--digi--grayscale-200:#ededed;--digi--grayscale-300:#e4e4e4;--digi--grayscale-400:#dddddd;--digi--grayscale-500:#cacaca;--digi--grayscale-600:#acacac;--digi--grayscale-700:#757575;--digi--grayscale-800:#5c5c5c;--digi--grayscale-900:#333333;--digi--grayscale-1000:#000000;--digi--global--color--cta--link--base:#1616b2;--digi--global--color--function--danger--base:#da0000;--digi--global--color--function--success--base:#008a20;--digi--global--color--function--success--lightest-3:#d4edda;--digi--global--color--function--warning--base:#ffe200;--af-text-color:var(--digi--color--text--primary, var(--digi--grayscale-900));--digi--global--typography--font-family--default:\"Open Sans\", Arial, sans-serif;--digi--global--typography--font-size--base:1rem;--digi--global--typography--font-size--small:0.875rem;--digi--global--typography--font-weight--regular:400;--digi--global--typography--font-weight--semibold:600;--digi--global--typography--font-weight--bold:700;--digi--global--typography--line-height--base:1.5;--digi--typography--label--font-size--desktop:1rem;--digi--typography--label--font-weight--desktop:600;--digi--typography--label--line-height--desktop:1.5;--digi--typography--label-description--font-size--desktop:1rem;--digi--typography--label-description--line-height--desktop:1.5;--digi--typography--tag--font-size--desktop:0.875rem;--digi--gutter--icon:0.625rem;--digi--gutter--smaller:0.75rem;--digi--gutter--small:0.875rem;--digi--gutter--medium:1rem;--digi--border-width--primary:1px;--digi--border-style--primary:solid;--digi--border-radius--primary:0;--digi--border-radius--secondary:6px;--af-tag-color:var(--digi--color--text--interactive--brand-primary, #091d54);--af-tag-background:var(--digi--color--background--interactive--default--secondary, var(--digi--grayscale-0));--af-tag-hover-background:var(--digi--color--background--interactive--hover--secondary, #ddf1fc)}.af-form-label{color:var(--af-text-color);display:flex;flex-direction:column;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--label--font-size--desktop);margin-bottom:0.5rem}.af-form-label__label{cursor:pointer;display:block;font-weight:var(--digi--typography--label--font-weight--desktop);line-height:var(--digi--typography--label--line-height--desktop)}.af-form-label__description{display:block;font-size:var(--digi--typography--label-description--font-size--desktop);line-height:var(--digi--typography--label-description--line-height--desktop);max-width:35rem}.af-validation-message{align-items:center;display:flex;flex-wrap:wrap}.af-validation-message__icon{flex:0 0 auto;height:1.25em;margin-inline-end:var(--digi--gutter--icon);width:1.25em}.af-validation-message__icon--success,.af-validation-message__icon--error{background-color:var(--af-validation-icon-color, currentColor);-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-size:contain;mask-size:contain}.af-validation-message__icon--success{--af-validation-icon-color:var(--digi--color--icon--validation--success, var(--digi--global--color--function--success--base));-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath d='M25 12.5C25 19.404 19.404 25 12.5 25S0 19.404 0 12.5 5.596 0 12.5 0 25 5.596 25 12.5zm-13.946 6.619l9.274-9.275a.806.806 0 000-1.14l-1.14-1.14a.806.806 0 00-1.14 0l-7.564 7.563-3.531-3.531a.807.807 0 00-1.14 0l-1.141 1.14a.806.806 0 000 1.14l5.242 5.243a.806.806 0 001.14 0z'/%3E%3C/svg%3E\")}.af-validation-message__icon--error{--af-validation-icon-color:var(--digi--color--icon--validation--error, var(--digi--global--color--function--danger--base));-webkit-mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E\");mask-image:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath d='M34.4328058,0 C35.5494848,0 36.5900526,0.609146757 37.1483921,1.58958113 L47.5812454,19.9104189 C48.1395849,20.8909496 48.1395849,22.1090504 47.5812454,23.0895811 L37.1483921,41.4104189 C36.5900526,42.3908532 35.5494848,43 34.4328058,43 L13.5671942,43 C12.4505152,43 11.4099474,42.3908532 10.8516079,41.4104189 L0.41875464,23.0895811 C-0.13958488,22.1090504 -0.13958488,20.8909496 0.41875464,19.9104189 L10.8516079,1.58958113 C11.4099474,0.609146757 12.4505152,0 13.5671942,0 Z M18.6736823,12.3728178 C18.2711762,11.964729 17.6203819,11.964729 17.2178757,12.3728178 L15.2825964,14.334939 C14.8800903,14.7430278 14.8800903,15.4028485 15.2825964,15.8109373 L20.6089616,21.2111779 L15.2825964,26.6114185 C14.8800903,27.0195074 14.8800903,27.6793281 15.2825964,28.0874169 L17.2178757,30.049538 C17.6203819,30.4576269 18.2711762,30.4576269 18.6736823,30.049538 L24.0000475,24.6492974 L29.3264127,30.049538 C29.7289188,30.4576269 30.3797132,30.4576269 30.7822193,30.049538 L32.7174986,28.0874169 C33.1200048,27.6793281 33.1200048,27.0195074 32.7174986,26.6114185 L27.3911334,21.2111779 L32.7174986,15.8109373 C33.1200048,15.4028485 33.1200048,14.7430278 32.7174986,14.334939 L30.7822193,12.3728178 C30.3797132,11.964729 29.7289188,11.964729 29.3264127,12.3728178 L24.0000475,17.7730584 Z'/%3E%3C/svg%3E\")}.af-validation-message__icon--warning{background:center / contain no-repeat url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='6.75' fill='%23333'/%3E%3Cpath d='m18 9c0 4.9717-4.0298 9-9 9-4.9702 0-9-4.0283-9-9 0-4.9688 4.0298-9 9-9 4.9702 0 9 4.0312 9 9zm-9 1.8145c-0.92196 0-1.6694 0.7474-1.6694 1.6694 0 0.92196 0.7474 1.6694 1.6694 1.6694s1.6694-0.7474 1.6694-1.6694c0-0.92196-0.7474-1.6694-1.6694-1.6694zm-1.3157-1.065c0.012593 0.23095 0.20355 0.41175 0.43483 0.41175h1.7618c0.23128 0 0.42224-0.1808 0.43483-0.41175l0.2692-4.9355c0.013609-0.24946-0.18501-0.45922-0.43483-0.45922h-2.3002c-0.24982 0-0.4484 0.20976-0.43479 0.45922l0.2692 4.9355z' fill='%23FFE200'/%3E%3C/svg%3E\");position:relative;top:3px}.af-validation-message__text{color:var(--af-text-color);flex:1;font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--tag--font-size--desktop);transform:translateY(1px)}.af-validation-message__placeholder{visibility:hidden}.af-tag{display:block;max-width:100%;min-width:0}.af-tag__button{align-items:center;background:var(--af-tag-background);border:var(--digi--border-width--primary) var(--digi--border-style--primary) var(--af-tag-color);border-radius:var(--digi--border-radius--secondary);color:var(--af-tag-color);cursor:pointer;display:inline-flex;font-family:var(--digi--global--typography--font-family--default);font-size:0.875rem;font-weight:var(--digi--global--typography--font-weight--semibold);gap:10px;height:auto;max-width:100%;min-height:unset;min-width:0;padding:6px 8px;text-align:left;white-space:normal}.af-tag__button:hover{background:var(--af-tag-hover-background)}.af-tag__button:focus-visible{background:var(--af-tag-hover-background);border-color:var(--af-tag-color);outline:2px solid var(--digi--color--text--primary, var(--digi--grayscale-1000));outline-offset:2px;box-shadow:0 0 0 5px var(--digi--color--background--primary, var(--digi--grayscale-0))}.af-tag__button:active{background:var(--af-tag-hover-background)}.af-tag__text{display:inline-block;max-width:100%;min-width:0;white-space:normal}.af-tag__text--break{overflow-wrap:anywhere;word-break:break-word}.af-icon{display:flex !important;min-height:1.4em !important;align-items:center !important}.af-icon--default-size{width:12px !important;height:12px !important}.af-tag__remove-icon{flex:0 0 auto;height:1em;width:1em}.af-icon.af-tag__remove-icon{min-height:0 !important}:host{--yrkesvaljaren-width:var(--af-width, 100%);--yrkesvaljaren-min-width:var(--af-min-width, 200px);--yrkesvaljaren-max-width:var(--af-max-width, none);--yrkesvaljaren-height:var(--af-height, auto);--yrkesvaljaren-min-height:var(--af-min-height, auto);--yrkesvaljaren-max-height:var(--af-max-height, none);--selector-width:var(--yrkesvaljaren-width);--selector-min-width:var(--yrkesvaljaren-min-width);--selector-max-width:var(--yrkesvaljaren-max-width);--selector-height:var(--yrkesvaljaren-height);--selector-min-height:var(--yrkesvaljaren-min-height);--selector-max-height:var(--yrkesvaljaren-max-height);--selector-font-family:var(--global-font-family, 'Open Sans', sans-serif);--selector-font-size:var(--sok-font-size, 1rem);--selector-text-color:var(--sok-text-color, var(--digi--color--text--primary, #212529));--selector-placeholder-color:var(--sok-placeholder-color, var(--digi--color--text--description, #6c757d));--selector-border-color:var(--sok-border-color, var(--digi--color--border--interactive--default--on-input, #d1d5db));--selector-focus-border-color:var(--sok-focus-border-color, #86b7fe);--selector-focus-shadow:var(--sok-focus-shadow, 0 0 0 0.25rem rgba(13, 110, 253, 0.25));--selector-background-color:var(--sok-background-color, var(--digi--color--background--interactive--default--input-elements, #fff));--selector-icon-color:var(--sok-icon-color, var(--digi--color--icon--primary, #6c757d));--selector-clear-button-color:var(--sok-clear-button-color, var(--digi--color--icon--primary, #6c757d));--selector-clear-button-hover-color:var(--sok-clear-button-hover-color, var(--digi--color--icon--primary, #212529));--selector-suggestion-background-color:var(--sok-suggestion-background-color, var(--digi--color--background--dropdown, #fff));--selector-suggestion-border-color:var(--sok-suggestion-border-color, var(--digi--color--divider--primary, #ced4da));--selector-suggestion-hover-background:var(--sok-suggestion-hover-background, var(--digi--color--background--interactive--hover--quarternary, #e9ecef));--selector-suggestion-active-background:var(--sok-suggestion-active-background, var(--digi--color--background--interactive--hover--quarternary, #dde4eb));--selector-suggestion-text-color:var(--sok-suggestion-text-color, var(--digi--color--text--primary, #212529));--selector-suggestion-highlight-weight:var(--sok-suggestion-highlight-weight, bold);--selector-error-color:var(--sok-error-color, var(--digi--color--border--interactive--validation--error, #dc3545));--selector-loading-color:var(--sok-loading-color, var(--digi--color--text--description, #6c757d));display:flex;flex-direction:column;width:var(--yrkesvaljaren-width);min-width:var(--yrkesvaljaren-min-width);max-width:var(--yrkesvaljaren-max-width);height:var(--yrkesvaljaren-height);min-height:var(--yrkesvaljaren-min-height);max-height:var(--yrkesvaljaren-max-height);position:relative}:host([af-size=\"small\"]){--cs-size:small;--selector-container-min-height:32px;--selector-padding-y:2px;--selector-icon-size:1em;--selector-gap:4px}:host([af-size=\"medium\"]){--selector-container-min-height:40px;--selector-padding-y:6px}:host([af-size=\"large\"]){--selector-container-min-height:48px;--selector-padding-y:10px;--selector-icon-size:1.25em;--selector-gap:8px}*{box-sizing:border-box}.yrkesvaljaren-wrapper{display:flex;flex-direction:column;flex:1;min-height:inherit}core-selector{margin-top:0.5rem}.status-message{margin-top:0.5rem;font-size:0.9em;font-style:italic;color:var(--sok-loading-color, var(--digi--color--text--description, #6c757d))}.history-header{font-size:0.875rem;color:var(--digi--color--text--description, var(--digi--grayscale-700, #757575));border-bottom:1px solid var(--selector-suggestion-border-color, #ced4da);margin-bottom:0px}.history-header a{color:inherit;text-decoration:underline}.history-header a:hover{color:var(--digi--color--text--interactive--primary, var(--digi--global--color--cta--link--base, #1616B2))}.yv-suggestion-box{margin-top:16px;padding:16px 20px;background:var(--digi--color--background--pop-out, var(--digi--grayscale-50, #fbfbfb));border:1px solid var(--digi--color--divider--secondary, var(--digi--grayscale-300, #e4e4e4));border-radius:var(--digi--border-radius--secondary, 6px);font-family:var(--digi--global--typography--font-family--default, \"Open Sans\", Arial, sans-serif);font-size:0.9375rem;line-height:1.4;color:var(--digi--color--text--primary, #333333)}.yv-suggestion-title{font-weight:var(--digi--global--typography--font-weight--semibold, 600);margin-bottom:10px}.yv-motivation-container{display:flex;flex-direction:column;gap:8px}.yv-motivation-field-wrapper{display:flex;flex-direction:column;gap:4px}.yv-motivation-input{width:100%;box-sizing:border-box;min-height:44px;max-height:180px;padding:8px 12px;font:inherit;color:inherit;background:var(--digi--color--background--interactive--default--input-elements, var(--digi--grayscale-0, #ffffff));border:1px solid var(--digi--color--border--interactive--default--on-input, var(--digi--grayscale-400, #dddddd));border-radius:var(--digi--border-radius--secondary, 6px);resize:vertical}.yv-motivation-input:focus-visible{outline:2px solid var(--digi--color--text--primary, var(--digi--grayscale-1000, #000000));outline-offset:1px}.yv-motivation-counter{align-self:flex-end;font-size:0.75rem;color:var(--digi--color--text--description, var(--digi--grayscale-800, #5c5c5c))}.yv-suggestion-actions{display:flex;gap:12px;align-items:center}.yv-suggestion-submit-btn,.yv-suggestion-cancel-btn,.yv-suggestion-close-btn{min-height:38px;padding:8px 16px;font:inherit;font-size:0.875rem;font-weight:var(--digi--global--typography--font-weight--semibold, 600);border:1px solid transparent;border-radius:var(--digi--border-radius--secondary, 6px);cursor:pointer;white-space:nowrap}.yv-suggestion-submit-btn{background:var(--digi--color--background--interactive--default--primary, #000048);color:var(--digi--color--text--interactive--secondary, #ffffff)}.yv-suggestion-submit-btn:hover{background:var(--digi--color--background--interactive--hover--primary, #000028)}.yv-suggestion-cancel-btn{background:transparent;color:var(--digi--color--text--interactive--primary, #1616b2);text-decoration:underline}.yv-suggestion-close-btn{background:var(--digi--color--background--primary, var(--digi--grayscale-0, #ffffff));border-color:var(--digi--color--border--interactive--default--on-input, var(--digi--grayscale-600, #acacac));color:inherit}.yv-suggestion-submit-btn:focus-visible,.yv-suggestion-cancel-btn:focus-visible,.yv-suggestion-close-btn:focus-visible{outline:2px solid var(--digi--color--text--primary, var(--digi--grayscale-1000, #000000));outline-offset:2px}.yv-suggestion-pii-error{color:var(--cs-error-color, var(--digi--color--text--primary, #b10e1e))}.yv-suggestion-success{display:flex;justify-content:space-between;align-items:center;gap:16px;color:var(--digi--color--text--primary, #007a1c);font-weight:var(--digi--global--typography--font-weight--semibold, 600)}.yv-sr-only{position:absolute;top:0;left:0;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap}";export{T as digi_service_job_selector}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,g as a,b as t}from"./p-vJ-tamti.js";export{s as setNonce}from"./p-vJ-tamti.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await a(),t([["p-
|
|
1
|
+
import{p as e,g as a,b as t}from"./p-vJ-tamti.js";export{s as setNonce}from"./p-vJ-tamti.js";(()=>{const a=import.meta.url,t={};return""!==a&&(t.resourcesUrl=new URL(".",a).href),e(t)})().then((async e=>(await a(),t([["p-b81496c8",[[785,"core-selector",{state:[16],config:[16],label:[1],labelDescription:[1,"label-description"],componentId:[1,"component-id"],size:[513,"cs-size"],afFocused:[4,"af-focused"],activeIndex:[32],isFocusedInternal:[32],isNavigatingWithKeyboard:[32],resultAnnouncement:[32],isValidationMessageHidden:[32],isActiveDescendantDeferred:[32],hasTypedSinceFocus:[32],setFocus:[64]},null,{afFocused:[{handleAfFocusedChange:0}],config:[{handleConfigChange:0}],state:[{handleStateChange:0}]}]]],["p-c2eb633a",[[593,"digi-service-job-selector",{name:[513],taxonomyUrl:[513,"af-taxonomy-url"],placeholder:[513,"af-placeholder"],label:[513,"af-label"],disabled:[516],enableMultiple:[516,"af-enable-multiple"],showSearchIcon:[516,"af-show-search-icon"],errorMessage:[513,"af-error-message"],labelDescription:[513,"af-label-description"],required:[516,"af-required"],manualInput:[516,"af-manual-input"],feedback:[516,"af-feedback"],history:[516,"af-history"],popular:[516,"af-popular"],size:[513,"af-size"],taxonomyData:[1040],suggestionState:[32],afFocused:[32],state:[32],activeErrorType:[32],animatingItemId:[32],updateData:[64],setSelection:[64],setFocus:[64],validate:[64],checkValidity:[64],reportValidity:[64],getValidity:[64],getValidationMessage:[64]},[[0,"afJobValidationChange","handleFormValidationSync"],[8,"hashchange","handleHashFocus"],[0,"csInput","handleInput"],[0,"csSelect","handleCsSelect"],[0,"csClear","handleCsClear"],[0,"csClearHistory","handleCsClearHistory"],[0,"csRequestHistory","handleCsRequestHistory"],[0,"csLoadMore","handleCsLoadMore"],[0,"csRemoveItem","handleCsRemoveItem"],[0,"csFocus","handleCsFocus"],[0,"csBlur","handleCsBlur"],[0,"csEditSelection","handleCsEditSelection"]],{required:[{watchRequired:0}],manualInput:[{watchManualInputOrFeedback:0}],feedback:[{watchManualInputOrFeedback:0}],history:[{watchHistory:0}],popular:[{watchPopular:0}],enableMultiple:[{watchEnableMultiple:0}],disabled:[{watchDisabled:0}],taxonomyData:[{watchTaxonomyData:0}]}]]]],e))));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbetsformedlingen/yrkesvaljaren",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"workspaces": [
|
|
5
5
|
"packages/*"
|
|
6
6
|
],
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"postbuild": "node scripts/prune-stencil-collection.mjs dist job-selector-demo geovaljaren neobrutal-search --paths collection/verkstad types/verkstad types/vitest-globals.d.ts && node scripts/vendor-taxonomy-core.mjs dist loader",
|
|
40
40
|
"build:pages": "npm run sync:doc-data-packages && npm run build",
|
|
41
41
|
"build:kv": "npm run build -w @taxonomy/kompetensvaljaren",
|
|
42
|
+
"build:verkstad-prototyp": "vite build --config examples/platsbanken-prototyp/vite.config.js",
|
|
42
43
|
"sync:doc-data-packages": "node scripts/sync-doc-data-packages.mjs",
|
|
43
44
|
"check:doc-data-packages": "node scripts/sync-doc-data-packages.mjs --check",
|
|
44
45
|
"sync:kv-demo-data": "node scripts/sync-kv-demo-data.mjs",
|
|
@@ -98,9 +99,9 @@
|
|
|
98
99
|
"mkdirp": "^3.0.1"
|
|
99
100
|
},
|
|
100
101
|
"devDependencies": {
|
|
101
|
-
"@designsystem-se/af": "
|
|
102
|
+
"@designsystem-se/af": "40.0.0",
|
|
102
103
|
"@eslint/js": "^10.0.1",
|
|
103
|
-
"@playwright/test": "1.
|
|
104
|
+
"@playwright/test": "1.65.0",
|
|
104
105
|
"@stencil/vitest": "^1.14.0",
|
|
105
106
|
"@taxonomy/core": "0.1.0-beta.1",
|
|
106
107
|
"@taxonomy/kompetensvaljaren-data-v31": "1.0.0",
|
|
@@ -124,6 +125,7 @@
|
|
|
124
125
|
"jest-junit": "^17.0.0",
|
|
125
126
|
"ts-jest": "^29.4.1",
|
|
126
127
|
"typescript": "6.0.3",
|
|
128
|
+
"vite": "^8.3.6",
|
|
127
129
|
"vitest": "^4.1.11"
|
|
128
130
|
},
|
|
129
131
|
"overrides": {
|