@getpinax/widget 0.0.0-stage → 1.0.0-beta.2

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.
Files changed (54) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +513 -2
  3. package/dist/a11y/scan.d.ts +25 -0
  4. package/dist/api.d.ts +83 -0
  5. package/dist/capture/breadcrumbs.d.ts +49 -0
  6. package/dist/capture/console.d.ts +17 -0
  7. package/dist/capture/env.d.ts +25 -0
  8. package/dist/capture/network.d.ts +23 -0
  9. package/dist/capture/ring.d.ts +14 -0
  10. package/dist/capture/signature.d.ts +7 -0
  11. package/dist/capture/text.d.ts +23 -0
  12. package/dist/capture/ua.d.ts +13 -0
  13. package/dist/chunks/editor-0Kr31Uly.mjs +1368 -0
  14. package/dist/chunks/privacy-B_b1_Y1n.mjs +39 -0
  15. package/dist/chunks/recorder-tu4yugLw.mjs +2874 -0
  16. package/dist/chunks/scan-CFQwrtAQ.mjs +46137 -0
  17. package/dist/chunks/text-D9SaDBT0.mjs +36 -0
  18. package/dist/chunks/widget-BpTBdX2R.mjs +1272 -0
  19. package/dist/editor/annotator.d.ts +20 -0
  20. package/dist/editor/capture.d.ts +28 -0
  21. package/dist/editor/encode.d.ts +7 -0
  22. package/dist/editor/index.d.ts +5 -0
  23. package/dist/editor/mask.d.ts +29 -0
  24. package/dist/editor/pii.d.ts +22 -0
  25. package/dist/editor/shapes.d.ts +31 -0
  26. package/dist/editor-loader.d.ts +9 -0
  27. package/dist/editor-loader.embed.d.ts +6 -0
  28. package/dist/fixcheck.d.ts +42 -0
  29. package/dist/index.d.ts +85 -0
  30. package/dist/known.d.ts +27 -0
  31. package/dist/mount.d.ts +8 -0
  32. package/dist/navigation.d.ts +1 -0
  33. package/dist/paths.d.ts +4 -0
  34. package/dist/pinax-axe.js +46167 -0
  35. package/dist/pinax-editor.js +1417 -0
  36. package/dist/pinax-recorder.js +2915 -0
  37. package/dist/pinax.js +135 -0
  38. package/dist/pinax.mjs +1270 -0
  39. package/dist/preview.d.ts +48 -0
  40. package/dist/preview.mjs +67 -0
  41. package/dist/privacy.d.ts +24 -0
  42. package/dist/queue.d.ts +10 -0
  43. package/dist/replay/buffer.d.ts +40 -0
  44. package/dist/replay/recorder.d.ts +25 -0
  45. package/dist/replay/sanitize.d.ts +19 -0
  46. package/dist/report.d.ts +128 -0
  47. package/dist/segment.d.ts +31 -0
  48. package/dist/settings.d.ts +40 -0
  49. package/dist/types.d.ts +247 -0
  50. package/dist/ui/color.d.ts +7 -0
  51. package/dist/ui/dom.d.ts +14 -0
  52. package/dist/ui/styles.d.ts +3 -0
  53. package/dist/ui/widget.d.ts +241 -0
  54. package/package.json +74 -4
