PageSourceSearch

https://www.roskilde.dk/_nuxt/B67sZZXI.js

js roskilde.dk collected 2026-10-01 11:33:32 UTC 9,289 bytes, 1 lines download raw bytes

1import{A as e,C as t,Ct as a,D as l,E as n,Et as r,Gt as i,J as s,Lt as u,M as o,N as c,Nt as d,St as p,T as v,Tt as m,_ as f,_t as y,ct as x,hn as g,it as h,nt as b,q as E,st as S,tt as _,ut as A,vt as $,w as T}from"./B8XHxhss.js";import{D as k,Et as L,Pt as C,Vt as w,_ as z,at as R,k as H}from"#entry";import{t as q}from"./DXNx4Ry-.js";import{t as I}from"./tKPW4sCS.js";import{n as B,t as O}from"./B-LgYetl.js";import{t as V}from"./Due2nrpw.js";var j=Object.assign({inheritAttrs:!1},{__name:"InputTextAutoCompleteList",props:E({id:{type:String},searchText:{type:String,default:""},endpoint:{type:String,default:"/api/citi/search/autocomplete"},delay:{type:Number,default:500}},{isOpen:{type:Boolean,default:!1},isOpenModifiers:{}}),emits:E(["set-option"],["update:isOpen"]),setup(e,{emit:r}){const o={SEE_ALL_SEARCH_RESULTS:z("SEE_ALL_SEARCH_RESULTS",{capitalize:!0}),SEARCH_SUGGESTIONS:z("SEARCH_SUGGESTIONS",{capitalize:!0})},c=r,d=e,{site:y}=R(),x=L(),g=u(!1),E=u(!1),A=u(""),T=u(""),k=u(null),C=u([]),w=u(-1),q=u(""),V=u(null),j=t(()=>y?.id),U=t(()=>y?.cultureId),D=$(e,"isOpen");a(()=>{D.value=!(""===d.searchText||!g.value||!E.value&&!C.value.length)}),_(()=>{ee(),document.addEventListener("click",P),document.addEventListener("focusout",P)}),b(()=>{document.removeEventListener("click",P),document.removeEventListener("focusout",P),k.value&&G(k.value)});const G=e=>{e.removeEventListener("input",N),e.removeEventListener("keydown",M),e.removeEventListener("keydown",F),e.removeEventListener("keydown",J),e.removeEventListener("focus",K)};function N(){clearTimeout(V.value),V.value=setTimeout(()=>{d.searchText&&async function(e){E.value=!0,A.value=e,await fetch(`${d.endpoint}?siteId=${j.value}&cultureId=${U.value}&text=${e}`).then(e=>e.json()).then(t=>{1===t.suggestions.length&&t.suggestions[0].text===e?C.value=[]:(C.value=t.suggestions||[],g.value=!!t.suggestions.length,C.value.push({text:o.SEE_ALL_SEARCH_RESULTS})),E.value=!1}).catch(()=>{E.value=!1})}(d.searchText)},d.delay)}function M(e){"ArrowDown"===e.key&&g.value&&(w.value<C.value.length-1&&(w.value=w.value+1,w.value===C.value.length-1?(X(),T.value=A.value):(X(),T.value=C.value[w.value].text)),e.preventDefault())}function F(e){"ArrowUp"===e.key&&g.value&&(w.value>0&&(w.value=w.value-1,X(),T.value=C.value[w.value].text),e.preventDefault())}function J(e){"Enter"===e.key&&(""!==T.value?(c("set-option",T.value,e),W(e,T.value,w.value),A.value=T.value,T.value=""):(c("set-option",d.searchText,e),W(e,d.searchText,w.value)),e.preventDefault(),V.value&&clearTimeout(V.value),g.value=!1,w.value=-1)}function K(){C.value.length&&(g.value=!0)}function P(e){const t=document.getElementById(d.id)?.closest?.(".c-input-auto-complete-list");t?.contains(e.target)||k.value?.contains(e.target)?t?.contains(e.target)&&k.value?.focus?.({focusVisible:!1}):(g.value=!1,w.value=-1)}function Q(e){return`${d.id}__result-item-${e}`}function X(){q.value=Q(w.value)}function W(e,t,a){t&&(c("set-option",t,e),w.value=a,C.value=[],X()),g.value=!1}function Y(){k.value&&(q.value?k.value.setAttribute("aria-activedescendant",q.value):k.value.removeAttribute("aria-activedescendant"))}function Z(e){return e===w.value}function ee(){k.value=document.querySelector(`[aria-controls="${d.id}"]`)}function te(e){let t=e.charAt(0).toUpperCase()+e.slice(1);const a=new RegExp(`(${d.searchText})`,"gi");return t.replace(a,"<b>$1</b>")}return p(x,()=>{ee()}),p(k,(e,t)=>{t&&G(t),e&&((e=>{e.addEventListener("input",N),e.addEventListener("keydown",M),e.addEventListener("keydown",F),e.addEventListener("keydown",J),e.addEventListener("focus",K)})(e),Y())}),p(q,()=>{Y()}),(t,a)=>{const r=B,u=O;return D.value?(h(),v(u,s({key:0,id:e.id,class:"c-input-auto-complete-list","aria-label":o.SEARCH_SUGGESTIONS},("useAttrsSome"in t?t.useAttrsSome:i(I))(["class","style","data-n-ids"],t.$attrs),{"list-props":("useAttrsExcept"in t?t.useAttrsExcept:i(H))(["class","style","data-n-ids"],t.$attrs)}),{default:m(()=>[(h(!0),l(f,null,S(i(C),(e,t)=>(h(),v(r,{id:Q(t),key:Q(t),color:"surface","data-value":e.text,"data-active":i(q)===Q(t)?"true":null,"aria-selected":Z(t)?"true":null,onClick:a=>t===i(C).length-1?W(a,i(A),t):W(a,e.text,t),innerHTML:te(e.text)},null,8,["id","data-value","data-active","aria-selected","onClick","innerHTML"]))),128))]),_:1}
1,16,["id","aria-label","list-props"])):n("",!0)}}}),U={class:"relative flex gap-4xs"},D={class:"relative min-w-[calc(2em+var(--theme-spacing-3xs)+(var(--theme-spacing-3xs)+var(--theme-spacing-4xs))*2)] flex flex-grow flex-shrink rounded-inputField text-body-sm-regular text-min-16 bg-canvas hover:bg-canvasHover active:bg-canvasActive focus:bg-canvasActive"},G=["id","role","type","name","required","pattern","aria-controls","aria-haspopup","aria-autocomplete","aria-expanded","aria-invalid","aria-describedby","value"],N=["aria-label"],M=Object.assign({inheritAttrs:!1},{__name:"InputText",props:{id:{type:[String,Number]},type:{type:String,default:"text"},name:{type:String,default:null},label:{type:String,default:null},required:{type:Boolean,default:!1},requiredLabelAppendage:{type:String,default:""},placeholder:{type:String,default:null},helpText:{type:String,default:null},searchButtonText:{type:String,default:null},pattern:{type:String,default:null},autocompleteEndpoint:{type:String,default:null},modelValue:null,showClear:{type:Boolean,default:!1},errors:{type:Array,default:()=>[]}},emits:["submit","update:modelValue"],setup(a,{emit:p}){const f=p,b=a,E=t(()=>b.requiredLabelAppendage||`(${z("REQUIRED")}
1)`),S=u(null),_=u(null),$=y(),L=t(()=>b.id&&"string"==typeof b.id?b.id:"number"==typeof b.id?`input-${b.id}`:`input-${$}`),R=u(!1);function B(e){e.preventDefault(),f("submit",e)}function O(e){"search"===b.type&&_.value?.$el&&!e.repeat&&(e.preventDefault(),_.value.$el.click())}function M(e){f("update:modelValue",""),O(e)}function F(e,t){f("update:modelValue",e),O(t)}return(t,u)=>{const p=q,f=k,y=j,b=V,$=A("responsive-placeholder");return h(),v(b,s({"base-id":i(L),class:"c-input-text"},("useAttrsSome"in t?t.useAttrsSome:i(I))(["class","style","aria-label","data-n-ids"],t.$attrs),{label:a.label,"help-text":a.helpText,required:a.required,"required-label-appendage":i(E),readonly:t.$attrs.readonly,errors:a.errors}),{default:m(()=>[T("div",U,[T("div",D,[r(T("input",s({id:i(L),ref_key:"input",ref:S,role:a.autocompleteEndpoint?"combobox":null,class:"min-w-[calc(2em+var(--theme-spacing-3xs)+(var(--theme-spacing-3xs)+var(--theme-spacing-4xs))*2)] flex-shrink flex-grow pl-[calc(var(--theme-spacing-3xs)+var(--theme-spacing-4xs))] pr-[calc(var(--theme-spacing-3xs)*2+var(--theme-spacing-4xs))] py-2xs rounded-inputField border-1 border-solid bg-canvas text-placeholder",type:a.type,name:a.name,required:a.required&&!t.$attrs.readonly,pattern:a.pattern,"aria-controls":a.autocompleteEndpoint?`${i(L)}__auto-complete-list`:null,"aria-haspopup":a.autocompleteEndpoint?"listbox":null,"aria-autocomplete":a.autocompleteEndpoint?"list":null,"aria-expanded":a.autocompleteEndpoint?String(i(R)):null,"aria-invalid":a.errors?.length?"true":null,"aria-describedby":[a.helpText&&`${i(L)}__help-text`,a.errors?.length&&`${i(L)}__error`].filter(Boolean).join(" ")||null},("useAttrsExcept"in t?t.useAttrsExcept:i(H))(["class","style","aria-label","data-n-ids"],t.$attrs),{value:a.modelValue,class:{"!text-strong":a.modelValue&&a.modelValue.length&&!t.$attrs.readonly,"border-subtle cursor-default":t.$attrs.readonly,"border-extraStrong focus:border-2 focus:border-interactive focus:-m-1 user-invalid:border-danger aria-invalid:border-danger":!t.$attrs.readonly},onInput:u[0]||(u[0]=e=>t.$emit("update:modelValue",e.target.value)),onKeydown:w(O,["enter"])}),null,16,G),[[$,a.placeholder?[a.placeholder,"search"===a.type?("localize"in t?t.localize:i(z))("SEARCH",{capitalize:!0}):""].filter(Boolean):[]]]),c(C,{name:"t-input-text"},{default:m(()=>[a.showClear?(h(),l("button",{key:0,type:"button",class:"absolute right-3xs min-w-24 min-h-24 h-full flex items-center justify-center !text-interactive hover:text-interactiveHover active:text-interactiveActive","aria-label":("localize"in t?t.localize:i(z))("CLEAR_TEXT",{capitalize:!0}),onClick:M},[c(p,{name:"close"})],8,N)):n("",!0)]),_:1})]),"search"===a.type?(h(),v(f,{key:0,ref_key:"button",ref:_,type:"submit",color:"secondary",class:"flex-shrink-0","aria-label":a.searchButtonText||("localize"in t?t.localize:i(z))("SEARCH",{capitalize:!0}),onClick:B},e({_:2},[a.searchButtonText??("localize"in t?t.localize:i(z))("SEARCH",{capitalize:!0})?{name:"default",fn:m(()=>[o(g(a.searchButtonText||("localize"in t?t.localize:i(z))("SEARCH",{capitalize:!0})),1)]),key:"0"}:void 0,t.$slots.searchButtonIcon?{name:"icon",fn:m(()=>[x(t.$slots,"searchButtonIcon")]),key:"1"}:void 0]),1032,["aria-label"])):n("",!0),a.autocompleteEndpoint?(h(),v(y,{key:1,id:`${i(L)}__auto-complete-list`,"is-open":i(R),"onUpdate:isOpen":u[1]||(u[1]=e=>d(R)?R.value=e:null),"search-text":a.modelValue,endpoint:a.autocompleteEndpoint,"aria-labelledby":a.label?`${i(L)}__label ${i(L)}__auto-complete-list`:`${i(L)}__auto-complete-list`,class:"top-full mt-4xs",delay:0,onSetOption:F},null,8,["id","is-open","search-text","endpoint","aria-labelledby"])):n("",!0)])]),_:3},16,["base-id","label","help-text","required","required-label-appendage","readonly","errors"])}}});export{M as t};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.