1import{a as e,i as t,r as n,s as r}from"./loadReactComponent.CRGJNnQn.chunk.js";import{a as i}from"./utils.Dmtx4S2V.chunk.js";import{C as a,l as o}from"./api.generated._yGp5TCT.chunk.js";import{t as s}from"./classnames.Bais1xbC.chunk.js";import{r as c,t as l}from"./Skeleton.TkENfmId.chunk.js";import{t as u}from"./useWindowSize.C3VsfONB.chunk.js";import{n as d,t as f}from"./index.esm.Bkwclt4j.chunk.js";import{t as p}from"./CloseButton.LFrBHyQW.chunk.js";import{n as m}from"./FNSPModal.BPWSE_6f.chunk.js";import{t as h}from"./styles.module.DWfpxF6u.chunk.js";import{t as g}from"./withClientOnly.CVf8Abam.chunk.js";function _(e){let t=window.getComputedStyle(e),n=parseFloat(t.marginTop),r=parseFloat(t.marginBottom);return e.getBoundingClientRect().height+n+r}var v=r(e(),1),y=r(s(),1),b={"spinner-grow":`_spinner-grow_f78d3ab`,"spinner-border":`_spinner-border_e75384a`,"spinner-border-sm":`_spinner-border-sm_7239a63`,"spinner-grow-sm":`_spinner-grow-sm_2792df2`,"loader-button":`_loader-button_36bb1d8`,"spinner-border--novalue":`_spinner-border--novalue_fbdd20c`},x=t(),S=({buttonStyles:e,style:t,loading:n,type:r,value:a,onClick:o,ref:s})=>(0,x.jsxs)(`button`,{ref:s,style:t,disabled:n,onClick:o,type:r,className:(0,y.default)(n&&b[`loader-button`],e),children:[n&&(0,x.jsx)(`span`,{className:(0,y.default)(b[`spinner-border`],i(a)&&b[`spinner-border--novalue`]),role:`status`,"aria-hidden":`true`}),a]}),C=e=>{let{control:t,name:n,disabled:r,label:i,defaultChecked:a,disableFormSubmit:o=!1}=e,s=e=>{o&&e.key===`Enter`&&e.preventDefault()};return(0,x.jsx)(f,{name:n,control:t,defaultValue:a,render:({field:{onChange:e,value:t}})=>(0,x.jsx)(`div`,{className:(0,y.default)(h.checkbox,t&&h[`checkbox--checked`],r&&h[`checkbox--disabled`]),children:(0,x.jsxs)(`label`,{children:[(0,x.jsx)(`input`,{type:`checkbox`,className:(0,y.default)(h.checkbox__check),name:n,checked:t,onChange:e,disabled:r,onKeyDown:s}),(0,x.jsx)(`span`,{className:h.checkbox__label,children:i})]})})})},w=`/api/v1/print`,T=class extends Error{},E=async()=>{let e=await fetch(`${w}/printavailable`,{method:`GET`,headers:{Accept:`application/json`}});return e.status===200&&await e.json()},D=async(e,t)=>{let n=await fetch(`${w}/printpage`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify(e)});if(n.status===200){let r=await n.blob(),i=window.URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.setAttribute(`download`,`${e.filename}.pdf`),a.style.display=`none`;let o=t?document.getElementById(`print-modal`):document.body;o.appendChild(a),a.click(),o.removeChild(a),window.URL.revokeObjectURL(i);return}throw n.status===503?new T:Error()},O={"btn-secondary":`_btn-secondary_e4ad9af`,"btn-secondary--arrowupdown":`_btn-secondary--arrowupdown_0f438e2`,"btn-secondary--white":`_btn-secondary--white_f56e487`,"btn-secondary--large":`_btn-secondary--large_5bf2fa3`,"print-modal":`_print-modal_fac1577`,"print-modal--toprow":`_print-modal--toprow_6a23bb8`,header:`_header_6312fb2`,"print-form":`_print-form_6956bb8`,slider:`_slider_e456d35`,"print-btn":`_print-btn_37c5451`,"print-form__error":`_print-form__error_99c79ee`,"print-form__group":`_print-form__group_ae0971d`,"switch-container":`_switch-container_8122445`,"switch-label":`_switch-label_017ee6c`,switch:`_switch_417e791`,round:`_round_fd35ee9`},k=g(e=>{let t=(0,v.useRef)(null),{control:n,handleSubmit:r,setError:i,clearErrors:o,formState:{errors:s}}=d({defaultValues:e}),f=[`CustomFrontpage`,`TextSize`],{width:h}=u(),g=(0,v.useRef)(!1),[b,w]=(0,v.useState)(!1),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(!0),[N,P]=(0,v.useState)(),F=()=>{A(!k)},I=async()=>{try{return await E()}catch{return!1}},L=async e=>{M(!0);try{await D(e,k),o(`serverError`)}catch(e){i(`serverError`,{message:e instanceof T?a(`PrintEngineUnavailableText`):a(`PrintGenericErrorText`)})}M(!1)},R=()=>{if(e.buttonAtTop||h<768){P(void 0);return}let t=document.querySelector(`.feedback fieldset legend`);if(!t)return;let n=_(t);P({marginTop:`${n}px`})},z=()=>{let t=e.properties.filter(e=>!f.includes(e.name));return e.printPdfVariables?.ironpdf_get_selection_labels_from_dom&&t.forEach(e
1=>{if(!e.show)return;let t=`[data-print-selector="${e.name}"] [data-print-label]`,n=document.querySelector(t);n?.innerText?.trim()&&(e.label=n.innerText.trim())}),t},B=()=>e.properties?.filter(e=>f.includes(e.name)),V=t=>{let r=e.properties.findIndex(e=>e.name===t.name);return(0,x.jsx)(`li`,{children:(0,x.jsx)(C,{control:n,label:t.label,name:`properties.${r}.show`,defaultChecked:t.show,disableFormSubmit:!0})},t.name)};(0,v.useEffect)(()=>{h!==void 0&&((async()=>{try{if(!g.current){let e=await I();w(e),g.current=!0}}catch{console.error(`Error fetching data`)}finally{M(!1)}})(),R())},[h]);let H=B(),U=z();return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(S,{ref:t,onClick:async()=>{b?e.properties.length>0&&e.showPropertiesSelection?F():L(e):window.print()},loading:j,type:`button`,value:g.current?a(b?`PrintPDFButtonText`:`PrintButtonText`):``,buttonStyles:`print-btn`,style:N}),e.showPropertiesSelection&&(0,x.jsx)(m,{initialFocus:`form input`,modalTitle:`Print`,onClose:F,dialogId:`print-modal`,isOpen:k,focusOnClose:t.current,children:(0,x.jsxs)(`div`,{className:O[`print-modal`],children:[(0,x.jsx)(`div`,{className:O[`print-modal--toprow`],children:(0,x.jsx)(p,{"aria-label":`Lukk print`,onClick:F})}),(0,x.jsx)(`div`,{className:O.header,children:`Velg utskrift`}),j?(0,x.jsx)(l,{hasHeader:!1,itemHeight:20,numberOfItems:3,nextType:c.BUTTON}):(0,x.jsxs)(`form`,{className:O[`print-form`],onSubmit:r(L),children:[H?.length>0&&(0,x.jsx)(`ul`,{className:O[`print-form__group`],children:H.map(e=>e&&V(e))}),U?.length>0&&(0,x.jsx)(`ul`,{className:O[`print-form__group`],children:U.map(e=>e&&V(e))}),(0,x.jsx)(`button`,{className:(0,y.default)(O[`print-btn`],`print-btn print-btn--left`),children:a(`DownloadPDFButtonText`,`Last ned PDF`)}),s.serverError&&(0,x.jsx)(`p`,{role:`alert`,className:O[`print-form__error`],children:s.serverError.message})]})]})})]})});n(o.PrintComponent,k);
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.