package/dist/pinax.js ADDED
@@ -0,0 +1,135 @@
1
+ (function(){var e=``;function t(t){e=t}var n=new Map;function r(t){let r=n.get(t);return r||(r=import(new URL(`${t}?v=1.0.0-beta.2`,e||document.baseURI).href),n.set(t,r),r.catch(()=>{n.delete(t)})),r}function i(){return r(`pinax-editor.js`)}function a(){return r(`pinax-recorder.js`)}function o(){return r(`pinax-axe.js`)}function s(e,t){return e.length>t?`${e.slice(0,t-1)}…`:e}var c=/^(access_?token|token|id_token|refresh_token|auth|authorization|api_?key|key|secret|password|passwd|pwd|session|sessionid|sid|code|signature|sig)$/i;function l(e,t){try{let n=new URL(e,t);n.hash=``,n.username=``,n.password=``;for(let e of[...n.searchParams.keys()])c.test(e)&&n.searchParams.set(e,`[hidden]`);return n.toString()}catch{return String(e)}}var u=/^(utm_\w*|page|lang|ref|variant|tab|sort)$/i;function d(e,t){let n=e.indexOf(`?`);if(n<0)return e;let r=e.slice(n+1).split(`&`).map(e=>{let n=e.indexOf(`=`);if(n<0||n===e.length-1)return e;let r=e.slice(0,n),i=r;try{i=decodeURIComponent(r.replace(/\+/g,` `))}catch{}return t?.test(i)?e:`${r}=…`}).join(`&`);return`${e.slice(0,n)}?${r}`}function f(e,t){return d(l(e,t))}var p=/[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g,ee=/(?<![\w+])(?:\+\d{1,3}|\(?0\d{1,4}\)?|\(?\d{3}\)?)(?:[ .-]?\(?\d{1,5}\)?){1,6}(?![\w])/g,te=/^\(?\d{3}\)?[ .-]\d{3}[ .-]\d{4}$/;function ne(e){let t=e.trim(),n=t.replace(/\D/g,``).length;return t.startsWith(`+`)?n>=8&&n<=15:/^\(?0/.test(t)?n>=10&&n<=12:n===10&&te.test(t)}function re(e){let t=[];if(e.length<7)return t;if(e.includes(`@`))for(let n of e.matchAll(p))t.push({start:n.index??0,end:(n.index??0)+n[0].length,kind:`email`});if(/\d{2}/.test(e))for(let n of e.matchAll(ee)){let e=n.index??0,r=e+n[0].length;ne(n[0])&&(t.some(t=>e<t.end&&r>t.start)||t.push({start:e,end:r,kind:`phone`}))}return t.sort((e,t)=>e.start-t.start)}function m(e){let t=re(e);if(!t.length)return e;let n=``,r=0;for(let i of t)n+=e.slice(r,i.start)+`*`.repeat(i.end-i.start),r=i.end;return n+e.slice(r)}var ie=[`see`,`keyboard`,`screen-reader`,`media`,`other`],h={message:5e3,email:320,entries:50,annotations:200,screenshotChars:6e6,screenshotBytes:4718592,breadcrumbs:20,followUpQuestion:300,followUpAnswer:2e3,replayChars:45e5,fields:10,fieldId:40,fieldText:200,bodyBytes:11534336},ae=65536,oe=/^[A-Za-z0-9+/=]+$/,se=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9-]*\.)+[A-Za-z]{2,}$/,ce=/^data:image\/(png|jpeg|webp);base64,[A-Za-z0-9+/=]+$/;function g(e){return e.length<=h.email&&se.test(e)}function le(e){let t=e.slice(e.indexOf(`,`)+1),n=t.endsWith(`==`)?2:+!!t.endsWith(`=`);return Math.floor(t.length*3/4)-n}function ue(e){return e.length<=h.screenshotChars&&ce.test(e)&&le(e)<=h.screenshotBytes}function de(e){return e.message.trim().length>0||e.type===`GENERAL`&&e.rating!==void 0||e.type===`ACCESSIBILITY`&&e.barrier!==void 0||e.screenshot!==void 0}var _=(e,t)=>Number.isFinite(e)?Math.round(Math.min(1,Math.max(t,e))*1e4)/1e4:0;function v(e){let t=d(l(e),u);return t.length<=2e3?t:s(t.split(`?`)[0],2e3)}function fe(e){if(!e)return;let t={};return e.id!=null&&String(e.id)&&(t.id=s(String(e.id),200)),e.name&&(t.name=s(String(e.name),200)),Object.keys(t).length?t:void 0}function pe(e,t){let n={type:e.type,message:s(e.message.trim(),h.message),page:{url:v(t.page.url),title:t.page.title?s(t.page.title,500):void 0},environment:t.environment};e.type===`GENERAL`&&e.rating!==void 0&&Number.isInteger(e.rating)&&e.rating>=1&&e.rating<=5&&(n.rating=e.rating);let r=e.email?.trim().toLowerCase();r&&g(r)&&(n.email=r);let i=fe(e.user);i&&(n.user=i),t.console.length&&(n.console=t.console.slice(-h.entries).map(e=>{let t={...e,message:m(e.message)};return e.stack&&(t.stack=m(e.stack)),t})),t.network.length&&(n.network=t.network.slice(-h.entries)),t.breadcrumbs?.length&&(n.breadcrumbs=t.breadcrumbs.slice(-h.breadcrumbs).map(e=>{let t={kind:e.kind,at:s(e.at,40),path:s(e.path,500)};return e.target&&(t.target=s(m(e.target),200)),t}));let a=e.followUp?.question.trim(),o=e.followUp?.answer.trim();a&&o&&(n.followUp={question:s(a,h.followUpQuestion),answer:s(o,h.followUpAnswer)});let c=(e.fields??[]).filter(e=>typeof e.id==`string`&&e.id.length<=h.fieldId&&(typeof e.value==`boolean`||typeof e.value==`string`&&e.value.trim())).slice(0,h.fields).map(e=>({id:e.id,value:typeof e.value==`boolean`?e.value:s(e.value.trim(),h.fieldText)}));return c.length&&(n.fields=c),e.type===`ACCESSIBILITY`&&(e.barrier&&ie.includes(e.barrier)&&(n.barrier=e.barrier),e.a11yScan&&(n.a11yScan=e.a11yScan)),e.consent&&(n.consent={diagnostics:e.consent.diagnostics===!0,replay:e.consent.replay===!0}),e.includeLogs===!0&&(n.includeLogs=!0),e.hp&&(n.hp=s(e.hp,500)),e.elapsedMs!==void 0&&Number.isFinite(e.elapsedMs)&&e.elapsedMs>=0&&(n.elapsedMs=Math.min(Math.round(e.elapsedMs),864e5)),e.screenshot&&ue(e.screenshot)&&(n.screenshot=e.screenshot,e.annotations?.length&&(n.annotations=e.annotations.slice(0,h.annotations).map(e=>{let t=e.type===`arrow`?-1:0,n={type:e.type,x:_(e.x,0),y:_(e.y,0),w:_(e.w,t),h:_(e.h,t)};return e.type===`text`&&e.text&&(n.text=s(e.text,500)),n}))),n}function me(e){return new TextEncoder().encode(JSON.stringify(e)).length}function he(e,t){return!t||t.length>h.replayChars||!oe.test(t)||me(e)+t.length+12>h.bodyBytes-ae?!1:(e.replay=t,!0)}function ge(e){return(e||`https://api.getpinax.com`).replace(/\/+$/,``)}function _e(e,t){let n=e??(t?``:`https://cdn.getpinax.com`);return n?n.replace(/\/+$/,``):null}function ve(e,t){return`${e}/config/${encodeURIComponent(t)}.json`}function y(e,t,n){return`${e}/v1/widget/${encodeURIComponent(t)}/${n}`}async function ye(e,t){let n=await e(t,{credentials:`omit`});if(!n.ok)return{status:n.status,config:null};let r=await n.json();return{status:n.status,config:r?.data??null}}async function be(e,t,n,r=null){if(r)try{let{config:t}=await ye(e,ve(r,n));if(t)return t}catch{}return(await ye(e,y(t,n,`config`))).config}function xe(e,t,n,r){try{if(!new URL(r).searchParams.has(`pinax_verify`))return;e(y(t,n,`ping`),{method:`POST`,credentials:`omit`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:v(r)})}).catch(()=>{})}catch{}}var Se={403:`Feedback isn't switched on for this website yet.`,404:`Feedback isn't switched on for this website yet.`,413:`That screenshot is too big to send. Remove it and try again.`,429:`Too many reports from this device. Please try again in a few minutes.`};async function Ce(e,t,n,r){let i;try{i=await e(y(t,n,`reports`),{method:`POST`,credentials:`omit`,headers:{"Content-Type":`application/json`},body:JSON.stringify(r)})}catch{return{ok:!1,retry:!0,status:0,message:`You're offline. We'll send it when you're back.`}}let a=null;try{a=await i.json()}catch{}if(i.ok)return{ok:!0,id:a?.data?.id??``};let o=i.status;return{ok:!1,retry:o>=500,status:o,message:Se[o]??(o===400&&a?.message?a.message:`Something went wrong. Please try again.`)}}var we=4e3;async function Te(e,t,n,r,i=we){let a=typeof AbortController==`function`?new AbortController:null,o,s=new Promise(e=>{o=setTimeout(()=>{a?.abort(),e(null)},i)}),c=(async()=>{try{let i=await e(y(t,n,`follow-up`),{method:`POST`,credentials:`omit`,headers:{"Content-Type":`application/json`},body:JSON.stringify({type:r.type,message:r.message.trim().slice(0,2e3),pagePath:r.pagePath.slice(0,500)||`/`}),signal:a?.signal});if(!i.ok)return null;let o=(await i.json())?.data?.question;return typeof o==`string`&&o.trim()?o.trim().slice(0,300):null}catch{return null}})();try{return await Promise.race([c,s])}finally{clearTimeout(o)}}function Ee(e,t,n,r,i=`fix-check`){try{e(y(t,n,i),{method:`POST`,credentials:`omit`,keepalive:!0,headers:{"Content-Type":`application/json`},body:JSON.stringify({checkId:r.checkId.slice(0,64),signature:r.signature.slice(0,300),...i===`sighting`&&r.basket?{basket:r.basket}:{},...r.consent?{consent:!0}:{}})}).catch(()=>{})}catch{}}function De(e,t,n){return n?`${n}/count/${encodeURIComponent(t)}`:y(e,t,`count`)}function Oe(e,t,n,r){try{e(De(t,n,r),{method:`POST`,credentials:`omit`,keepalive:!0}).catch(()=>{})}catch{}}async function ke(e,t,n){try{return(await e(t,{method:`POST`,credentials:`omit`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n)})).ok}catch{return!1}}function Ae(e,t,n,r,i){return ke(e,y(t,n,`known/${encodeURIComponent(r)}/me-too`),i?{email:i.trim().slice(0,254)}:{})}var je=`input,textarea,select,[contenteditable]:not([contenteditable=false]),[data-pinax-mask],.pinax-mask`,Me=`[data-pinax-mask],.pinax-mask`,Ne=`a[href],button,input,select,textarea,summary,[role=button],[role=link],[role=tab],[role=menuitem],[role=checkbox],[role=radio],[role=switch],[role=option],[contenteditable]:not([contenteditable=false])`,Pe={button:`button`,submit:`button`,reset:`button`,image:`button`,checkbox:`checkbox`,radio:`radio`,range:`slider`,search:`searchbox`};function b(e,t){try{return e.matches(t)}catch{return!1}}function x(e,t){try{return e.closest(t)}catch{return null}}var S=e=>e.replace(/\s+/g,` `).trim();function Fe(e){if(e.tagName!==`INPUT`)return!1;let t=e,n=(t.getAttribute(`autocomplete`)??``).toLowerCase(),r=`${t.name} ${t.id}`.toLowerCase();return t.type===`password`||n.includes(`cc-`)||n.includes(`password`)||/\b(card|cc|cvc|cvv|iban)/.test(r)}function Ie(e){let t=e.getAttribute(`role`)?.trim().split(/\s+/)[0];if(t)return t;let n=e.tagName.toLowerCase();switch(n){case`a`:return e.hasAttribute(`href`)?`link`:`text`;case`button`:case`summary`:return`button`;case`input`:return Pe[e.type?.toLowerCase()]??`textbox`;case`textarea`:return`textbox`;case`select`:return`combobox`;case`img`:return`image`;case`h1`:case`h2`:case`h3`:case`h4`:case`h5`:case`h6`:return`heading`;default:return b(e,`[contenteditable]:not([contenteditable=false])`)?`textbox`:n}}function C(e,t=120){if(b(e,je)||x(e,Me))return``;let n=``,r=e=>{if(n.length>t)return;if(e.nodeType===3){n+=e.nodeValue??``;return}if(e.nodeType!==1)return;let i=e,a=i.tagName;if(a!==`SCRIPT`&&a!==`STYLE`&&a!==`TEMPLATE`&&!b(i,je)&&i.getAttribute(`aria-hidden`)!==`true`){if(a===`IMG`)n+=` ${i.getAttribute(`alt`)??``} `;else{for(let e of i.childNodes)r(e);/^(P|DIV|LI|BR|TD|TH|DT|DD)$/.test(a)&&(n+=` `)}}};for(let t of e.childNodes)r(t);return S(n)}function Le(e){let t=e.getAttribute(`aria-labelledby`);if(!t)return``;let n=e.ownerDocument;return S(t.split(/\s+/).map(e=>{let t=n.getElementById(e);return t?C(t):``}).join(` `))}function Re(e){let t=e;return S((t.labels?[...t.labels]:[]).map(e=>C(e)).join(` `))||S(t.getAttribute(`placeholder`)??``)||S(t.getAttribute(`title`)??``)||S(t.getAttribute(`name`)??``)}function ze(e){if(x(e,Me))return``;let t=S(e.getAttribute(`aria-label`)??``);if(t)return t;let n=Le(e);if(n)return n;let r=e.tagName;if(r===`INPUT`){let t=e.type?.toLowerCase();return t===`submit`||t===`button`||t===`reset`?S(e.getAttribute(`value`)??``):t===`image`?S(e.getAttribute(`alt`)??``):Re(e)}return r===`TEXTAREA`||r===`SELECT`?Re(e):b(e,`[contenteditable]:not([contenteditable=false])`)?S(e.getAttribute(`title`)??``):r===`IMG`?S(e.getAttribute(`alt`)??``):C(e)||S(e.getAttribute(`title`)??``)}function Be(e){let t=x(e,Ne);if(!t)return s(Ie(e),200);let n=t;if(Fe(n))return n.type===`password`?`password field`:`card field`;let r=Ie(n),i=s(ze(n),60).replace(/"/g,`'`);return s(i?`${r} "${i}"`:r,200)}function w(e=location.href){try{let t=new URL(l(e));return s(d(`${t.pathname}${t.search}`),500)}catch{return`/`}}function Ve(e,t={}){let n=t.doc??document,r=t.ignore??(()=>!1),i=``,a=null,o=t=>{try{e.push(t)}catch{}},s=e=>{if(!e||typeof e.nodeType!=`number`)return null;let t=e;return t.nodeType===1?t:t.parentElement},c=e=>{try{if(r(e.target))return;let t=s(e.target);if(!t)return;a=null,o({kind:`click`,at:new Date().toISOString(),path:w(),target:Be(t)})}catch{}},l=e=>{try{if(r(e.target))return;let t=s(e.target);if(!t)return;let n=x(t,Ne)??t;if(n.tagName===`INPUT`&&/^(checkbox|radio)$/i.test(n.type)||n===a)return;a=n,o({kind:`input`,at:new Date().toISOString(),path:w(),target:Be(n)})}catch{}},u=()=>{try{let e=location.pathname+location.search;if(e===i)return;i=e,a=null,o({kind:`navigation`,at:new Date().toISOString(),path:w()})}catch{}};return n.addEventListener(`click`,c,!0),n.addEventListener(`input`,l,!0),u(),{navigated:u,stop:()=>{n.removeEventListener(`click`,c,!0),n.removeEventListener(`input`,l,!0)}}}var He=[`error`,`warn`,`log`,`info`,`debug`],T=2e3,E=4e3;function Ue(e,t=0){if(typeof e==`string`)return e;if(e instanceof Error)return`${e.name}: ${e.message}`;if(e==null)return String(e);if(typeof e==`function`)return`[function ${e.name||``}]`;if(typeof e!=`object`)return String(e);if(typeof Node<`u`&&e instanceof Node)return`[${e.nodeName.toLowerCase()}]`;if(t>0)return Array.isArray(e)?`[…]`:`{…}`;try{let t=new WeakSet;return s(JSON.stringify(e,(e,n)=>{if(n&&typeof n==`object`){if(t.has(n))return`[circular]`;t.add(n)}return n})??String(e),T)}catch{return Object.prototype.toString.call(e)}}function We(e){return s(e.map(e=>Ue(e)).join(` `),T)}function Ge(e){let t=e.find(e=>e instanceof Error);return t?.stack?s(t.stack,E):void 0}function Ke(){let e=Error().stack;if(!e)return;let t=e.split(`
2
+ `),n=t[0].startsWith(`Error`)?3:2,r=t.slice(n).join(`
3
+ `);return r?s(r,E):void 0}function qe(e,t=window){let n=t.console,r=new Map,i=new Map,a=!1,o=t=>{try{e.push(t)}catch{}};for(let e of He){let t=n?.[e];if(typeof t!=`function`)continue;let s=function(...n){if(!a){a=!0;try{o({level:e,message:We(n),stack:Ge(n)??(e===`error`||e===`warn`?Ke():void 0),at:new Date().toISOString()})}catch{}finally{a=!1}}return t.apply(this,n)};s.__pinaxOriginal=t,r.set(e,t),i.set(e,s);try{n[e]=s}catch{}}let c=e=>{try{if(!e.message&&!e.error)return;let t=e.error,n=e.filename?` (${e.filename}:${e.lineno}:${e.colno})`:``;o({level:`error`,message:s(`Uncaught ${t?.name?`${t.name}: ${t.message}`:e.message}${n}`,T),stack:t?.stack?s(t.stack,E):void 0,at:new Date().toISOString()})}catch{}},l=e=>{try{let t=e.reason;o({level:`error`,message:s(`Unhandled promise rejection: ${Ue(t)}`,T),stack:t instanceof Error&&t.stack?s(t.stack,E):void 0,at:new Date().toISOString()})}catch{}};return t.addEventListener(`error`,c),t.addEventListener(`unhandledrejection`,l),()=>{t.removeEventListener(`error`,c),t.removeEventListener(`unhandledrejection`,l);for(let[e,t]of r)try{n[e]===i.get(e)&&(n[e]=t)}catch{}}}var Je={"10.0":`10/11`,"6.3":`8.1`,"6.2":`8`,"6.1":`7`};function D(e,t){return t.exec(e)?.[1]}function O(e){if(e)return e.replace(/_/g,`.`).split(`.`).slice(0,2).join(`.`)}function Ye(e,t=0){let n={deviceType:`desktop`};for(let[t,r]of[[`Edge`,/Edg(?:e|A|iOS)?\/([\d.]+)/],[`Opera`,/(?:OPR|OPiOS)\/([\d.]+)/],[`Samsung Internet`,/SamsungBrowser\/([\d.]+)/],[`Firefox`,/(?:Firefox|FxiOS)\/([\d.]+)/],[`Chrome`,/(?:Chrome|CriOS)\/([\d.]+)/],[`Safari`,/Version\/([\d.]+).*Safari\//]]){let i=D(e,r);if(i){n.browser=t,n.browserVersion=O(i);break}}!n.browser&&/AppleWebKit/.test(e)&&/Mobile\//.test(e)&&(n.browser=`Safari (in-app)`);let r=/iPad/.test(e)||/Macintosh/.test(e)&&t>1;if(/iPhone|iPod/.test(e))n.os=`iOS ${O(D(e,/OS ([\d_]+) like Mac/))??``}`.trim(),n.deviceType=`mobile`,n.deviceModel=/iPod/.test(e)?`iPod`:`iPhone`;else if(r){let t=O(D(e,/OS ([\d_]+) like Mac/));n.os=t?`iPadOS ${t}`:`iPadOS`,n.deviceType=`tablet`,n.deviceModel=`iPad`}else if(/Android/.test(e)){n.os=`Android ${D(e,/Android ([\d.]+)/)??``}`.trim(),n.deviceType=/Mobile/.test(e)?`mobile`:`tablet`;let t=D(e,/Android [\d.]+;(?: [a-z]{2}[-_][a-z]{2};)? ([^;)]+?)(?: Build\/[^;)]*)?\)/i);t&&t!==`K`&&!/^wv$/.test(t)&&(n.deviceModel=t.trim())}else if(/CrOS/.test(e))n.os=`ChromeOS`;else if(/Windows NT/.test(e)){let t=D(e,/Windows NT ([\d.]+)/);n.os=t&&Je[t]?`Windows ${Je[t]}`:`Windows`}else/Mac OS X/.test(e)?n.os=`macOS ${O(D(e,/Mac OS X ([\d_.]+)/))??``}`.trim():/Linux/.test(e)&&(n.os=`Linux`);return n.deviceType===`desktop`&&/Mobi|Tablet|Kindle|Silk/.test(e)&&(n.deviceType=/Tablet|Kindle|Silk/.test(e)?`tablet`:`mobile`),n}var k=e=>typeof e==`number`&&Number.isFinite(e)?Math.max(0,Math.round(e)):0;function Xe(e=new Date){let t=(e,t=2)=>String(Math.abs(e)).padStart(t,`0`),n=-e.getTimezoneOffset(),r=n>=0?`+`:`-`;return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}.${t(e.getMilliseconds(),3)}${r}${t(Math.trunc(n/60))}:${t(n%60)}`}function Ze(e=window){let t=e.navigator,n=t?.userAgent??``,r=Ye(n,t?.maxTouchPoints??0),i=`UTC`;try{i=Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}catch{}let a=(e,t)=>e?s(e,t):void 0;return{userAgent:s(n,1e3),browser:a(r.browser,100),browserVersion:a(r.browserVersion,50),os:a(r.os,100),deviceType:r.deviceType,deviceModel:a(r.deviceModel,100),screen:{w:k(e.screen?.width),h:k(e.screen?.height)},viewport:{w:k(e.innerWidth),h:k(e.innerHeight)},pixelRatio:Math.min(10,Math.max(0,e.devicePixelRatio||1)),timeZone:s(i,100),language:a(t?.language,35),occurredAt:Xe()}}function Qe(e,t){return e===0||e>=400||t>2e3}function $e(e,t=window,n={}){let r=n.now??(()=>typeof performance<`u`?performance.now():Date.now()),i=t.location?.href,a=n.ignore??(()=>!1),o=(t,n,o,c,l)=>{try{let u=Math.max(0,Math.round(r()-c));if(!Qe(o,u))return;let d=f(n,i);if(a(d))return;e.push({method:s(t.toUpperCase(),10),url:s(d,2e3),status:Math.min(999,Math.max(0,o|0)),durationMs:Math.min(6e5,u),at:l})}catch{}},c=[],l=t.fetch;if(typeof l==`function`){let e=(e,n)=>{let i=`GET`,a=``,s=r(),c=new Date().toISOString();try{typeof e==`string`?a=e:e instanceof URL?a=e.href:e&&typeof e.url==`string`&&(a=e.url,i=e.method||i),n?.method&&(i=n.method)}catch{}let u=l.call(t,e,n);try{u.then(e=>o(i,a,e?.status??0,s,c),()=>o(i,a,0,s,c))}catch{}return u};try{t.fetch=e,c.push(()=>{t.fetch===e&&(t.fetch=l)})}catch{}}let u=t.XMLHttpRequest;if(u?.prototype){let e=u.prototype,t=e.open,n=e.send,i=new WeakMap,a=new WeakMap,s=new WeakSet,l=function(e,n,...r){try{i.set(this,{method:String(e),url:String(n)})}catch{}return t.call(this,e,n,...r)},d=function(e){try{let e=i.get(this);e&&(a.set(this,{m:e,start:r(),startedAt:new Date().toISOString(),aborted:!1}),s.has(this)||(s.add(this),this.addEventListener(`abort`,()=>{let e=a.get(this);e&&(e.aborted=!0)}),this.addEventListener(`loadend`,()=>{let e=a.get(this);a.delete(this),e&&!e.aborted&&o(e.m.method,e.m.url,this.status,e.start,e.startedAt)})))}catch{}return n.call(this,e)};e.open=l,e.send=d,c.push(()=>{e.open===l&&(e.open=t),e.send===d&&(e.send=n)})}return()=>{for(let e of c)try{e()}catch{}}}var et=class{constructor(e){this.capacity=e,this.items=[],this.listeners=new Set}push(e){this.items.push(e),this.items.length>this.capacity&&this.items.shift();for(let t of this.listeners)try{t(e)}catch{}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}toArray(){return this.items.slice()}clear(){this.items=[]}get size(){return this.items.length}};function tt(e){return m(e).replace(/https?:\/\/\S+/g,`<url>`).replace(/\b[0-9a-f]{8,}\b/gi,`<id>`).replace(/\d+/g,`<n>`).replace(/\s+/g,` `).trim().slice(0,200)}function nt(e,t){let n=(Array.isArray(e)?e:[]).filter(e=>e.level===`error`);if(n[0]?.message)return`console:${tt(n[0].message)}`;let r=(Array.isArray(t)?t:[]).find(e=>e.status===0||e.status>=500);if(r){let e=r.url;try{e=new URL(r.url).pathname}catch{}return`network:${r.method.toUpperCase()} ${tt(e)} ${r.status===0?`failed`:`5xx`}`}return null}function rt(e){return e.level===`error`?nt([e],[]):null}function it(e){return nt([],[e])}function A(e){let t=e.path??(()=>location.pathname),n=e.random??Math.random,r=e.now??Date.now,i=[],a=new Set,o=r(),s=null,c=t=>{if(t){for(let n of i)if(!(n.signature!==t||a.has(n.id))){a.add(n.id);try{e.report(n)}catch{}}}},l=e=>{let t=Date.parse(e);return Number.isNaN(t)||t>=o-1},u=r=>{let u=t();if(s=u,o=r,a=new Set,i=e.checks.filter(t=>at(t.path,u)&&e.sampleRate>0&&n()<e.sampleRate),i.length){for(let t of e.console.toArray())l(t.at)&&c(rt(t));for(let t of e.network.toArray())l(t.at)&&c(it(t))}},d=e.console.subscribe(e=>{i.length&&c(rt(e))}),f=e.network.subscribe(e=>{i.length&&c(it(e))}),p=typeof performance<`u`&&performance.timeOrigin?performance.timeOrigin:r();return u(e.since??Math.min(p,r())),{navigated:()=>{t()!==s&&u(r())},stop:()=>{d(),f(),i=[]}}}function at(e,t){return e===`*`||ot(e,t)}function ot(e,t){let n=e=>e.length>1?e.replace(/\/+$/,``):e;return n(e)===n(t)}function st(e){let t=e.path??(()=>location.pathname),n=new Set,r=t(),i=e.known.flatMap(e=>e.signature?[{id:e.id,path:`*`,signature:e.signature}]:[]),a=i.length?A({checks:i,sampleRate:1,random:()=>0,console:e.console,network:e.network,report:e=>n.add(e.id),path:t,now:e.now}):null;return{matches:()=>ct(e.known,t(),n),navigated:()=>{t()!==r&&(r=t(),n.clear()),a?.navigated()},stop:()=>a?.stop()}}function ct(e,t,n=new Set){return e.filter(e=>n.has(e.id)||e.paths.some(e=>ot(e,t))).slice(0,3)}var j=`pinax-widget-root`;function lt(e=document){let t=e.getElementById(j);if(t?.shadowRoot)return t.shadowRoot;let n=e.createElement(`div`);return n.id=j,n.className=`ph-no-capture fs-exclude`,n.setAttribute(`data-hj-suppress`,``),n.setAttribute(`data-clarity-mask`,`true`),n.setAttribute(`data-private`,``),n.style.cssText=`all: initial; position: fixed; z-index: 2147483647;`,e.body.appendChild(n),n.attachShadow({mode:`open`})}function ut(e=document){e.getElementById(j)?.remove()}function dt(e,t=window){let n=!0,r=!1,i=()=>{if(!n||r)return;r=!0;let t=()=>{if(r=!1,n)try{e()}catch{}};try{queueMicrotask(t)}catch{setTimeout(t,0)}},a=[],o=t.history;for(let e of[`pushState`,`replaceState`]){let t=o?.[e];if(typeof t!=`function`)continue;let n=function(...e){let n=t.apply(this,e);return i(),n};try{o[e]=n,a.push(()=>{o[e]===n&&(o[e]=t)})}catch{}}return t.addEventListener(`popstate`,i),a.push(()=>t.removeEventListener(`popstate`,i)),()=>{n=!1;for(let e of a)try{e()}catch{}}}var M=new Map;function ft(e){let t=M.get(e);if(!t){let n=pt(e.trim()).split(`*`).map(e=>e.replace(/[.+?^${}()|[\]\\]/g,`\\$&`)).join(`.*`);t=RegExp(`^${n}$`),M.size>200&&M.clear(),M.set(e,t)}return t}function pt(e){return e.length>1?e.replace(/\/+$/,``)||`/`:e}function mt(e){try{return decodeURI(e)}catch{return e}}function ht(e,t){if(typeof e!=`string`||!e.trim())return!1;let n=ft(e),r=pt(t||`/`),i=[r,`${r===`/`?``:r}/`],a=mt(r);return a!==r&&i.push(a,`${a}/`),i.some(e=>n.test(e))}function gt(e,t){return e?.length?e.some(e=>ht(e,t)):!1}var _t=36e5,vt=8,N=e=>`pinax:queue:${e}`,P=new Map,yt=e=>Date.now()-e.queuedAt<=_t,bt=e=>{let t=e;return!!t&&typeof t.queuedAt==`number`&&typeof t.tries==`number`&&typeof t.body?.page?.url==`string`};function F(e,t){let n;try{let r=e.getItem(N(t)),i=r?JSON.parse(r):[];n=Array.isArray(i)?i:[]}catch{return[]}let r=n.filter(e=>bt(e)&&yt(e)),i=r.some(e=>`email`in e.body||`user`in e.body);if(r.length===n.length&&!i)return r;for(let e of n)!r.includes(e)&&e?.id&&P.delete(e.id);let a=r.map(e=>({...e,body:xt(e.body)}));return I(e,t,a),a}function I(e,t,n){try{return n.length?e.setItem(N(t),JSON.stringify(n)):e.removeItem(N(t)),!0}catch{return!1}}function L(){try{return window.localStorage}catch{return null}}function xt(e){let{email:t,user:n,console:r,screenshot:i,annotations:a,replay:o,...s}=e;return{...s,page:{...s.page,url:v(s.page.url)}}}var St=()=>`${Date.now().toString(36)}${Math.random().toString(36).slice(2,10)}`;function Ct(e,t){let n=L();if(!n)return!1;let r=F(n,e),i=r.slice(0,Math.max(0,r.length-4));for(let e of i)e.id&&P.delete(e.id);let a=St(),o=I(n,e,[...r.slice(-4),{id:a,body:xt(t),queuedAt:Date.now(),tries:0}]);return o&&(t.email||t.user)&&P.set(a,{...t.email&&{email:t.email},...t.user&&{user:t.user}}),o}function wt(e){let t=L();return t?F(t,e).length:0}var R=!1;async function Tt(e,t,n){let r=L();if(r&&!R&&(typeof navigator>`u`||navigator.onLine!==!1)){R=!0;try{let i=F(r,n),a=[];for(let r of i){let i=r.id?P.get(r.id):void 0,o=await Ce(e,t,n,{...r.body,...i});!o.ok&&o.retry&&r.tries+1<vt?a.push({...r,tries:r.tries+1}):r.id&&P.delete(r.id)}let o=new Set(i.map(e=>e.id)),s=F(r,n).filter(e=>!o.has(e.id));I(r,n,[...a,...s])}finally{R=!1}}}var Et={opened:`Pinax Widget Opened`,submitted:`Feedback Submitted`};function Dt(e=window){try{let t=e.analytics;return!t||typeof t!=`object`&&typeof t!=`function`?null:typeof t.track==`function`?t:null}catch{return null}}function Ot(e,t){return typeof e==`boolean`?e:t===!0}function kt(e,t){try{Dt()?.track?.(e,t)}catch{}}function At(){kt(Et.opened,{source:`pinax`})}function jt(e){let t={source:`pinax`,type:e.type.toLowerCase()};typeof e.rating==`number`&&(t.rating=e.rating),e.reportId&&(t.reportId=e.reportId),e.queued&&(t.queued=!0),kt(Et.submitted,t)}function Mt(){try{let e=Dt()?.user?.()?.id?.();return typeof e==`string`&&e.trim()?e.trim().slice(0,200):typeof e==`number`&&Number.isFinite(e)?String(e):null}catch{return null}}var Nt={color:`#B8F35C`,text:`Feedback`,position:`bottom-right`,types:{problem:!0,idea:!0,general:!0,accessibility:!1},rating:!0,hidePaths:[],smallOnMobile:!1,hideButton:!1,segment:!1,wording:{chooserTitle:``,problemTitle:``,ideaTitle:``,generalTitle:``,accessibilityTitle:``,messagePlaceholder:``,confirmation:``},fields:[],capture:{console:!0,network:!0},knownIssues:{enabled:!0,notify:!0},consent:{required:!1},privacyUrl:``,identifyPrefill:!0},z={fields:10,label:80,options:20,option:80,text:200},Pt=[`bottom-right`,`bottom-left`,`right-edge`],Ft=Object.keys(Nt.wording),B=(e,t)=>typeof e==`string`?e.trim().slice(0,t):``,V=(e,t)=>typeof e==`boolean`?e:t,It=[`select`,`text`,`checkbox`];function Lt(e){if(!Array.isArray(e))return[];let t=[],n=new Set;for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=typeof e.id==`string`?e.id.slice(0,40):``,a=e.type,o=B(e.label,z.label);if(!i||n.has(i)||!It.includes(a)||!o)continue;let s=a===`select`&&Array.isArray(e.options)?[...new Set(e.options.map(e=>B(e,z.option)).filter(Boolean))].slice(0,z.options):[];if(a===`select`&&!s.length)continue;let c=e.types??{};if(n.add(i),t.push({id:i,type:a,label:o,required:e.required===!0,options:s,types:{problem:V(c.problem,!0),idea:V(c.idea,!0),general:V(c.general,!0)}}),t.length>=z.fields)break}return t}function Rt(e){let t=e??{},n=Nt,r=t.types??{},i={problem:V(r.problem,!0),idea:V(r.idea,!0),general:V(r.general,!0),accessibility:V(r.accessibility,!1)},a=i.problem||i.idea||i.general||i.accessibility,o=t.wording??{},s={...n.wording};for(let e of Ft)s[e]=B(o[e],120);return{color:typeof t.color==`string`?t.color:n.color,text:B(t.text,40)||n.text,position:Pt.includes(t.position)?t.position:n.position,types:a?i:{...n.types},rating:V(t.rating,n.rating),hidePaths:Array.isArray(t.hidePaths)?t.hidePaths.filter(e=>typeof e==`string`):[],smallOnMobile:V(t.smallOnMobile,n.smallOnMobile),hideButton:V(t.hideButton,n.hideButton),segment:V(t.segment,n.segment),wording:s,fields:Lt(t.fields),capture:{console:V(t.capture?.console,!0),network:V(t.capture?.network,!0)},knownIssues:{enabled:V(t.knownIssues?.enabled,!0),notify:V(t.knownIssues?.notify,!0)},consent:{required:t.consent?.required===!0},privacyUrl:zt(t.privacyUrl),identifyPrefill:V(t.identifyPrefill,!0)}}function zt(e){let t=typeof e==`string`?e.trim():``;try{return t.length<=500&&new URL(t).protocol===`https:`?t:``}catch{return``}}var Bt=/^#[0-9a-fA-F]{6}$/,Vt=e=>typeof e==`string`&&Bt.test(e)?e:null;function Ht(e){let t=e&&typeof e==`object`?e:{},n=typeof t.logoUrl==`string`&&/^https?:\/\//i.test(t.logoUrl)?t.logoUrl.slice(0,2e3):null;return{poweredBy:t.poweredBy===!0,logoUrl:n,primary:Vt(t.primary),accent:Vt(t.accent)}}var Ut=e=>typeof e==`number`&&Number.isFinite(e)?Math.min(1,Math.max(0,e)):0;function Wt(e,t){let n=e&&typeof e==`object`?e:{},r=typeof t==`number`?Ut(t):1,i=Array.isArray(n.fixChecks)?n.fixChecks:[];return{followUp:n.followUp===!0,autoBlur:n.autoBlur===!0,replay:n.replay===!0,replaySampleRate:Math.min(n.replaySampleRate===void 0?1:Ut(n.replaySampleRate),r),replayMask:n.replayMask===`inputs`?`inputs`:`all`,fixChecks:i.filter(e=>!!e&&typeof e.id==`string`&&typeof e.path==`string`&&typeof e.signature==`string`),watches:Gt(n.watches),fixCheckSampleRate:Math.min(Ut(n.fixCheckSampleRate),r)}}function Gt(e){return(Array.isArray(e)?e:[]).filter(e=>!!e&&typeof e.id==`string`&&typeof e.signature==`string`).slice(0,50)}function Kt(e,t){if(!Array.isArray(e)||t?.enabled===!1)return[];let n=[];for(let t of e){if(!t||typeof t!=`object`)continue;let e=t,r=typeof e.id==`string`?e.id.slice(0,64):``,i=B(e.title,120);if(r&&i&&(n.push({id:r,title:i,paths:(Array.isArray(e.paths)?e.paths:[]).filter(e=>typeof e==`string`&&e[0]===`/`).slice(0,10),signature:typeof e.signature==`string`&&e.signature?e.signature:null}),n.length>=20))break}return n}function qt(e){let t=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(e.trim());if(!t)return null;let n=t[1];n.length===3&&(n=[...n].map(e=>e+e).join(``));let[r,i,a]=[0,2,4].map(e=>{let t=Number.parseInt(n.slice(e,e+2),16)/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*r+.7152*i+.0722*a}function Jt(e,t){let[n,r]=e>t?[e,t]:[t,e];return(n+.05)/(r+.05)}function Yt(e){let t=qt(e);return t===null?`#FFFFFF`:Jt(t,qt(`#0B1300`))>=Jt(t,1)?`#0B1300`:`#FFFFFF`}function Xt(e,t=`#B8F35C`){return typeof e==`string`&&qt(e)!==null?e.trim():t}function H(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))n!=null&&n!==!1&&r.setAttribute(e,n===!0?``:String(n));for(let e of n)e!=null&&e!==!1&&r.append(e);return r}var Zt=`http://www.w3.org/2000/svg`;function U(e,t=16){let n=document.createElementNS(Zt,`svg`);n.setAttribute(`width`,String(t)),n.setAttribute(`height`,String(t)),n.setAttribute(`viewBox`,`0 0 24 24`),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke`,`currentColor`),n.setAttribute(`stroke-width`,`2.2`),n.setAttribute(`stroke-linecap`,`round`),n.setAttribute(`stroke-linejoin`,`round`),n.setAttribute(`aria-hidden`,`true`);let r=document.createElementNS(Zt,`path`);return r.setAttribute(`d`,e),n.append(r),n}var W={close:`M18 6L6 18M6 6l12 12`,back:`M15 18l-6-6 6-6`,pen:`M12 20h9M16.5 3.5a2.1 2.1 0 013 3L7 19l-4 1 1-4z`,camera:`M23 19a2 2 0 01-2 2H3a2 2 0 01-2-2V8a2 2 0 012-2h4l2-3h6l2 3h4a2 2 0 012 2zM12 17a4 4 0 100-8 4 4 0 000 8z`,trash:`M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6`},Qt=`
4
+ $ .panel, $.pos-bottom-right .panel, $.pos-bottom-left .panel, $.pos-right-edge .panel { left: 0; right: 0; bottom: 0; width: 100%; max-width: none; max-height: 88vh; border-radius: 16px 16px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); }
5
+ $.open .launcher { display: none; }
6
+ $ .field textarea, $ .field input, $ .field select { font-size: 16px; }
7
+ $ .launcher { padding: 11px 16px; font-size: 14px; }
8
+ $.pos-bottom-right .launcher { right: 16px; bottom: 16px; }
9
+ $.pos-bottom-left .launcher { left: 16px; bottom: 16px; }
10
+ $.small .launcher { padding: 8px 12px; font-size: 13px; box-shadow: 0 8px 20px -6px rgba(0,0,0,0.35); }
11
+ $.small.pos-bottom-right .launcher { right: 12px; bottom: 12px; }
12
+ $.small.pos-bottom-left .launcher { left: 12px; bottom: 12px; }
13
+ $.small.pos-right-edge .launcher { padding: 8px 10px; }
14
+ `;function $t(e,t){let n=Qt.replace(/\$/g,t);return e?`${e}${n}}`:n}var en=`
15
+ :host { all: initial; }
16
+ * { box-sizing: border-box; }
17
+ .pnx { font-family: Manrope, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #111827; font-size: 14px; line-height: 1.4; -webkit-font-smoothing: antialiased; }
18
+ button { font: inherit; color: inherit; cursor: pointer; }
19
+ button:disabled { cursor: default; }
20
+ :focus-visible { outline: 3px solid #2E46BF; outline-offset: 2px; }
21
+ .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
22
+
23
+ .launcher { position: fixed; z-index: 2; border: 0; padding: 13px 20px; border-radius: 999px; font-weight: 700; font-size: 15px; line-height: 1.2; box-shadow: 0 12px 30px -8px rgba(0,0,0,0.35); background: var(--pnx-brand); color: var(--pnx-ink); transition: transform .15s ease; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
24
+ .launcher:hover { transform: translateY(-1px); }
25
+ .pos-bottom-right .launcher { right: 24px; bottom: 24px; }
26
+ .pos-bottom-left .launcher { left: 24px; bottom: 24px; }
27
+ .pos-right-edge .launcher { right: 0; top: 45%; border-radius: 10px 0 0 10px; }
28
+ .pos-right-edge .launcher:hover { transform: translateX(-2px); }
29
+ .pos-right-edge.open .launcher { visibility: hidden; }
30
+ .launcher[hidden] { display: none; }
31
+
32
+ .panel { position: fixed; z-index: 3; bottom: 84px; width: 300px; max-width: calc(100vw - 32px); max-height: calc(100vh - 108px); overflow: auto; padding: 18px; border-radius: 16px; background: #FFFFFF; color: #111827; box-shadow: 0 30px 60px -18px rgba(0,0,0,0.45), 0 0 0 1px rgba(17,24,39,0.06); display: flex; flex-direction: column; gap: 12px; }
33
+ .panel[hidden] { display: none; }
34
+ .pos-bottom-right .panel { right: 24px; }
35
+ .pos-bottom-left .panel { left: 24px; }
36
+ .pos-right-edge .panel { right: 24px; bottom: 24px; max-height: calc(100vh - 48px); }
37
+ .no-button .panel { bottom: 24px; max-height: calc(100vh - 48px); }
38
+
39
+ .head { display: flex; align-items: center; gap: 8px; }
40
+ .title { margin: 0; flex: 1; font-size: 15px; font-weight: 700; }
41
+ .icon-btn { flex: none; width: 32px; height: 32px; margin: -6px; border: 0; border-radius: 8px; background: transparent; color: #5B6474; display: inline-flex; align-items: center; justify-content: center; }
42
+ .icon-btn:hover { background: #F2F4F8; color: #111827; }
43
+ .head .icon-btn:first-child { margin-right: 0; }
44
+
45
+ .choices { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
46
+ .choice { width: 100%; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 10px; background: #F2F4F8; font-size: 14px; font-weight: 600; text-align: left; }
47
+ .choice:hover { background: #FFF1EC; box-shadow: inset 0 0 0 2px var(--dot); }
48
+ .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--dot); }
49
+ .choice small { display: block; font-size: 12px; font-weight: 500; color: #5B6474; }
50
+
51
+ .shot { position: relative; border-radius: 10px; background: #F4EDE2; overflow: hidden; min-height: 72px; display: flex; align-items: center; justify-content: center; }
52
+ .shot img { display: block; width: 100%; height: auto; max-height: 160px; object-fit: contain; background: #F2F4F8; }
53
+ .shot .tag { position: absolute; right: 8px; top: 8px; padding: 3px 7px; border-radius: 6px; background: #111827; color: #FFFFFF; font-size: 11px; font-weight: 700; }
54
+ .shot .wait { font-size: 13px; color: #5B6474; padding: 20px; }
55
+ .shot-actions { display: flex; gap: 8px; flex-wrap: wrap; }
56
+ .chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 7px 11px; border: 0; border-radius: 8px; background: #F2F4F8; color: #111827; font-size: 13px; font-weight: 700; }
57
+ .chip:hover { background: #E3E8F0; }
58
+ .chip.primary { background: #111827; color: #FFFFFF; }
59
+ .chip.primary:hover { background: #1F2937; }
60
+
61
+ .field { display: flex; flex-direction: column; gap: 6px; }
62
+ .field label, .legend { font-size: 12px; font-weight: 600; color: #5B6474; }
63
+ .field textarea, .field input { width: 100%; border: 0; border-radius: 10px; padding: 11px 12px; background: #F2F4F8; color: #111827; font: inherit; font-size: 14px; line-height: 1.5; box-shadow: inset 0 0 0 1px transparent; }
64
+ .field textarea { min-height: 84px; resize: vertical; }
65
+ .field textarea::placeholder, .field input::placeholder { color: #5B6474; opacity: 1; }
66
+ .field textarea:focus, .field input:focus { outline: none; box-shadow: inset 0 0 0 2px #2E46BF; background: #FFFFFF; }
67
+ .field .hint { font-size: 12px; color: #5B6474; }
68
+ .field select { width: 100%; border: 0; border-radius: 10px; padding: 11px 12px; background: #F2F4F8; color: #111827; font: inherit; font-size: 14px; line-height: 1.5; }
69
+ .field select:focus { outline: none; box-shadow: inset 0 0 0 2px #2E46BF; background: #FFFFFF; }
70
+ .field [aria-invalid="true"] { box-shadow: inset 0 0 0 2px #B42318; }
71
+ .field .optional { font-weight: 500; }
72
+ .field.check { flex-direction: row; align-items: flex-start; gap: 10px; }
73
+ .field.check input { flex: none; width: 20px; height: 20px; margin: 0; padding: 0; accent-color: #2E46BF; box-shadow: none; }
74
+ .field.check label { font-size: 13px; color: #111827; font-weight: 600; line-height: 1.45; }
75
+ .field.check input[aria-invalid="true"] { outline: 2px solid #B42318; outline-offset: 2px; }
76
+ .a11y-note { margin: 0; font-size: 13px; line-height: 1.45; color: #374151; }
77
+ fieldset.barriers { border: 0; margin: 0; padding: 0; min-width: 0; gap: 2px; }
78
+ fieldset.barriers legend { padding: 0; margin-bottom: 4px; }
79
+ .radio { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 8px; border-radius: 8px; }
80
+ .radio:hover { background: #F2F4F8; }
81
+ .field .radio input, .field .radio input:focus { flex: none; width: 20px; height: 20px; margin: 0; padding: 0; border-radius: 50%; background: none; accent-color: #0F766E; box-shadow: none; }
82
+ .radio input:focus-visible { outline: 2px solid #2E46BF; outline-offset: 2px; }
83
+ .radio label { flex: 1; font-size: 14px; color: #111827; font-weight: 500; line-height: 1.35; padding: 8px 0; cursor: pointer; }
84
+ .brand { display: flex; align-items: center; min-height: 28px; }
85
+ .brand .logo { display: block; max-height: 32px; max-width: 160px; width: auto; height: auto; object-fit: contain; }
86
+ .accented .panel { border-top: 4px solid var(--pnx-accent); }
87
+ .accented .choice:hover { box-shadow: inset 0 0 0 2px var(--pnx-accent); }
88
+ .accented .tick { background: var(--pnx-accent); color: var(--pnx-accent-ink); }
89
+
90
+ .stars { display: flex; gap: 4px; border: 0; margin: 0; padding: 0; }
91
+ .star { width: 40px; height: 40px; border: 0; border-radius: 10px; font-size: 24px; line-height: 1; background: #F2F4F8; color: #6B7280; }
92
+ .star.on { background: #FFF6DF; color: #B9800F; }
93
+
94
+ .error { margin: 0; font-size: 13px; color: #B42318; font-weight: 600; }
95
+ .error:empty { display: none; }
96
+ .send { width: 100%; padding: 12px; border: 0; border-radius: 10px; font-size: 14px; font-weight: 800; background: var(--type); color: var(--type-ink); }
97
+ .send:disabled { opacity: .7; }
98
+ .powered { font-size: 11px; color: #5B6474; text-align: center; }
99
+ .powered a { color: inherit; text-decoration: none; }
100
+ .powered a:hover { text-decoration: underline; }
101
+
102
+ .done { text-align: center; padding: 18px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
103
+ .tick { width: 46px; height: 46px; border-radius: 50%; background: #B8F35C; color: #0B1300; font-size: 22px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
104
+ .done p { margin: 0; font-size: 13px; color: #5B6474; }
105
+ .link { border: 0; background: transparent; color: #5B6474; font-size: 13px; font-weight: 700; padding: 6px 8px; border-radius: 6px; }
106
+ .link:hover { color: #111827; }
107
+
108
+ .note { display: flex; align-items: baseline; gap: 8px; padding: 10px 12px; border-radius: 10px; background: #F2F4F8; color: #5B6474; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
109
+ .note .dot { transform: translateY(-1px); }
110
+ .field label.question { font-size: 14px; font-weight: 700; color: #111827; line-height: 1.4; }
111
+ .field textarea.answer { min-height: 64px; }
112
+ .skip { width: 100%; padding: 8px; text-align: center; }
113
+ .skip:disabled, .send:disabled + .skip { opacity: .7; }
114
+
115
+ .known { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
116
+ .known > li { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; border-radius: 10px; background: #F2F4F8; }
117
+ .known-title { margin: 0; font-size: 14px; font-weight: 700; color: #111827; overflow-wrap: anywhere; }
118
+ .known-thanks { margin: 0; font-size: 13px; font-weight: 600; color: #374151; }
119
+ .known .field { align-self: stretch; }
120
+ .known .field input { background: #FFFFFF; box-shadow: inset 0 0 0 1px #6B7280; }
121
+ .known .field input:focus { box-shadow: inset 0 0 0 2px #2E46BF; }
122
+ .known .field [aria-invalid="true"] { box-shadow: inset 0 0 0 2px #B42318; }
123
+ .subtitle { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: #5B6474; }
124
+ .privacy { display: flex; flex-direction: column; gap: 10px; }
125
+ .notice { margin: 0; font-size: 12px; line-height: 1.45; color: #5B6474; overflow-wrap: anywhere; }
126
+ .notice a { color: #2E46BF; font-weight: 700; text-decoration: underline; }
127
+ .notice a:hover { color: #111827; }
128
+ .hint.auto-blur { display: flex; align-items: center; gap: 6px; }
129
+ .hint.auto-blur i { flex: none; width: 16px; height: 10px; border-radius: 3px; background: repeating-linear-gradient(90deg, #D8DEE9 0 4px, #C7CFDC 4px 8px); box-shadow: 0 0 0 1px #C7CFDC; }
130
+
131
+ ${$t(`@media (max-width: 520px) {`,`.pnx`)}
132
+ @media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
133
+ @media (forced-colors: active) { .launcher, .choice, .send, .chip, .star { border: 1px solid ButtonText; } .known > li { border: 1px solid CanvasText; } }
134
+ `,tn=[{type:`PROBLEM`,key:`problem`,label:`Report a problem`,desc:`Point at what is broken`,dot:`#FF5C35`,send:`#CC3F1B`,ink:`#FFFFFF`},{type:`IDEA`,key:`idea`,label:`Share an idea`,desc:`Suggest something better`,dot:`#7C9CFF`,send:`#7C9CFF`,ink:`#0B1122`},{type:`GENERAL`,key:`general`,label:`General feedback`,desc:`A rating and a few words`,dot:`#3DBF6E`,send:`#3DBF6E`,ink:`#0B1300`},{type:`ACCESSIBILITY`,key:`accessibility`,label:`Report an accessibility barrier`,desc:`Something you can't see, reach or use`,dot:`#2FB8AC`,send:`#0F766E`,ink:`#FFFFFF`}],nn=[[`see`,`Hard to see or read`],[`keyboard`,`Can't use it with a keyboard`],[`screen-reader`,`Doesn't work with my screen reader`],[`media`,`Video or audio`],[`other`,`Something else`]],rn=4e3,an=`What would you like to do?`,on=`Thanks! We've got it.`,sn={problem:`problemTitle`,idea:`ideaTitle`,general:`generalTitle`,accessibility:`accessibilityTitle`},cn=class{constructor(e,t,n,r={}){this.root=e,this.config=t,this.handlers=n,this.kind=null,this.shot={kind:`none`},this.message=``,this.email=``,this.emailEdited=!1,this.answers={},this.sendColour=null,this.sending=!1,this.openedAt=0,this.hp=``,this.uid=Math.random().toString(36).slice(2,8),this.pathHidden=!1,this.returnFocus=null,this.known=[],this.knownHidden=new Set,this.meToo={},this.includeLogs=!1,this.privacy=null,this.noticeText=null,this.shown={logs:!0,askLogs:!1,replay:!1},this.view=`choose`,this.queued=!1,this.asked=null,this.answer=``;let i=t.settings,a=t.branding?.primary?Xt(t.branding.primary,``):``,o=t.branding?.accent?Xt(t.branding.accent,``):``,s=a||Xt(i.color);this.sendColour=a||null;let c=e=>e.key===`accessibility`?i.types?.accessibility===!0:i.types?.[e.key]!==!1;this.kinds=tn.filter(c),this.kinds.length||(this.kinds=tn.slice(0,3));let l=H(`style`);l.textContent=r.css?en+r.css:en,this.launcher=H(`button`,{type:`button`,class:`launcher`,"aria-haspopup":`dialog`,"aria-expanded":`false`,"aria-controls":`pnx-panel-${this.uid}`},(i.text||`Feedback`).slice(0,40)),this.launcher.addEventListener(`click`,()=>this.isOpen()?this.close():this.open()),this.panel=H(`div`,{class:`panel`,id:`pnx-panel-${this.uid}`,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`pnx-title-${this.uid}`,hidden:!0}),this.panel.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.stopPropagation(),this.close())}),this.panel.addEventListener(`pointerdown`,()=>this.holdOpen()),this.panel.addEventListener(`focusin`,()=>this.holdOpen()),this.live=H(`div`,{class:`sr`,role:`status`,"aria-live":`polite`});let u=[`bottom-right`,`bottom-left`,`right-edge`].includes(i.position)?i.position:`bottom-right`;this.wrap=H(`div`,{class:`pnx pos-${u}${r.className?` ${r.className}`:``}`}),i.smallOnMobile&&this.wrap.classList.add(`small`),this.updateButton(),this.wrap.style.setProperty(`--pnx-brand`,s),this.wrap.style.setProperty(`--pnx-ink`,Yt(s)),o&&(this.wrap.classList.add(`accented`),this.wrap.style.setProperty(`--pnx-accent`,o),this.wrap.style.setProperty(`--pnx-accent-ink`,Yt(o))),this.wrap.append(this.launcher,this.panel,this.live),e.append(l,this.wrap)}isOpen(){return!this.panel.hidden}hasButton(){return!this.launcher.hidden}setPathHidden(e){this.pathHidden=e,this.updateButton()}updateButton(){let e=this.config.settings.hideButton||this.pathHidden;this.launcher.hidden=e,this.wrap.classList.toggle(`no-button`,e)}open(e=!0){if(this.isOpen()){e&&this.focusFirst();return}let t=document.activeElement;this.returnFocus=t instanceof HTMLElement&&t!==this.root.host?t:null,this.openedAt||(this.openedAt=Date.now()),(this.view===`choose`||this.kinds.length===1&&this.view===`form`&&!this.message.trim())&&this.offerKnown(),this.panel.hidden=!1,this.wrap.classList.add(`open`),this.launcher.setAttribute(`aria-expanded`,`true`),!this.kind&&this.kinds.length===1&&!this.knownShown().length&&this.pick(this.kinds[0],!1),this.render(),e&&this.focusFirst();try{this.handlers.opened?.()}catch{}}close(e=!0){clearTimeout(this.closeTimer),this.isOpen()&&(this.panel.hidden=!0,this.wrap.classList.remove(`open`),this.launcher.setAttribute(`aria-expanded`,`false`),this.view===`done`&&this.reset(),e&&(this.hasButton()?this.launcher.focus():this.returnFocus?.isConnected&&this.returnFocus.focus(),this.returnFocus=null))}currentView(){return this.isOpen()?this.view===`done`?`done`:(this.view===`form`||this.view===`question`)&&this.kind?this.kind.key:`choose`:`button`}showView(e){if(clearTimeout(this.closeTimer),e===`button`)this.close(!1);else{if(this.reset(),this.knownHidden.clear(),this.meToo={},e===`choose`&&this.offerKnown(),e===`done`)this.view=`done`;else if(e!==`choose`){let t=this.kinds.find(t=>t.key===e);t&&this.pick(t,!1)}this.isOpen()?this.render():this.open(!1)}}word(e,t){return this.config.settings.wording?.[e]?.trim()||t}kindTitle(e,t=e.label){return this.word(sn[e.key],t)}setSuspended(e){this.wrap.style.display=e?`none`:``}destroy(){clearTimeout(this.closeTimer),this.wrap.remove()}reset(){this.view=`choose`,this.kind=null,this.shot={kind:`none`},this.message=``,this.rating=void 0,this.barrier=void 0,this.answers={},this.includeLogs=!1,this.queued=!1,this.asked=null,this.answer=``,this.openedAt=this.isOpen()?Date.now():0,this.hp=``,this.kinds.length===1&&this.pick(this.kinds[0],!1)}holdOpen(){clearTimeout(this.closeTimer)}focusFirst(){for(let e of[`[data-autofocus]`,`.choice`,`textarea`,`button`]){let t=this.panel.querySelector(e);if(t){t.focus();return}}}announce(e){this.live.textContent=``,setTimeout(()=>{this.live.textContent=e},30)}pick(e,t=!0){this.kind=e,this.view=`form`,this.rating=void 0,!this.email&&!this.emailEdited&&this.config.settings.identifyPrefill!==!1&&(this.email=this.handlers.user()?.email||``),e.type===`PROBLEM`&&this.shot.kind===`none`&&this.capture(),e.type!==`PROBLEM`&&this.shot.kind===`busy`&&(this.shot={kind:`none`}),t&&(this.render(),this.focusFirst())}async capture(){this.shot={kind:`busy`},this.render();try{let e=await this.handlers.takeScreenshot();if(this.shot.kind!==`busy`)return;this.shot={kind:`ready`,shot:e},this.announce(`Screenshot added.`)}catch{if(this.shot.kind!==`busy`)return;this.shot={kind:`failed`},this.announce(`Couldn't take a screenshot.`)}this.renderKeepingFocus()}async markUp(){if(this.shot.kind===`ready`){this.setSuspended(!0);try{let e=await this.handlers.markUp(this.shot.shot);e&&(this.shot={kind:`ready`,shot:e},this.announce(e.annotations.length?`Screenshot marked up with ${e.annotations.length} ${e.annotations.length===1?`mark`:`marks`}.`:`Screenshot updated.`))}catch{}finally{this.setSuspended(!1),this.render(),this.panel.querySelector(`[data-markup]`)?.focus()}}}renderKeepingFocus(){let e=this.root.activeElement,t=e?.dataset?.key,n=e?.tagName===`TEXTAREA`?[e.selectionStart,e.selectionEnd]:null;if(this.render(),t){let e=this.panel.querySelector(`[data-key="${t}"]`);e?.focus(),n&&e instanceof HTMLTextAreaElement&&e.setSelectionRange(n[0],n[1])}}header(e,t,n){let r=H(`div`,{class:`head`});if(t){let e=H(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Back`,"data-key":`back`});e.append(U(W.back)),e.addEventListener(`click`,()=>{n?n():(this.view=`choose`,this.kind=null,this.render(),this.focusFirst())}),r.append(e)}r.append(H(`h2`,{class:`title`,id:`pnx-title-${this.uid}`},e));let i=H(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close feedback`,"data-key":`close`});return i.append(U(W.close)),i.addEventListener(`click`,()=>this.close()),r.append(i),r}powered(){return this.config.branding?.poweredBy?H(`div`,{class:`powered`},H(`a`,{href:`https://getpinax.com`,target:`_blank`,rel:`noopener`},`Powered by Pinax`)):null}logo(){let e=this.config.branding?.logoUrl;if(!e||!/^https?:\/\//i.test(e))return null;let t=H(`img`,{src:e,alt:``,class:`logo`,referrerpolicy:`no-referrer`});return t.addEventListener(`error`,()=>t.remove()),H(`div`,{class:`brand`},t)}render(){let e=[],t=this.logo();t&&e.push(t),this.view===`done`?e.push(...this.renderDone()):this.view===`question`&&this.kind&&this.asked?.question?e.push(...this.renderQuestion(this.kind,this.asked.question)):this.view===`form`&&this.kind?e.push(...this.renderForm(this.kind)):e.push(...this.renderChoose());let n=this.powered();n&&e.push(n),this.panel.replaceChildren(...e)}renderChoose(){let e=this.knownShown(),t=this.word(`chooserTitle`,an),n=H(`ul`,{class:`choices`});for(let e of this.kinds){let t=H(`button`,{type:`button`,class:`choice`},H(`span`,{class:`dot`,"aria-hidden":`true`}),H(`span`,{},this.kindTitle(e),H(`small`,{},e.desc)));t.style.setProperty(`--dot`,e.dot),t.addEventListener(`click`,()=>this.pick(e)),n.append(H(`li`,{},t))}return e.length?[this.header(`We know about this`,!1),...this.renderKnown(e),H(`h3`,{class:`subtitle`},t),n]:[this.header(t,!1),n]}knownShown(){return this.config.settings.knownIssues?.enabled===!1?[]:this.known.filter(e=>!this.knownHidden.has(e.id))}offerKnown(){try{this.known=this.handlers.knownIssues?.().slice(0,3)??[]}catch{this.known=[]}this.knownShown().length&&(this.view=`choose`,this.kind=null)}renderKnown(e){let t=this.config.settings.knownIssues?.notify!==!1,n=H(`ul`,{class:`known`}),r=!0;e.forEach((e,i)=>{let a=this.meToo[e.id],o=`pnx-k${i}-${this.uid}`,s=H(`p`,{class:`error`,role:`alert`,id:`pnx-k${i}-err-${this.uid}`}),c=H(`li`,{},H(`p`,{class:`known-title`,id:o},e.title));if(!a||a===`busy`){let t=H(`button`,{type:`button`,class:`chip primary`,"aria-describedby":o,"data-key":`metoo-${i}`,"data-autofocus":r||void 0,disabled:a===`busy`},`Me too`);r=!1,t.addEventListener(`click`,()=>this.sendMeToo(e,i,s)),c.append(t,s)}else if(a===`emailed`||!t)c.append(H(`p`,{class:`known-thanks`},a===`emailed`?`Thanks. We'll email you when it's fixed.`:`Thanks, we've added you.`));else{let t=`pnx-k${i}-email-${this.uid}`,n=`${t}-hint`,r=H(`input`,{id:t,type:`email`,inputmode:`email`,autocomplete:`email`,maxlength:254,"aria-describedby":n,"data-key":`known-email-${i}`,placeholder:`you@example.com`});r.value=this.email,r.addEventListener(`input`,()=>{this.email=r.value,this.emailEdited=!0});let o=H(`button`,{type:`button`,class:`chip primary`,"data-key":`known-send-${i}`,disabled:a===`sending`},a===`sending`?`Sending…`:`Send`);o.addEventListener(`click`,()=>this.sendMeToo(e,i,s,r)),c.append(H(`p`,{class:`known-thanks`},`Thanks, we've added you.`),H(`div`,{class:`field`},H(`label`,{for:t},`Email me when it's fixed`),r,H(`span`,{class:`hint`,id:n},`Only used to tell you when it's fixed.`)),s,o)}n.append(c)});let i=H(`button`,{type:`button`,class:`link`,"data-key":`known-else`},`Report something else`);return i.addEventListener(`click`,()=>{for(let t of e)this.knownHidden.add(t.id);this.kinds.length===1?this.pick(this.kinds[0]):(this.render(),this.panel.querySelector(`.choice`)?.focus())}),[n,i]}async sendMeToo(e,t,n,r){let i=this.meToo[e.id];if(i===`busy`||i===`sending`)return;n.textContent=``;let a=r?this.email.trim():void 0;if(r&&(!a||!g(a))){n.textContent=`Please check your email address.`,r.setAttribute(`aria-invalid`,`true`),r.setAttribute(`aria-errormessage`,n.id),r.focus();return}this.meToo[e.id]=r?`sending`:`busy`,this.renderKeepingFocus();let o=!1;try{o=await this.handlers.meToo?.(e.id,a)??!1}catch{o=!1}if(o||r?this.meToo[e.id]=o&&r?`emailed`:`done`:delete this.meToo[e.id],!this.isOpen()||this.view!==`choose`)return;this.render();let s=e=>this.panel.querySelector(`[data-key="${e}"]`);if(o)(s(`known-email-${t}`)??s(`known-else`))?.focus(),this.announce(r?`Thanks. We'll email you when it's fixed.`:`Thanks, we've added you.`);else{let e=this.panel.querySelector(`#pnx-k${t}-err-${this.uid}`);e&&(e.textContent=`Something went wrong. Please try again.`),s(r?`known-send-${t}`:`metoo-${t}`)?.focus()}}renderShot(e){let t=this.shot;if(t.kind===`none`){if(e.type===`GENERAL`)return null;let t=H(`button`,{type:`button`,class:`chip`,"data-key":`add-shot`},U(W.camera),`Add a screenshot`);return t.addEventListener(`click`,()=>this.capture()),H(`div`,{class:`shot-actions`},t)}if(t.kind===`busy`)return H(`div`,{class:`shot`,"aria-busy":`true`},H(`span`,{class:`wait`},`Taking a screenshot…`));if(t.kind===`failed`){let e=H(`button`,{type:`button`,class:`chip`,"data-key":`retry-shot`},`Try again`);return e.addEventListener(`click`,()=>this.capture()),H(`div`,{class:`field`},H(`span`,{class:`hint`},`Couldn't take a screenshot of this page.`),H(`div`,{class:`shot-actions`},e))}let n=t.shot.annotations.length,r=t.shot.autoBlurred??0,i=H(`img`,{src:t.shot.dataUrl,alt:`Screenshot of this page${n?` with ${n} ${n===1?`mark`:`marks`}`:``}${r?`, ${r} private ${r===1?`detail`:`details`} blurred`:``}`}),a=H(`button`,{type:`button`,class:`chip primary`,"data-markup":!0,"data-key":`markup`},U(W.pen),n?`Edit marks`:`Mark up`);a.addEventListener(`click`,()=>this.markUp());let o=H(`button`,{type:`button`,class:`chip`,"data-key":`remove-shot`},U(W.trash),`Remove`,H(`span`,{class:`sr`},` screenshot`));return o.addEventListener(`click`,()=>{this.shot={kind:`none`},this.announce(`Screenshot removed.`),this.render(),this.panel.querySelector(`[data-key="add-shot"]`)?.focus()}),H(`div`,{class:`field`},H(`div`,{class:`shot`},i,H(`span`,{class:`tag`,"aria-hidden":`true`},`Screenshot`)),H(`div`,{class:`shot-actions`},a,o),r?H(`span`,{class:`hint auto-blur`},H(`i`,{"aria-hidden":`true`}),`We blurred ${r===1?`1 private detail`:`${r} private details`} for you.`):null)}renderStars(){let e=H(`div`,{class:`stars`,role:`radiogroup`,"aria-labelledby":`pnx-rate-${this.uid}`}),t=[],n=(this.rating??1)-1;for(let e=1;e<=5;e++){let r=H(`button`,{type:`button`,class:this.rating!==void 0&&e<=this.rating?`star on`:`star`,role:`radio`,"aria-checked":this.rating===e?`true`:`false`,"aria-label":`${e} ${e===1?`star`:`stars`}`,tabindex:e-1===n?0:-1,"data-key":`star-${e}`},`★`);r.addEventListener(`click`,()=>{this.rating=this.rating===e?void 0:e,this.renderKeepingFocus()}),r.addEventListener(`keydown`,e=>{let t=e.key===`ArrowRight`||e.key===`ArrowUp`?1:e.key===`ArrowLeft`||e.key===`ArrowDown`?-1:0;if(!t)return;e.preventDefault();let n=Math.min(5,Math.max(1,(this.rating??0)+t||1));this.rating=n,this.render(),this.panel.querySelector(`[data-key="star-${n}"]`)?.focus()}),t.push(r)}return e.append(...t),H(`div`,{class:`field`},H(`span`,{class:`legend`,id:`pnx-rate-${this.uid}`},`How's your visit so far? (optional)`),e)}renderForm(e){if(e.type===`ACCESSIBILITY`)return this.renderAccessibility(e);let t=e.type===`GENERAL`&&this.config.settings.rating!==!1,n=this.kindTitle(e,t?`How was your visit?`:e.label),r=[this.header(n,this.kinds.length>1)],i=this.renderShot(e);i&&r.push(i),t&&r.push(this.renderStars());let a=`pnx-msg-${this.uid}`,o=H(`textarea`,{id:a,maxlength:5e3,"data-key":`message`,"data-autofocus":e.type!==`PROBLEM`&&!t||void 0,placeholder:this.word(`messagePlaceholder`,e.type===`PROBLEM`?`What happened?`:e.type===`IDEA`?`What would make this better?`:`Tell us what you think`)});return o.value=this.message,o.addEventListener(`input`,()=>{this.message=o.value}),r.push(H(`div`,{class:`field`},H(`label`,{for:a},e.type===`PROBLEM`?`What went wrong?`:e.type===`IDEA`?`Your idea`:`Anything to add?`),o)),r.push(...this.renderFields(e)),r.push(...this.renderEmailAndSend(e,o,e.type===`PROBLEM`?`Only used to tell you about this report.`:`Only used to reply to you about this.`)),r}renderEmailAndSend(e,t,n){let r=[],i=`pnx-email-${this.uid}`,a=`pnx-email-hint-${this.uid}`,o=H(`input`,{id:i,type:`email`,inputmode:`email`,autocomplete:`email`,maxlength:320,"aria-describedby":a,"data-key":`email`,placeholder:`you@example.com`});o.value=this.email,o.addEventListener(`input`,()=>{this.email=o.value,this.emailEdited=!0}),r.push(H(`div`,{class:`field`},H(`label`,{for:i},`Your email (optional)`),o,H(`span`,{class:`hint`,id:a},n)));let s=H(`p`,{class:`error`,role:`alert`,id:`pnx-err-${this.uid}`}),c=H(`button`,{type:`button`,class:`send`,"data-key":`send`,"aria-describedby":`pnx-notice-${this.uid}`,disabled:this.sending},this.sending?`Sending…`:`Send`);return this.colourSend(c,e),c.addEventListener(`click`,()=>this.send(e,s,o,t)),r.push(this.renderPrivacy(),this.honeypot(),s,c),r}attachments(){try{return this.handlers.attachments?.()??{logs:!0,askLogs:!1,replay:!1}}catch{return{logs:!1,askLogs:!1,replay:!1}}}renderPrivacy(){let e=this.attachments();this.shown=e;let t=H(`div`,{class:`privacy`});if(e.askLogs){let e=`pnx-logs-${this.uid}`,n=H(`input`,{id:e,type:`checkbox`,"data-key":`include-logs`});n.checked=this.includeLogs,n.addEventListener(`change`,()=>{this.includeLogs=n.checked,this.updateNotice()}),t.append(H(`div`,{class:`field check`},n,H(`label`,{for:e},`Include technical details (console messages and failed requests) to help fix this`)))}this.noticeText=H(`span`,{});let n=H(`p`,{class:`notice`,id:`pnx-notice-${this.uid}`},this.noticeText),r=this.config.settings.privacyUrl;return r&&/^https:\/\//i.test(r)&&n.append(` `,H(`a`,{href:r,target:`_blank`,rel:`noopener noreferrer`},`Privacy policy`,H(`span`,{class:`sr`},` (opens in a new tab)`))),t.append(n),this.privacy=t,this.updateNotice(),t}updateNotice(){if(!this.noticeText)return;let e=this.shown,t=[`the page address`,`your browser details`];this.shot.kind===`ready`&&t.push(`the screenshot`),(e.logs||e.askLogs&&this.includeLogs)&&t.push(`technical logs`),e.replay&&t.push(`a recording of the last 30 seconds`);let n=``;try{n=this.handlers.site?.()??``}catch{}n=n||location.hostname.replace(/^www\./,``)||`this website`,this.noticeText.textContent=`Sent to ${n} with your note: ${t.join(`, `)}.`}refresh(){let e=this.privacy;if(!e?.isConnected)return;let t=this.attachments();if(t.askLogs===this.shown.askLogs){this.shown=t,this.updateNotice();return}let n=e.contains(this.root.activeElement),r=this.renderPrivacy();e.replaceWith(r),n&&(r.querySelector(`input`)??this.panel.querySelector(`[data-key="send"]`))?.focus()}renderAccessibility(e){let t=[this.header(this.kindTitle(e),this.kinds.length>1)],n=`pnx-a11y-note-${this.uid}`;t.push(H(`p`,{class:`a11y-note`,id:n},`We'll pass this to the team that runs this website. We also check this page for common accessibility problems and send the results with it.`));let r=`pnx-barrier-${this.uid}`,i=H(`fieldset`,{class:`field barriers`,"aria-labelledby":r,"aria-describedby":n},H(`legend`,{class:`legend`,id:r},`What's getting in the way? `,H(`span`,{class:`optional`},`(optional)`)));nn.forEach(([e,t],n)=>{let r=`pnx-b${n}-${this.uid}`,a=H(`input`,{id:r,type:`radio`,name:`pnx-barrier-${this.uid}`,value:e,"data-key":`barrier-${e}`,"data-autofocus":(this.barrier?this.barrier===e:n===0)||void 0});a.checked=this.barrier===e,a.addEventListener(`change`,()=>{a.checked&&(this.barrier=e)}),i.append(H(`div`,{class:`radio`},a,H(`label`,{for:r},t)))}),t.push(i);let a=`pnx-msg-${this.uid}`,o=H(`textarea`,{id:a,maxlength:5e3,"data-key":`message`,"aria-describedby":n,placeholder:this.word(`messagePlaceholder`,`For example: I couldn't reach the Pay button with the Tab key`)});o.value=this.message,o.addEventListener(`input`,()=>{this.message=o.value}),t.push(H(`div`,{class:`field`},H(`label`,{for:a},`What were you trying to do, and what stopped you?`),o));let s=this.renderShot(e);return s&&t.push(s),t.push(...this.renderEmailAndSend(e,o,`Only used to reply to you about this.`)),t}honeypot(){let e=H(`input`,{type:`text`,name:`website`,tabindex:-1,autocomplete:`off`,"aria-label":`Leave this empty`});e.value=this.hp,e.addEventListener(`input`,()=>{this.hp=e.value});let t=H(`div`,{"aria-hidden":`true`},e);return t.style.cssText=`position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden`,t}async send(e,t,n,r){if(this.sending)return;t.textContent=``,n.removeAttribute(`aria-invalid`);let i=this.email.trim();if(i&&!g(i)){t.textContent=`Please check your email address, or leave it empty.`,n.setAttribute(`aria-invalid`,`true`),n.setAttribute(`aria-errormessage`,t.id),n.focus();return}if(this.shot.kind===`busy`){t.textContent=`One moment, the screenshot is still being taken.`;return}for(let n of this.fieldsFor(e)){let e=this.answers[n.id];if(!n.required||(n.type===`checkbox`?e===!0:e))continue;let r=this.panel.querySelector(`[data-key="field-${n.id}"]`);t.textContent=n.type===`checkbox`?`Please tick “${n.label}”.`:n.type===`select`?`Please choose an answer for “${n.label}”.`:`Please fill in “${n.label}”.`,r?.setAttribute(`aria-invalid`,`true`),r?.setAttribute(`aria-errormessage`,t.id),r?.focus();return}let a=this.shot.kind===`ready`?this.shot.shot:void 0,o=e.type===`GENERAL`?this.rating:void 0;if(!de({type:e.type,message:this.message,rating:o,screenshot:a?.dataUrl,barrier:e.type===`ACCESSIBILITY`?this.barrier:void 0})){t.textContent=e.type===`GENERAL`&&this.config.settings.rating!==!1?`Add a few words or a star rating.`:e.type===`ACCESSIBILITY`?`Choose what's in the way, or add a few words.`:`Add a few words so we know what you mean.`,r.focus();return}this.sending=!0,this.renderKeepingFocus(),this.announce(`Sending…`);let s=await this.askFollowUp(e);this.view!==`form`||this.kind!==e||!this.isOpen()?(this.sending=!1,this.isOpen()&&this.renderKeepingFocus()):s?(this.sending=!1,this.view=`question`,this.render(),this.focusFirst()):await this.submitNow(e,i,o,a)}async askFollowUp(e){let t=this.handlers.followUp,n=this.message.trim();if(!t||e.type===`GENERAL`||e.type===`ACCESSIBILITY`||!n||n.length>140)return null;if(this.asked?.message===n)return this.asked.question;let r=null;try{r=(await t({type:e.type,message:n}))?.trim()||null}catch{r=null}return this.asked={message:n,question:r?.slice(0,300)||null},this.asked.question}async submitNow(e,t,n,r,i){this.sending=!0,this.renderKeepingFocus();let a;try{a=await this.handlers.submit({type:e.type,message:this.message,rating:n,email:t||void 0,shot:r,followUp:i,fields:this.fieldAnswers(e),barrier:e.type===`ACCESSIBILITY`?this.barrier:void 0,includeLogs:this.shown.askLogs&&this.includeLogs?!0:void 0,listed:{logs:this.shown.logs||this.shown.askLogs&&this.includeLogs,replay:this.shown.replay},hp:this.hp||void 0,elapsedMs:this.openedAt?Math.max(0,Date.now()-this.openedAt):void 0})}catch{a={status:`error`,message:`Something went wrong. Please try again.`}}if(this.sending=!1,a.status===`error`){this.view=`form`,this.render();let e=this.panel.querySelector(`.error`);e&&(e.textContent=a.message),this.panel.querySelector(`[data-key="send"]`)?.focus()}else this.queued=a.status===`queued`,this.view=`done`,this.render(),this.focusFirst(),this.announce(this.queued?`Saved. We'll send it when you're back online.`:this.word(`confirmation`,on)),this.closeTimer=setTimeout(()=>this.close(this.panel.contains(this.root.activeElement)),rn)}renderQuestion(e,t){let n=[this.header(`One quick question`,!0,()=>{this.view=`form`,this.render(),this.panel.querySelector(`[data-key="message"]`)?.focus()})],r=H(`div`,{class:`note`},H(`span`,{class:`dot`,"aria-hidden":`true`}),H(`span`,{},H(`span`,{class:`sr`},`Your note: `),`“${this.message.trim()}”`));r.style.setProperty(`--dot`,e.dot),n.push(r);let i=`pnx-answer-${this.uid}`,a=`pnx-answer-hint-${this.uid}`,o=H(`textarea`,{id:i,class:`answer`,maxlength:2e3,"data-key":`answer`,"data-autofocus":!0,"aria-describedby":a,placeholder:`Your answer`});o.value=this.answer,o.addEventListener(`input`,()=>{this.answer=o.value}),n.push(H(`div`,{class:`field`},H(`label`,{for:i,class:`question`},t),o,H(`span`,{class:`hint`,id:a},`Optional. It helps us fix it faster.`)));let s=H(`p`,{class:`error`,role:`alert`}),c=this.email.trim(),l=e.type===`GENERAL`?this.rating:void 0,u=this.shot.kind===`ready`?this.shot.shot:void 0,d=H(`button`,{type:`button`,class:`send`,"data-key":`send`,disabled:this.sending},this.sending?`Sending…`:`Send`);this.colourSend(d,e),d.addEventListener(`click`,()=>{if(this.sending)return;let n=this.answer.trim();this.announce(`Sending…`),this.submitNow(e,c,l,u,n?{question:t,answer:n.slice(0,2e3)}:void 0)});let f=H(`button`,{type:`button`,class:`link skip`,"data-key":`skip`,disabled:this.sending},`Skip and send`);return f.addEventListener(`click`,()=>{this.sending||(this.announce(`Sending…`),this.submitNow(e,c,l,u))}),n.push(s,d,f),n}colourSend(e,t){let n=this.sendColour??t.send;e.style.setProperty(`--type`,n),e.style.setProperty(`--type-ink`,this.sendColour?Yt(n):t.ink)}fieldsFor(e){if(e.key===`accessibility`)return[];let t=e.key;return(this.config.settings.fields??[]).filter(e=>e.types?.[t]!==!1)}fieldAnswers(e){let t=[];for(let n of this.fieldsFor(e)){let e=this.answers[n.id];n.type===`checkbox`?t.push({id:n.id,value:e===!0}):typeof e==`string`&&e.trim()&&t.push({id:n.id,value:e.trim()})}return t.length?t:void 0}renderFields(e){return this.fieldsFor(e).map((e,t)=>{let n=`pnx-f${t}-${this.uid}`,r=`field-${e.id}`,i=e=>{e.removeAttribute(`aria-invalid`),e.removeAttribute(`aria-errormessage`)},a=t=>H(`label`,{for:n,class:t},e.label,e.required?null:H(`span`,{class:`optional`},` (optional)`));if(e.type===`checkbox`){let t=H(`input`,{id:n,type:`checkbox`,"data-key":r,"aria-required":e.required?`true`:void 0});return t.checked=this.answers[e.id]===!0,t.addEventListener(`change`,()=>{this.answers[e.id]=t.checked,i(t)}),H(`div`,{class:`field check`},t,a())}if(e.type===`select`){let t=H(`select`,{id:n,"data-key":r,"aria-required":e.required?`true`:void 0},H(`option`,{value:``},`Choose…`),...e.options.map(e=>H(`option`,{value:e},e)));return t.value=String(this.answers[e.id]??``),t.addEventListener(`change`,()=>{this.answers[e.id]=t.value,i(t)}),H(`div`,{class:`field`},a(),t)}let o=H(`input`,{id:n,type:`text`,maxlength:200,"data-key":r,"aria-required":e.required?`true`:void 0});return o.value=String(this.answers[e.id]??``),o.addEventListener(`input`,()=>{this.answers[e.id]=o.value,i(o)}),H(`div`,{class:`field`},a(),o)})}renderDone(){let e=H(`button`,{type:`button`,class:`link`,"data-key":`again`},`Send another`);e.addEventListener(`click`,()=>{this.reset(),this.render(),this.focusFirst()});let t=H(`div`,{class:`head`});t.append(H(`span`,{class:`title`}));let n=H(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close feedback`});return n.append(U(W.close)),n.addEventListener(`click`,()=>this.close()),t.append(n),[t,H(`div`,{class:`done`},H(`span`,{class:`tick`,"aria-hidden":`true`},`✓`),H(`h2`,{class:`title`,id:`pnx-title-${this.uid}`,tabindex:-1,"data-autofocus":!0},this.queued?`Saved for later`:this.word(`confirmation`,on)),this.queued?H(`p`,{},`You're offline. We'll send it as soon as you're back.`,this.email.trim()?` If you leave this page first, it goes without your email address.`:``):null,e)]}},ln=8e3,G=null,K,q,un,dn,J=(e,t)=>(dn??window.fetch).call(window,e,t);function Y(e,t){try{(console.warn.__pinaxOriginal??console.warn).call(console,`Pinax: ${e}`,t??``)}catch{}}function X(e){try{e()}catch(e){Y(`capture could not start`,e)}}function fn(e){if(G)return;if(!e?.key)throw Error(`Pinax: init() needs a website key`);let t=ge(e.apiUrl),n=_e(e.cdnUrl,e.apiUrl);dn=typeof window.fetch==`function`?window.fetch:void 0;let r={options:e,api:t,cdn:n,root:lt(),user:K,console:new et(50),network:new et(50),breadcrumbs:new et(20),replayStarting:!1,replaySampled:!1,consent:{diagnostics:!1,replay:!1,...q},running:!1,watchers:{},counted:!1,stopCapture:{},onNavigate:[],cleanups:[],openWhenReady:!1,alive:!0};G=r,K=void 0,q=void 0,X(()=>{let e=pn(qe(r.console));r.stopCapture.console=e,r.cleanups.push(e)}),X(()=>{let i=pn($e(r.network,window,{ignore:r=>r.startsWith(`${t}/v1/widget/`)||n!==null&&(r.startsWith(ve(n,e.key))||r.startsWith(De(t,e.key,n)))}));r.stopCapture.network=i,r.cleanups.push(i)});let a=r.root.host;X(()=>{let e=Ve(r.breadcrumbs,{ignore:e=>e instanceof Node&&a.contains(e)});r.onNavigate.push(e.navigated),r.cleanups.push(e.stop)}),r.onNavigate.push(()=>{r.watchers.fixChecks?.navigated(),r.watchers.sightings?.navigated()}),r.cleanups.push(()=>{Sn(r),En(r)}),X(()=>r.cleanups.push(dt(()=>{for(let e of r.onNavigate)try{e()}catch{}})));let o=()=>{Tt(J,t,e.key).catch(()=>{})};window.addEventListener(`online`,o),r.cleanups.push(()=>window.removeEventListener(`online`,o)),be(J,t,e.key,n).then(n=>{if(!r.alive)return;if(!n){Y(`this website key was not found`);return}let a=Wt(n.ai,n.samplingRate),s=Rt(n.settings);r.config={...n,settings:s,branding:Ht(n.branding),ai:a,known:Kt(n.known,s.knownIssues)},mn(r),r.replaySampled=a.replay&&Math.random()<a.replaySampleRate,xe(J,t,e.key,location.href),wt(e.key)&&o();let c=Ln(n.allowedDomains,location.hostname);if(n.enabled&&!c&&Y(`${location.hostname} isn't one of this website's allowed domains, so the button is hidden. Add it under Websites in Pinax.`),r.running=n.enabled&&c,_n(r),!r.running)return;let l=Cn(r),u=Ot(e.segment,r.config.settings.segment),d=new cn(r.root,r.config,{takeScreenshot:async()=>(await i()).takeScreenshot(r.root.host,{autoBlur:a.autoBlur}),markUp:async e=>(await i()).markUp(r.root,e),submit:e=>An(r,e,u),user:()=>r.user,opened:u?At:void 0,followUp:a.followUp?({type:n,message:r})=>Te(J,t,e.key,{type:n,message:r,pagePath:location.pathname}):void 0,knownIssues:l,meToo:(n,r)=>Ae(J,t,e.key,n,r),attachments:()=>kn(r)});r.ui=d;let{hidePaths:f,hideButton:p}=r.config.settings;if(f.length&&!p){let e=()=>d.setPathHidden(gt(f,location.pathname));e(),r.onNavigate.push(e)}r.openWhenReady&&d.open()}).catch(e=>{r.alive&&Y(`could not load widget settings`,e)})}function pn(e){let t=!1;return()=>{t||(t=!0,e())}}function mn(e){let t=e.config?.settings.capture;t&&(t.console||(X(()=>e.stopCapture.console?.()),e.console.clear()),t.network||(X(()=>e.stopCapture.network?.()),e.network.clear()))}function hn(e){let t=e.options.consent;return t===`wait`||t!==`none`&&e.config?.settings.consent?.required===!0}function gn(e){return hn(e)||e.config?.settings.consent?.required===!0}function Z(e){let t=hn(e);return{diagnostics:!t||e.consent.diagnostics,replay:!t||e.consent.replay}}function _n(e){try{vn(e)}catch(e){Y(`could not apply consent`,e)}}function vn(e){if(!e.alive||!e.config)return;let t=Z(e);e.config.settings.consent?.required&&t.diagnostics&&!e.counted&&(e.counted=!0,Oe(J,e.api,e.options.key,e.cdn)),e.running&&(t.diagnostics?(bn(e),xn(e)):Sn(e),t.replay&&e.replaySampled?Tn(e):En(e)),e.ui?.refresh()}var yn=e=>gn(e)&&Z(e).diagnostics?!0:void 0;function bn(e){let t=e.config?.ai;!e.watchers.fixChecks&&t?.fixChecks.length&&(t.fixCheckSampleRate<=0||X(()=>{e.watchers.fixChecks=A({checks:t.fixChecks,sampleRate:t.fixCheckSampleRate,console:e.console,network:e.network,since:e.watchersSince,report:t=>Ee(J,e.api,e.options.key,{checkId:t.id,signature:t.signature,consent:yn(e)})})}))}function xn(e){let t=e.config?.ai;!e.watchers.sightings&&t?.watches.length&&(t.fixCheckSampleRate<=0||X(()=>{e.watchers.sightings=A({checks:t.watches.map(e=>({...e,path:`*`})),sampleRate:t.fixCheckSampleRate,console:e.console,network:e.network,since:e.watchersSince,report:t=>Ee(J,e.api,e.options.key,{checkId:t.id,signature:t.signature,basket:un,consent:yn(e)},`sighting`)})}))}function Sn(e){let{fixChecks:t,sightings:n}=e.watchers;(t||n)&&(e.watchers={},e.watchersSince=Date.now()+2,X(()=>t?.stop()),X(()=>n?.stop()))}function Cn(e){let t=e.config?.known;if(!t?.length)return;let n;return X(()=>{let r=st({known:t,console:e.console,network:e.network});e.onNavigate.push(r.navigated),e.cleanups.push(r.stop),n=r.matches}),n}function wn(e){let t=()=>{let t=window.requestIdleCallback;typeof t==`function`?t(e,{timeout:3e3}):setTimeout(e,200)};document.readyState===`complete`?t():window.addEventListener(`load`,t,{once:!0})}function Tn(e){if(e.recorder||e.replayStarting)return;e.replayStarting=!0;let t=()=>e.alive&&e.running&&e.replaySampled&&Z(e).replay;wn(()=>{t()?a().then(n=>{e.replayStarting=!1,!e.recorder&&t()&&(e.recorder=n.startRecorder({exclude:`#${e.root.host.id}`,mask:e.config?.ai?.replayMask}),e.ui?.refresh())}).catch(t=>{e.replayStarting=!1,Y(`session replay could not start`,t)}):e.replayStarting=!1})}function En(e){let t=e.recorder;e.recorder=void 0,t&&X(()=>t.stop())}async function Dn(e){if(!e.recorder)return null;let t;try{return await Promise.race([e.recorder.exportReplay(h.replayChars).catch(()=>null),new Promise(e=>{t=setTimeout(()=>e(null),5e3)})])}finally{clearTimeout(t)}}async function On(e){let t;try{return await Promise.race([o().then(t=>t.scanPage({exclude:`#${e.root.host.id}`})).catch(()=>null),new Promise(e=>{t=setTimeout(()=>e(null),ln)})])}finally{clearTimeout(t)}}function kn(e){let t=Z(e),n=e.config?.settings.capture,r=n?.console!==!1,i=n?.network!==!1;return{logs:t.diagnostics&&(r&&e.console.size>0||i&&e.network.size>0||e.breadcrumbs.size>0),askLogs:!t.diagnostics&&(r||i),replay:t.replay&&!!e.recorder&&typeof CompressionStream==`function`}}async function An(e,t,n=!1){let r=t.type===`ACCESSIBILITY`?await On(e):void 0,i=Z(e),a=(i.diagnostics||t.includeLogs===!0)&&t.listed?.logs!==!1,o=i.replay&&t.listed?.replay!==!1,s=n&&i.diagnostics&&!e.user?.id?Mt():null,c=s?{...e.user,id:s}:e.user,l=e.config?.settings.capture,u=pe({type:t.type,message:t.message,rating:t.rating,email:t.email,user:c,screenshot:t.shot?.dataUrl,annotations:t.shot?.annotations,followUp:t.followUp,fields:t.fields,barrier:t.barrier,a11yScan:r,hp:t.hp,elapsedMs:t.elapsedMs,consent:gn(e)?i:void 0,includeLogs:t.includeLogs},{page:{url:v(location.href),title:document.title||void 0},environment:Ze(),console:!a||l?.console===!1?[]:e.console.toArray(),network:!a||l?.network===!1?[]:e.network.toArray(),breadcrumbs:a?e.breadcrumbs.toArray():[]});o&&he(u,await Dn(e));let d=await Ce(J,e.api,e.options.key,u),f=(e,r)=>{n&&jt({type:t.type,rating:t.rating,reportId:r,queued:e})};return d.ok?(f(!1,d.id||void 0),{status:`sent`}):d.retry&&Ct(e.options.key,u)?(f(!0),{status:`queued`}):{status:`error`,message:d.message}}function jn(){G?G.ui?G.ui.open():G.config||(G.openWhenReady=!0):Y(`call init() before open()`)}function Mn(e){let t;if(typeof e==`boolean`)t={diagnostics:e,replay:e};else if(e&&typeof e==`object`){t={};for(let n of[`diagnostics`,`replay`])e[n]!==void 0&&(t[n]=e[n]===!0)}else{Y(`consent() takes true, false or { diagnostics, replay }`);return}G?(G.consent={...G.consent,...t},_n(G)):q={...q,...t}}function Nn(e){let t=e?{...e}:void 0;G?G.user=t:K=t}function Pn(e){un=Fn(e)}function Fn(e){if(!e||typeof e!=`object`)return;let{value:t,currency:n}=e,r=typeof n==`string`?n.trim().toUpperCase():``;if(!(typeof t!=`number`||!Number.isFinite(t)||t<=0||t>1e7||!/^[A-Z]{3}$/.test(r)))return{value:Math.round(t*100)/100,currency:r}}function In(){if(G){G.alive=!1,G.ui?.destroy();for(let e of G.cleanups.reverse())try{e()}catch{}}ut(),G=null,K=void 0,q=void 0,un=void 0}function Ln(e,t){if(!e)return!0;let n=t.toLowerCase();return e.some(e=>e.toLowerCase()===n)}var Q=document.currentScript;Q?.src&&t(Q.src);var Rn=Q?.dataset.key,zn=Q?.dataset.api,Bn=Q?.dataset.segment,Vn=Bn===`true`||Bn!==`false`&&void 0,Hn=Q?.dataset.cdn,Un=Q?.dataset.consent,Wn=Un===`wait`||Un===`none`?Un:void 0,$=()=>{Rn&&fn({key:Rn,apiUrl:zn,cdnUrl:Hn,segment:Vn,consent:Wn})},Gn={init:fn,open:()=>{$(),jn()},identify:Nn,setBasket:Pn,consent:Mn,destroy:In},Kn=Array.isArray(window.Pinax?.q)?window.Pinax.q:[];window.Pinax=Gn;for(let[e,t]of Kn){let n=Gn[e];try{n?.(...t)}catch{}}Rn&&(document.readyState===`complete`?$():window.addEventListener(`load`,$,{once:!0}))})();
135
+ //# sourceMappingURL=pinax.js.map