@journeeze/sdk 0.2.0 → 0.3.0-rc.1

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 (30) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{anchor-BhsfeHwL.js → anchor-bnZCZtbG.js} +1 -1
  3. package/dist/{attach-D451Wj4h.js → attach-EfetX0Vi.js} +1 -1
  4. package/dist/chat-Coze4aH0.js +64 -0
  5. package/dist/{claims-BfpRuIu-.js → claims-VKhPNjA7.js} +1 -1
  6. package/dist/{consent-BupCs23W.js → consent-bPengyOI.js} +1 -1
  7. package/dist/contract.js +1 -1
  8. package/dist/{feedback-DtMDnAam.js → feedback-DeMvbZnh.js} +1 -1
  9. package/dist/help-phTc32Gg.js +105 -0
  10. package/dist/highlight-pU9nE3Qj.js +2 -0
  11. package/dist/{hook-BRnJ-lTk.js → hook-M34sajh9.js} +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/{loader-k4pePzAw.js → loader-DHgG5Y7t.js} +2 -2
  14. package/dist/{mask-audit-DtKNgOlT.js → mask-audit-KFvSiJU0.js} +1 -1
  15. package/dist/react.js +1 -1
  16. package/dist/{resolve-7jVqhJhi.js → resolve-CRDmtd4b.js} +1 -1
  17. package/dist/script.js +1 -1
  18. package/dist/{signals-eaZX2lNd.js → signals-C_WxFykA.js} +1 -1
  19. package/dist/{telemetry-DMGFJcw3.js → telemetry-CdwMjZZZ.js} +1 -1
  20. package/dist/{transport-DokImbgl.js → transport-Wrkorx6z.js} +1 -1
  21. package/dist/types/chat/shell/chat.d.ts +4 -2
  22. package/dist/types/chat/shell/guide.d.ts +12 -0
  23. package/dist/types/chat/shell/session.d.ts +6 -0
  24. package/dist/types/chat/shell/walk.d.ts +49 -0
  25. package/dist/{upload-DkAWrJhn.js → upload-KvsGqMEV.js} +1 -1
  26. package/dist/walk-BEGYyGG3.js +1 -0
  27. package/dist/{widget-CcAalO4B.js → widget-BA2WH0yi.js} +2 -2
  28. package/package.json +1 -1
  29. package/dist/chat-ByOXN5k1.js +0 -64
  30. package/dist/help-D_T0HiNa.js +0 -106
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 (unreleased)
4
+
5
+ Additive: integrations without `chat: true` see no change.
6
+
7
+ - **In-page walkthrough in the help chat:** when the chat (`chat: true`) is on a guide step, it outlines the step's element on the host page with the v1 help panel's highlighter. It uses the same targets (tflo id, test id, role and name, CSS) and the same lazy fallback resolver. The outline follows Next and Back, the host's route changes (`setContext`) and scrolling. Leaving the guide, closing the chat or `reset()` removes it.
8
+ - The guide's targets come from `GetGuide`, which needs no consent and sends only the site key, reviewer token and claims.
9
+ - If the loaded guide's step count differs from the server's step card, nothing is outlined, so the outline never points at the wrong element.
10
+ - The walkthrough is its own lazy chunk (`walk`, ≤ 3 KB gz), loaded the first time a guide starts.
11
+ - If the chunk or the guide can't load, the step cards still guide.
12
+ - **Per-persona guides in the chat:** a job chip's step count now uses the guide the server plays for the viewer: the job's own guide, else the persona guide for the host's `context.persona`, as `Converse` picks it. Before, a job whose guides were all per persona read "No guide yet".
13
+ - **Size budgets:** chat 12 KB gz (was 11.5 KB), help 15 KB + 128 B. Help's code is unchanged; the highlighter and help client it now shares with the walkthrough are a separate chunk.
14
+
3
15
  ## 0.2.0 (2026-10-29)
4
16
 
5
17
  First stable release after 0.1.0. Additive: existing 0.1.x integrations need no change.
@@ -1 +1 @@
1
- import{a as f}from"./loader-k4pePzAw.js";const g=512,p=12;function b(t){const n=[];let o=t,e=false;for(let i=0;o&&i<p;i++){const r=o.hasAttribute("data-tflow-id")?f(o):void 0;if(r!==void 0&&o.getAttribute("data-tflow-id")===r){n.unshift(`[data-tflow-id="${r}"]`),e=true;break}const s=o.tagName.toLowerCase();if(s==="body"||s==="html"){n.unshift(s),e=true;break}const c=o,l=c.parentElement;let d=s;if(l){const u=Array.from(l.children).filter(m=>m.tagName===c.tagName);u.length>1&&(d+=`:nth-of-type(${u.indexOf(c)+1})`)}n.unshift(d),o=l}const a=n.join(" > ");return e&&a.length<=g?a:void 0}const h=t=>Number.isFinite(t)?Math.min(1,Math.max(0,t)):.5;function v(t,n,o){const e=t.getBoundingClientRect(),a={xRatio:h(e.width>0?(n-e.left)/e.width:.5),yRatio:h(e.height>0?(o-e.top)/e.height:.5)},i=f(t);i!==void 0&&(a.tflowId=i);const r=b(t);return r!==void 0&&(a.cssSelector=r),a}function A(t){return f(t)??t.tagName.toLowerCase()}function k(t){return t.closest("[data-jz-block]")!==null}function C(t){return t<768?"mobile":t<1024?"tablet":"desktop"}export{v as a,C as d,A as e,k as i};
1
+ import{a as f}from"./loader-DHgG5Y7t.js";const g=512,p=12;function b(t){const n=[];let o=t,e=false;for(let i=0;o&&i<p;i++){const r=o.hasAttribute("data-tflow-id")?f(o):void 0;if(r!==void 0&&o.getAttribute("data-tflow-id")===r){n.unshift(`[data-tflow-id="${r}"]`),e=true;break}const s=o.tagName.toLowerCase();if(s==="body"||s==="html"){n.unshift(s),e=true;break}const c=o,l=c.parentElement;let d=s;if(l){const u=Array.from(l.children).filter(m=>m.tagName===c.tagName);u.length>1&&(d+=`:nth-of-type(${u.indexOf(c)+1})`)}n.unshift(d),o=l}const a=n.join(" > ");return e&&a.length<=g?a:void 0}const h=t=>Number.isFinite(t)?Math.min(1,Math.max(0,t)):.5;function v(t,n,o){const e=t.getBoundingClientRect(),a={xRatio:h(e.width>0?(n-e.left)/e.width:.5),yRatio:h(e.height>0?(o-e.top)/e.height:.5)},i=f(t);i!==void 0&&(a.tflowId=i);const r=b(t);return r!==void 0&&(a.cssSelector=r),a}function A(t){return f(t)??t.tagName.toLowerCase()}function k(t){return t.closest("[data-jz-block]")!==null}function C(t){return t<768?"mobile":t<1024?"tablet":"desktop"}export{v as a,C as d,A as e,k as i};
@@ -1,4 +1,4 @@
1
- import{a as K}from"./loader-k4pePzAw.js";import{i as q}from"./anchor-BhsfeHwL.js";import{a as V,p as G}from"./upload-DkAWrJhn.js";import{m as Se}from"./upload-DkAWrJhn.js";import{M as T,u as J}from"./chat-ByOXN5k1.js";const R=10,j=.02,z=.01,h=(e,n,t)=>Number.isFinite(e)?Math.min(t,Math.max(n,e)):n,p=e=>Math.round(e*1e4)/1e4;function Q(e,n,t){return{x:h(t.width>0?(e-t.left)/t.width:0,0,1),y:h(t.height>0?(n-t.top)/t.height:0,0,1)}}function $(e,n,t){const i=h(n.x,0,1),a=h(n.y,0,1),r=h(t.x,0,1),s=h(t.y,0,1);return e==="arrow"?{type:e,x:p(i),y:p(a),w:p(r-i),h:p(s-a)}:{type:e,x:p(Math.min(i,r)),y:p(Math.min(a,s)),w:p(Math.abs(r-i)),h:p(Math.abs(s-a))}}function Z(e){return Math.abs(e.w)<z&&Math.abs(e.h)<z}function ee(e){return e==="arrow"?{type:e,x:.35,y:.35,w:.15,h:.15}:{type:e,x:.35,y:.4,w:.3,h:.2}}function te(e,n,t,i){const a=e.type==="arrow";if(i){const c=a?h(e.w+n,-e.x,1-e.x):h(e.w+n,z,1-e.x),u=a?h(e.h+t,-e.y,1-e.y):h(e.h+t,z,1-e.y);return{...e,w:p(c),h:p(u)}}const r=h(e.x+n,Math.max(0,-e.w),Math.min(1,1-e.w)),s=h(e.y+t,Math.max(0,-e.h),Math.min(1,1-e.h));return{...e,x:p(r),y:p(s)}}function U(e,n,t,i,a){const r=Math.atan2(i-n,t-e),s=c=>`${p(t-a*Math.cos(r+c))},${p(i-a*Math.sin(r+c))}`;return`${p(t)},${p(i)} ${s(Math.PI/7)} ${s(-Math.PI/7)}`}function ne(e,n,t,i){e.strokeStyle=e.fillStyle="#B42318",e.lineWidth=Math.max(2,Math.round(Math.max(t,i)/160));for(const a of n)if(e.beginPath(),a.type==="box"?e.rect(a.x*t,a.y*i,a.w*t,a.h*i):a.type==="circle"?e.ellipse((a.x+a.w/2)*t,(a.y+a.h/2)*i,a.w/2*t,a.h/2*i,0,0,Math.PI*2):(e.moveTo(a.x*t,a.y*i),e.lineTo((a.x+a.w)*t,(a.y+a.h)*i)),e.stroke(),a.type==="arrow"){const r=U(a.x*t,a.y*i,(a.x+a.w)*t,(a.y+a.h)*i,e.lineWidth*4).split(" ").map(s=>s.split(",").map(Number));e.beginPath(),r.forEach(([s,c],u)=>u?e.lineTo(s,c):e.moveTo(s,c)),e.fill()}}const ae="http://www.w3.org/2000/svg",B=["box","circle","arrow"];function m(e,n={},...t){const i=document.createElement(e);for(const[a,r]of Object.entries(n))i.setAttribute(a,r);return i.append(...t),i}function M(e,n){const t=document.createElementNS(ae,e);for(const[i,a]of Object.entries(n))t.setAttribute(i,String(a));return t}function ie(e,n,t){const i={fill:"none",stroke:"#B42318","stroke-width":3,"vector-effect":"non-scaling-stroke"};if(e.type==="box")return M("rect",{x:e.x*n,y:e.y*t,width:e.w*n,height:e.h*t,...i});if(e.type==="circle")return M("ellipse",{cx:(e.x+e.w/2)*n,cy:(e.y+e.h/2)*t,rx:e.w/2*n,ry:e.h/2*t,...i});const[a,r,s,c]=[e.x*n,e.y*t,(e.x+e.w)*n,(e.y+e.h)*t],u=M("g",{});return u.append(M("line",{x1:a,y1:r,x2:s,y2:c,...i}),M("polygon",{points:U(a,r,s,c,Math.max(n,t)/50),fill:"#B42318"})),u}function oe(e,n,t,i){return new Promise(a=>{let r="box",s=[],c,u;const v=B.map(o=>{const d=m("button",{type:"button",class:"tool","aria-pressed":String(o===r)},i(`draw.${o}`));return d.addEventListener("click",()=>{r=o,v.forEach((g,b)=>g.setAttribute("aria-pressed",String(B[b]===o)))}),d}),l=(o,d,g)=>{const b=m("button",{type:"button",class:d},o);return b.addEventListener("click",g),b},w=l(i("draw.undo"),"tool",()=>A(s.slice(0,-1),i("draw.removed_last"))),y=l(i("draw.clear"),"tool",()=>A([],i("draw.cleared"))),N=l(i("cancel"),"btn",()=>P(void 0)),X=l(i("draw.done"),"btn pri",()=>P(s)),I=M("svg",{viewBox:`0 0 ${t.w} ${t.h}`,preserveAspectRatio:"none","aria-hidden":"true"}),H=m("img",{src:n,alt:i("draw.image"),draggable:"false"}),W=m("span",{id:"jzd-k",class:"sr"},i("draw.keys")),f=m("div",{class:"stage",tabindex:"0",role:"group","aria-label":i("draw.stage"),"aria-describedby":"jzd-k"},H,I,W),L=m("p",{class:"msg",role:"status"}),E=m("div",{class:"jzd",role:"dialog","aria-modal":"true","aria-labelledby":"jzd-t","aria-describedby":"jzd-h"},m("header",{},m("h2",{id:"jzd-t"},i("draw.title")),m("p",{id:"jzd-h"},i("draw.hint"))),m("div",{class:"bar",role:"toolbar","aria-label":i("draw.tools")},...v,m("span",{class:"sep","aria-hidden":"true"}),w,y,m("span",{class:"end"},N,X)),m("div",{class:"wrap"},f),L);function k(){I.replaceChildren(...[...s,...u?[u]:[]].map(o=>ie(o,t.w,t.h))),w.disabled=y.disabled=s.length===0}function A(o,d){s=o,L.textContent=d,k()}function O(o){if(s.length>=R){L.textContent=i("draw.shape_limit",{max:R});return}A([...s,o],i(`draw.added.${o.type}`,{n:s.length+1,max:R}))}function S(){const o=f.parentElement,d=getComputedStyle(o),g=Math.max(1,o.clientWidth-parseFloat(d.paddingLeft||"0")-parseFloat(d.paddingRight||"0")),b=Math.max(1,o.clientHeight-parseFloat(d.paddingTop||"0")-parseFloat(d.paddingBottom||"0")),C=Math.min(g/t.w,b/t.h);f.style.width=`${Math.floor(t.w*C)}px`,f.style.height=`${Math.floor(t.h*C)}px`}const _=o=>Q(o.clientX,o.clientY,f.getBoundingClientRect());f.addEventListener("pointerdown",o=>{o.button===0&&(o.preventDefault(),f.setPointerCapture?.(o.pointerId),c=_(o))}),f.addEventListener("pointermove",o=>{c&&(u=$(r,c,_(o)),k())});const Y=o=>{if(!c)return;const d=$(r,c,_(o));c=u=void 0,Z(d)?k():O(d)};f.addEventListener("pointerup",Y),f.addEventListener("pointercancel",()=>{c=u=void 0,k()}),f.addEventListener("keydown",o=>{const d={ArrowLeft:[-j,0],ArrowRight:[j,0],ArrowUp:[0,-j],ArrowDown:[0,j]};if(o.key==="Enter"||o.key===" ")o.preventDefault(),O(ee(r));else if(d[o.key]&&s.length>0){o.preventDefault();const[g,b]=d[o.key];s=[...s.slice(0,-1),te(s[s.length-1],g,b,o.shiftKey)],k()}}),E.addEventListener("keydown",o=>{if(o.stopPropagation(),o.key==="Escape")o.preventDefault(),P(void 0);else if(o.key==="Tab"){const d=[...E.querySelectorAll("button:not([disabled]), [tabindex='0']")],g=d.indexOf(e.activeElement);(o.shiftKey?g<=0:g===d.length-1)&&(o.preventDefault(),d[o.shiftKey?d.length-1:0]?.focus())}}),window.addEventListener("resize",S);function P(o){window.removeEventListener("resize",S),E.remove(),a(o)}e.append(E),k(),S(),v[0].focus()})}const re=`
1
+ import{a as K}from"./loader-DHgG5Y7t.js";import{i as q}from"./anchor-bnZCZtbG.js";import{a as V,p as G}from"./upload-KvsGqMEV.js";import{m as Se}from"./upload-KvsGqMEV.js";import{M as T,u as J}from"./chat-Coze4aH0.js";const R=10,j=.02,z=.01,h=(e,n,t)=>Number.isFinite(e)?Math.min(t,Math.max(n,e)):n,p=e=>Math.round(e*1e4)/1e4;function Q(e,n,t){return{x:h(t.width>0?(e-t.left)/t.width:0,0,1),y:h(t.height>0?(n-t.top)/t.height:0,0,1)}}function $(e,n,t){const i=h(n.x,0,1),a=h(n.y,0,1),r=h(t.x,0,1),s=h(t.y,0,1);return e==="arrow"?{type:e,x:p(i),y:p(a),w:p(r-i),h:p(s-a)}:{type:e,x:p(Math.min(i,r)),y:p(Math.min(a,s)),w:p(Math.abs(r-i)),h:p(Math.abs(s-a))}}function Z(e){return Math.abs(e.w)<z&&Math.abs(e.h)<z}function ee(e){return e==="arrow"?{type:e,x:.35,y:.35,w:.15,h:.15}:{type:e,x:.35,y:.4,w:.3,h:.2}}function te(e,n,t,i){const a=e.type==="arrow";if(i){const c=a?h(e.w+n,-e.x,1-e.x):h(e.w+n,z,1-e.x),u=a?h(e.h+t,-e.y,1-e.y):h(e.h+t,z,1-e.y);return{...e,w:p(c),h:p(u)}}const r=h(e.x+n,Math.max(0,-e.w),Math.min(1,1-e.w)),s=h(e.y+t,Math.max(0,-e.h),Math.min(1,1-e.h));return{...e,x:p(r),y:p(s)}}function U(e,n,t,i,a){const r=Math.atan2(i-n,t-e),s=c=>`${p(t-a*Math.cos(r+c))},${p(i-a*Math.sin(r+c))}`;return`${p(t)},${p(i)} ${s(Math.PI/7)} ${s(-Math.PI/7)}`}function ne(e,n,t,i){e.strokeStyle=e.fillStyle="#B42318",e.lineWidth=Math.max(2,Math.round(Math.max(t,i)/160));for(const a of n)if(e.beginPath(),a.type==="box"?e.rect(a.x*t,a.y*i,a.w*t,a.h*i):a.type==="circle"?e.ellipse((a.x+a.w/2)*t,(a.y+a.h/2)*i,a.w/2*t,a.h/2*i,0,0,Math.PI*2):(e.moveTo(a.x*t,a.y*i),e.lineTo((a.x+a.w)*t,(a.y+a.h)*i)),e.stroke(),a.type==="arrow"){const r=U(a.x*t,a.y*i,(a.x+a.w)*t,(a.y+a.h)*i,e.lineWidth*4).split(" ").map(s=>s.split(",").map(Number));e.beginPath(),r.forEach(([s,c],u)=>u?e.lineTo(s,c):e.moveTo(s,c)),e.fill()}}const ae="http://www.w3.org/2000/svg",B=["box","circle","arrow"];function m(e,n={},...t){const i=document.createElement(e);for(const[a,r]of Object.entries(n))i.setAttribute(a,r);return i.append(...t),i}function M(e,n){const t=document.createElementNS(ae,e);for(const[i,a]of Object.entries(n))t.setAttribute(i,String(a));return t}function ie(e,n,t){const i={fill:"none",stroke:"#B42318","stroke-width":3,"vector-effect":"non-scaling-stroke"};if(e.type==="box")return M("rect",{x:e.x*n,y:e.y*t,width:e.w*n,height:e.h*t,...i});if(e.type==="circle")return M("ellipse",{cx:(e.x+e.w/2)*n,cy:(e.y+e.h/2)*t,rx:e.w/2*n,ry:e.h/2*t,...i});const[a,r,s,c]=[e.x*n,e.y*t,(e.x+e.w)*n,(e.y+e.h)*t],u=M("g",{});return u.append(M("line",{x1:a,y1:r,x2:s,y2:c,...i}),M("polygon",{points:U(a,r,s,c,Math.max(n,t)/50),fill:"#B42318"})),u}function oe(e,n,t,i){return new Promise(a=>{let r="box",s=[],c,u;const v=B.map(o=>{const d=m("button",{type:"button",class:"tool","aria-pressed":String(o===r)},i(`draw.${o}`));return d.addEventListener("click",()=>{r=o,v.forEach((g,b)=>g.setAttribute("aria-pressed",String(B[b]===o)))}),d}),l=(o,d,g)=>{const b=m("button",{type:"button",class:d},o);return b.addEventListener("click",g),b},w=l(i("draw.undo"),"tool",()=>A(s.slice(0,-1),i("draw.removed_last"))),y=l(i("draw.clear"),"tool",()=>A([],i("draw.cleared"))),N=l(i("cancel"),"btn",()=>P(void 0)),X=l(i("draw.done"),"btn pri",()=>P(s)),I=M("svg",{viewBox:`0 0 ${t.w} ${t.h}`,preserveAspectRatio:"none","aria-hidden":"true"}),H=m("img",{src:n,alt:i("draw.image"),draggable:"false"}),W=m("span",{id:"jzd-k",class:"sr"},i("draw.keys")),f=m("div",{class:"stage",tabindex:"0",role:"group","aria-label":i("draw.stage"),"aria-describedby":"jzd-k"},H,I,W),L=m("p",{class:"msg",role:"status"}),E=m("div",{class:"jzd",role:"dialog","aria-modal":"true","aria-labelledby":"jzd-t","aria-describedby":"jzd-h"},m("header",{},m("h2",{id:"jzd-t"},i("draw.title")),m("p",{id:"jzd-h"},i("draw.hint"))),m("div",{class:"bar",role:"toolbar","aria-label":i("draw.tools")},...v,m("span",{class:"sep","aria-hidden":"true"}),w,y,m("span",{class:"end"},N,X)),m("div",{class:"wrap"},f),L);function k(){I.replaceChildren(...[...s,...u?[u]:[]].map(o=>ie(o,t.w,t.h))),w.disabled=y.disabled=s.length===0}function A(o,d){s=o,L.textContent=d,k()}function O(o){if(s.length>=R){L.textContent=i("draw.shape_limit",{max:R});return}A([...s,o],i(`draw.added.${o.type}`,{n:s.length+1,max:R}))}function S(){const o=f.parentElement,d=getComputedStyle(o),g=Math.max(1,o.clientWidth-parseFloat(d.paddingLeft||"0")-parseFloat(d.paddingRight||"0")),b=Math.max(1,o.clientHeight-parseFloat(d.paddingTop||"0")-parseFloat(d.paddingBottom||"0")),C=Math.min(g/t.w,b/t.h);f.style.width=`${Math.floor(t.w*C)}px`,f.style.height=`${Math.floor(t.h*C)}px`}const _=o=>Q(o.clientX,o.clientY,f.getBoundingClientRect());f.addEventListener("pointerdown",o=>{o.button===0&&(o.preventDefault(),f.setPointerCapture?.(o.pointerId),c=_(o))}),f.addEventListener("pointermove",o=>{c&&(u=$(r,c,_(o)),k())});const Y=o=>{if(!c)return;const d=$(r,c,_(o));c=u=void 0,Z(d)?k():O(d)};f.addEventListener("pointerup",Y),f.addEventListener("pointercancel",()=>{c=u=void 0,k()}),f.addEventListener("keydown",o=>{const d={ArrowLeft:[-j,0],ArrowRight:[j,0],ArrowUp:[0,-j],ArrowDown:[0,j]};if(o.key==="Enter"||o.key===" ")o.preventDefault(),O(ee(r));else if(d[o.key]&&s.length>0){o.preventDefault();const[g,b]=d[o.key];s=[...s.slice(0,-1),te(s[s.length-1],g,b,o.shiftKey)],k()}}),E.addEventListener("keydown",o=>{if(o.stopPropagation(),o.key==="Escape")o.preventDefault(),P(void 0);else if(o.key==="Tab"){const d=[...E.querySelectorAll("button:not([disabled]), [tabindex='0']")],g=d.indexOf(e.activeElement);(o.shiftKey?g<=0:g===d.length-1)&&(o.preventDefault(),d[o.shiftKey?d.length-1:0]?.focus())}}),window.addEventListener("resize",S);function P(o){window.removeEventListener("resize",S),E.remove(),a(o)}e.append(E),k(),S(),v[0].focus()})}const re=`
2
2
  .jzd{position:fixed;inset:0;z-index:2147483647;display:flex;flex-direction:column;background:var(--c);color:var(--i)}
3
3
  .jzd header{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;padding:12px 16px;border-bottom:1px solid var(--l);background:var(--s)}
4
4
  .jzd h2{margin:0;font-size:14px;font-weight:600}
@@ -0,0 +1,64 @@
1
+ var Y=Object.defineProperty;var Q=(n,e,t)=>e in n?Y(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var p=(n,e,t)=>Q(n,typeof e!="symbol"?e+"":e,t);import{c as U,C as Z,k as ee,d as te,j as ne,g as G,h as ie,s as re,f as ae}from"./consent-bPengyOI.js";const oe="journeeze.turn/v1";class se extends Error{constructor(t,i){super(t);p(this,"kind");p(this,"status");this.kind=t,this.status=i}}function K(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const n=crypto.getRandomValues(new Uint8Array(16));n[6]=n[6]&15|64,n[8]=n[8]&63|128;const e=[...n].map(t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function de(n){const e=n instanceof Z?n.status:0,t=e===429?"busy":e===400?"invalid":"unavailable";return new se(t,e)}function le(n,e=(...t)=>fetch(...t)){return{turn:t=>U(n,"Converse",t,e).then(i=>({...i,messages:i.messages??[],actions:i.actions??[],requiresConsent:!!i.requiresConsent}),i=>{throw de(i)})}}function ce(n,e,t,i){const r=le(n,t);return{turn:async d=>{const u=await i?.();return r.turn({...d,...e.reviewerToken&&{reviewerToken:e.reviewerToken},...d.consentGiven&&e.userId&&{userId:e.userId,...ee(e)},...u&&{claims:u}})}}}const pe="Help";function he(n){return(e,t)=>(n?.["widget.ui."+e]??"").replace(/\{(\w+)\}/g,(i,r)=>String(t?.[r]??""))}function ue(n,e){const t=e.toLowerCase().split(/\s+/).filter(Boolean);return n.filter(i=>t.every(r=>i.title.toLowerCase().includes(r)))}function fe(n){return typeof n.steps=="number"&&n.steps>0?n.steps:void 0}function be(n){return/Edg\//.test(n)?"Edge":/Firefox\//.test(n)?"Firefox":/Chrome\/|CriOS\//.test(n)?"Chrome":/Safari\//.test(n)?"Safari":"Other"}function me(n,e,t){const i=[],r=(d,u,s=true)=>{u&&!e.has(d)&&i.push({key:d,label:u,removable:s})};return r("page",n.pagePath&&t("context.page",{value:n.pagePath})),r("job",n.job,false),r("step",n.step!==void 0&&t("context.step",{step:n.step}),false),r("persona",n.persona&&t("context.persona",{value:n.persona})),r("browser",n.browser),r("device",n.device&&(n.viewport?`${n.device} · ${n.viewport.w}×${n.viewport.h}`:n.device)),r("build",n.build&&t("context.build",{value:n.build})),i}const ve=["page","persona","browser","device","viewport","build"];function ge(n,e){const t=new Set(e);t.has("device")&&t.add("viewport");const i={pagePath:t.has("page")?"":n.pagePath};n.persona&&!t.has("persona")&&(i.persona=n.persona),n.browser&&!t.has("browser")&&(i.browser=n.browser),n.device&&!t.has("device")&&(i.device=n.device),n.viewport&&!t.has("viewport")&&(i.viewport=n.viewport),n.build&&!t.has("build")&&(i.build=n.build);const r=ve.filter(d=>t.has(d));return r.length>0&&(i.removed=r),i}const xe=5,ke="clarify_tap_only";class W{constructor(e){p(this,"deps");p(this,"conversationId",K());p(this,"entries",[]);p(this,"state","choose_job");p(this,"actions",[]);p(this,"requiresConsent",false);p(this,"pending",false);p(this,"error");p(this,"tapOnly",false);p(this,"consentAsked",false);p(this,"filed");p(this,"attachments",[]);p(this,"anchor");p(this,"removed",new Set);p(this,"team",{});p(this,"job");p(this,"step",0);p(this,"last");p(this,"ended",false);p(this,"opening",{chips:[]});p(this,"overMask",new Map);p(this,"listeners",new Set);p(this,"consent");p(this,"t");this.deps=e,this.consent=e.hasConsent(),this.t=e.t}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(){for(const e of this.listeners)e()}start(e){this.opening={chips:e},this.entries=[{kind:"assistant",copyId:"ask_job",text:this.t("greeting")}],this.actions=[...e,{type:"other_need",label:this.t("other_need")}],this.emit()}close(){if(this.ended||(this.ended=true,this.emit(),!this.last))return;const e=this.conversationId,t={kind:"action",action:"cancel"};this.send({turnId:K(),input:t}).then(i=>{e===this.conversationId&&(this.apply(t,i),this.emit())},()=>{})}reopen(){if(!this.ended)return;for(const t of this.attachments)t.release?.();const{chips:e}=this.opening;Object.assign(this,new W(this.deps),{listeners:this.listeners,overMask:this.overMask}),this.start(e)}guidePosition(){if(!(this.ended||this.state!=="guide_step"||!this.job||this.step<1))return{jobId:this.job.id,step:this.step,of:this.job.of}}offers(e){return this.actions.some(t=>t.type===e)}label(e){return this.actions.find(t=>t.type===e)?.label??""}chips(){return this.actions.filter(e=>e.type==="chip")}plusItems(){for(const e of this.actions)if(e.type==="plus_menu")return e.menu??e.items.map(t=>({id:t,label:""}));return[]}needsConsent(){return!this.consent&&(this.requiresConsent||this.offers("consent"))}allow(){this.deps.giveConsent(),this.consent=true,this.consentAsked=false,this.emit()}contextChips(){return me(this.facts(),this.removed,this.t)}removeContext(e){this.removed.add(e),this.emit()}setTeam(e){this.team={...this.team,...e}}teamOnWire(){const e={};return this.team.verdict&&(e.verdict=this.team.verdict),this.team.severity&&(e.severity=this.team.severity),e}addAttachment(e){const t=this.attachments.filter(i=>i.id!==e.id);return t.length>=xe?false:(this.attachments=[...t,e],this.emit(),true)}removeAttachment(e){this.attachments.find(t=>t.id===e)?.release?.(),this.attachments=this.attachments.filter(t=>t.id!==e),this.emit()}setAnchor(e){this.anchor=e,this.emit()}note(e){this.entries=[...this.entries,{kind:"note",text:e}],this.emit()}async uploadPending(){if(!this.consent)return;const e=this.attachments.filter(r=>!r.screenshotId&&r.upload),t=await Promise.all(e.map(r=>r.upload().catch(()=>{})));let i=false;e.forEach((r,d)=>{const u=t[d];u?this.attachments=this.attachments.map(s=>s===r?{...r,screenshotId:u}:s):(i=true,r.release?.(),this.attachments=this.attachments.filter(s=>s!==r))}),i&&(this.entries=[...this.entries,{kind:"note",text:this.t("note.upload_failed")}])}draft(){if(!this.consent)return;const e=this.attachments.flatMap(i=>i.screenshotId?[{screenshotId:i.screenshotId,...i.shapes?.length?{shapes:i.shapes}:{}}]:[]),t={};return e.length>0&&(t.attachments=e),this.anchor&&(t.anchor=this.anchor.tflowId),t.attachments||t.anchor?t:void 0}pickJob(e){this.job={id:e.jobId,title:e.title,of:fe(e)},this.run({kind:"action",action:"pick_job",jobId:e.jobId},e.title)}other(){this.run({kind:"action",action:"other_need"},this.label("other_need"))}next(){this.job&&this.run({kind:"action",action:"guide_next",jobId:this.job.id,step:this.step})}back(){this.state==="guide_step"&&this.job?this.run({kind:"action",action:"guide_back",jobId:this.job.id,step:this.step}):this.run({kind:"action",action:"guide_back"})}didntWork(){this.run({kind:"action",action:"didnt_work"},this.label("didnt_work"))}talk(){this.run({kind:"action",action:"talk_to_assistant"},this.label("talk_to_assistant"))}reportProblem(){this.run({kind:"action",action:"report_problem"},this.t("report_problem"))}sendText(e){const t=e.trim().slice(0,2e3);return!t||this.tapOnly||this.pending?false:this.needsConsent()?this.askConsent():(this.run({kind:"text",text:t},t),true)}sendReport(){return this.needsConsent()?this.askConsent():(this.run({kind:"action",action:"send"},this.label("send")),true)}retry(){this.last&&!this.pending&&this.exec(this.last)}askConsent(){return this.consentAsked=true,this.emit(),false}facts(){const e=this.deps.facts();return this.job?{...e,job:this.job.title,...this.step>0?{step:this.step}:{}}:e}run(e,t){this.pending||(t&&(this.entries=[...this.entries,{kind:"user",text:t}]),this.exec(this.last={turnId:K(),input:e}))}exec(e){this.pending=true,this.error=void 0,this.emit();const t=this.conversationId;this.uploadPending().then(()=>this.send(e)).then(i=>{t===this.conversationId&&this.apply(e.input,i)},i=>{t===this.conversationId&&(this.error=i.kind??"unavailable",this.error==="unavailable"&&(this.tapOnly=true))}).finally(()=>{this.pending=false,this.emit()})}send(e){const t=this.draft(),i=this.consent?[...this.overMask].map(([r,d])=>({rule:r,count:d})):[];return this.deps.transport.turn({siteKey:this.deps.siteKey,conversationId:this.conversationId,turnId:e.turnId,consentGiven:this.consent,context:ge(this.facts(),this.removed),schema:oe,payload:{input:e.input,...t?{draft:t}:{},...this.deps.reviewer&&(this.team.verdict||this.team.severity)?{team:this.teamOnWire()}:{}},...i.length?{overMasked:i}:{}}).then(r=>(i.length&&this.overMask.clear(),r))}apply(e,t){const i=this.state,r=e.kind==="action"?e.action:void 0;t.state==="guide_step"&&(r==="pick_job"?this.step=1:r==="guide_next"?this.step+=1:r==="guide_back"&&(this.step=Math.max(1,this.step-1)));const d=this.entries.map(s=>s.kind==="card"&&s.live?{...s,live:false}:s);let u;for(const s of t.messages)d.push({kind:"assistant",copyId:s.copyId,text:s.text}),s.card&&(s.card.step&&(this.step=s.card.step),this.job&&s.card.of&&(this.job.of=s.card.of),u={kind:"card",job:this.job?.title??"",step:this.step,of:s.card.of??this.job?.of,title:s.card.title,instruction:s.card.instruction,live:true});if(t.state==="guide_step"&&this.job&&d.push(u??{kind:"card",job:this.job.title,step:this.step,of:this.job.of,live:true}),t.state==="unmet_need"&&i!=="unmet_need"&&d.push({kind:"note",text:this.t("note.unmet")}),this.entries=d,this.tapOnly=t.messages.some(s=>s.copyId===ke),this.actions=t.actions,this.requiresConsent=t.requiresConsent,this.state=t.state,this.filed=t.filed?t.filed.kind??"problem":void 0,t.filed){for(const s of this.attachments)s.release?.();this.attachments=[],this.anchor=void 0,this.removed.clear(),this.team={}}["guide_step","didnt_work","gather","confirm_send"].includes(t.state)||(this.job=void 0,this.step=0)}}const ye=`
2
+ :host{all:initial;--c:#F7F7F5;--s:#FFF;--r:#F0F0EC;--i:#1D2024;--m:#5D636B;--f:#6C727B;--l:rgb(29 32 36/12%);--a:#3D63C9;--ai:#FFF;--as:rgb(61 99 201/10%);--sh:0 1px 3px rgb(0 0 0/12%),0 4px 12px rgb(0 0 0/8%);
3
+ font:400 13px/1.45 Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--i);-webkit-font-smoothing:antialiased}
4
+ @media (prefers-color-scheme:dark){:host{--c:#111316;--s:#181B1F;--r:#20242A;--i:#E8EAED;--m:#A3A9B2;--f:#8A919B;--l:rgb(232 234 237/12%);--a:#7F9CF0;--ai:#111316;--as:rgb(127 156 240/14%)}}
5
+ *,*::before,*::after{box-sizing:border-box}
6
+ button,input,select{font:inherit;color:inherit}
7
+ button{cursor:pointer}
8
+ button:disabled,input:disabled{cursor:not-allowed;opacity:.55}
9
+ :focus-visible{outline:2px solid var(--a);outline-offset:2px}
10
+ [hidden]{display:none!important}
11
+ .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
12
+ .launcher{position:fixed;right:24px;bottom:24px;z-index:2147483646;width:56px;height:56px;border-radius:999px;border:0;background:var(--a);color:var(--ai);font-size:24px;font-weight:600;box-shadow:var(--sh)}
13
+ .panel{position:fixed;right:24px;bottom:92px;z-index:2147483646;width:min(360px,calc(100vw - 48px));height:min(600px,calc(100vh - 116px));display:flex;flex-direction:column;background:var(--s);border:1px solid var(--l);border-radius:10px;box-shadow:var(--sh);overflow:hidden}
14
+ .head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 16px;border-bottom:1px solid var(--l);background:var(--c)}
15
+ .head h2{margin:0;font-size:13px;font-weight:600}
16
+ .head p{margin:0;font-size:12px;color:var(--f)}
17
+ .x{width:44px;height:44px;border:0;border-radius:6px;background:transparent;color:var(--m);font-size:20px}
18
+ .log{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px}
19
+ .msg{max-width:85%;padding:8px 12px;border:1px solid var(--l);border-radius:12px;white-space:pre-wrap;overflow-wrap:anywhere}
20
+ .as{align-self:flex-start;background:var(--s);border-bottom-left-radius:2px}
21
+ .us{align-self:flex-end;background:var(--as);border-bottom-right-radius:2px}
22
+ .note{align-self:flex-start;margin:0;font-size:12px;color:var(--m)}
23
+ .card{align-self:flex-start;width:90%;padding:12px;border:1px solid var(--l);border-radius:10px;background:var(--c)}
24
+ .card h3{margin:0 0 4px;font-size:12px;font-weight:600;color:var(--a)}
25
+ .card p{margin:0 0 8px;color:var(--m)}
26
+ .row{display:flex;gap:8px;flex-wrap:wrap}
27
+ .btn{min-height:44px;padding:0 16px;border:1px solid var(--l);border-radius:6px;background:var(--s)}
28
+ .pri{background:var(--a);border-color:var(--a);color:var(--ai);font-weight:600}
29
+ .link{min-height:44px;padding:0 4px;border:0;background:none;color:var(--a);text-decoration:underline}
30
+ .foot{border-top:1px solid var(--l);padding:12px;display:flex;flex-direction:column;gap:8px;background:var(--s)}
31
+ .dyn{display:flex;flex-direction:column;gap:8px}.dyn:empty{display:none}
32
+ .chips{display:flex;flex-wrap:wrap;gap:6px}
33
+ .chip{min-height:44px;padding:0 12px;border:1px solid var(--l);border-radius:999px;background:var(--s);color:var(--m)}
34
+ .chip.job{border-color:var(--a);color:var(--a)}
35
+ .err{margin:0;padding:8px;border-radius:6px;background:var(--r);color:var(--i)}
36
+ .consent{margin:0;font-size:12px;color:var(--m)}
37
+ .consent.ask{color:var(--i);font-weight:600}
38
+ details{font-size:12px;color:var(--m)}
39
+ summary{cursor:pointer;min-height:24px}
40
+ .ctx{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px;padding:0;list-style:none}
41
+ .ctx li{display:flex;align-items:center;gap:2px;padding-left:8px;border:1px solid var(--l);border-radius:6px;background:var(--r);color:var(--i)}
42
+ .ctx li.fixed{padding-right:8px;min-height:32px}
43
+ .ctx button,.att button{width:32px;height:32px;border:0;background:none;color:var(--m)}
44
+ .team{display:flex;gap:8px;margin-top:6px}
45
+ .team label{display:flex;flex-direction:column;gap:2px;color:var(--i)}
46
+ .team select{min-height:32px;border:1px solid var(--l);border-radius:6px;background:var(--s)}
47
+ .atts{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
48
+ .att{position:relative;width:64px;height:48px;border:1px solid var(--l);border-radius:6px;overflow:hidden;background:var(--r)}
49
+ .att img{width:100%;height:100%;object-fit:cover}
50
+ .pt{display:flex;align-items:center;gap:2px;padding-left:8px;border:1px solid var(--l);border-radius:6px;background:var(--r);font-size:12px;max-width:100%;overflow-wrap:anywhere}
51
+ .pt button{width:32px;height:32px;border:0;background:none;color:var(--m)}
52
+ .att button{position:absolute;top:0;right:0;background:var(--i);color:var(--s);border-radius:0 0 0 6px}
53
+ .comp{position:relative;display:flex;gap:6px;align-items:center}
54
+ .comp input{flex:1;min-width:0;min-height:44px;padding:0 12px;border:1px solid var(--l);border-radius:6px;background:var(--c)}
55
+ .ico{width:44px;height:44px;flex:none;border:1px solid var(--l);border-radius:6px;background:var(--s);font-size:18px}
56
+ .send{background:var(--a);border-color:var(--a);color:var(--ai)}
57
+ .menu{position:absolute;left:0;right:0;bottom:52px;z-index:1;padding:4px;margin:0;list-style:none;background:var(--s);border:1px solid var(--l);border-radius:10px;box-shadow:var(--sh)}
58
+ .menu button{display:block;width:100%;min-height:44px;padding:4px 12px;border:0;border-radius:6px;background:none;text-align:left}
59
+ .menu button:hover,.menu button:focus-visible{background:var(--c)}
60
+ .menu small{display:block;color:var(--f)}
61
+ .dots{align-self:flex-start;color:var(--f)}
62
+ @media (max-width:640px){.panel{inset:0;width:auto;height:auto;border-radius:0;border:0}.launcher[aria-expanded=true]{display:none}}
63
+ @media (prefers-reduced-motion:reduce){*{transition-duration:1ms!important}}
64
+ `,we=["unreviewed","polished","needs_polish","broken"],_e=["low","medium","high","critical"],je=["didnt_work","gather","confirm_send","unmet_need"];function o(n,e={},...t){const i=document.createElement(n);for(const[r,d]of Object.entries(e))i.setAttribute(r,d);for(const r of t)r&&i.append(r);return i}function x(n,e,t,i={}){const r=o("button",{type:"button",class:e,...i},n);return r.addEventListener("click",t),r}function Ie(n,e,t){const i=e.t,r=o("button",{type:"button",class:"launcher","aria-label":i("launcher")||pe,"aria-expanded":"false","aria-controls":"jz-chat"},"?"),d=o("div",{class:"log",role:"log","aria-live":"polite","aria-label":i("conversation")}),u=o("div",{class:"dyn"});o("div");const s=o("input",{id:"jz-in",type:"text",autocomplete:"off",maxlength:"2000","aria-describedby":"jz-hint"}),z=o("span",{id:"jz-hint",class:"sr"}),k=o("button",{type:"button",class:"ico","aria-label":i("add_to_message"),"aria-haspopup":"menu","aria-expanded":"false","aria-controls":"jz-menu"},"+"),g=o("ul",{id:"jz-menu",class:"menu",role:"menu","aria-label":i("add_to_message")}),P=o("button",{type:"submit",class:"ico send","aria-label":i("send")},"➤"),F=o("form",{class:"comp"},g,k,o("label",{for:"jz-in",class:"sr"},i("message")),s,z,P),m=o("section",{id:"jz-chat",class:"panel",role:"dialog","aria-modal":"false","aria-labelledby":"jz-title"},o("header",{class:"head"},o("div",{},o("h2",{id:"jz-title"},i("title")),o("p",{},i("subtitle"))),x("✕","x",()=>c(),{"aria-label":i("close")})),d,o("div",{class:"foot"},u,F));m.hidden=true,g.hidden=true,n.append(r,m);let C=[],E=[];const M={ctx:false,team:false};r.addEventListener("click",()=>m.hidden?L():c()),s.addEventListener("input",()=>j()),F.addEventListener("submit",a=>{a.preventDefault(),e.sendText(s.value)&&(s.value="")}),k.addEventListener("click",()=>g.hidden?S():_(true)),g.addEventListener("keydown",a=>{const l=[...g.querySelectorAll("button")],b=l.indexOf(n.activeElement);a.key==="ArrowDown"||a.key==="ArrowUp"?(a.preventDefault(),l[(b+(a.key==="ArrowDown"?1:l.length-1))%l.length]?.focus()):a.key==="Tab"&&_(false)}),m.addEventListener("keydown",a=>{a.key==="Escape"&&(a.stopPropagation(),g.hidden?c():_(true))});function S(){g.replaceChildren(...e.plusItems().map(a=>{const l=o("button",{type:"button",role:"menuitem"},a.label,a.hint&&o("small",{},a.hint));return l.addEventListener("click",()=>{_(true),t.onPlusItem(a.id)}),o("li",{role:"none"},l)})),g.hidden=false,k.setAttribute("aria-expanded","true"),g.querySelector("button")?.focus()}function _(a){g.hidden=true,k.setAttribute("aria-expanded","false"),a&&k.focus()}function L(){e.reopen(),m.hidden=false,r.setAttribute("aria-expanded","true"),$(),(s.disabled?u.querySelector("button"):s)?.focus()}function c(){_(false),e.close(),m.hidden=true,r.setAttribute("aria-expanded","false"),r.focus()}function y(a){if(a.kind==="assistant")return o("div",{class:"msg as"},o("span",{class:"sr"},`${i("speaker.assistant")} `),a.text);if(a.kind==="user")return o("div",{class:"msg us"},o("span",{class:"sr"},`${i("speaker.you")} `),a.text);if(a.kind==="note")return o("p",{class:"note"},a.text);const l=`${a.job} · ${i(a.of?"card.step_of":"card.step",{step:a.step,of:a.of??""})}`,b=o("div",{class:"card",role:"group","aria-label":l},o("h3",{},l),a.title&&o("p",{},o("strong",{},a.title)),a.instruction&&o("p",{},a.instruction));if(a.live){const h=e.pending,A=x(e.label("guide_back"),"btn",()=>e.back(),{"data-back":""});A.disabled=h||a.step<=1;const I=x(e.label("guide_next"),"btn pri",()=>e.next());I.disabled=h;const w=x(e.label("didnt_work"),"link",()=>e.didntWork());w.disabled=h,b.append(o("div",{class:"row"},A,I),w)}return b}function O(){const a=e.entries;(a.length<E.length||a[0]!==E[0])&&(d.replaceChildren(),C=[],E=[]),a.forEach((l,b)=>{if(E[b]===l)return;const h=y(l);C[b]?l.kind==="card"?C[b].querySelectorAll(".row, .link").forEach(A=>A.remove()):C[b].replaceWith(h):(C[b]=h,d.append(h))}),a.forEach((l,b)=>{l.kind==="card"&&l.live&&C[b].querySelectorAll("button").forEach(h=>h.disabled=e.pending||h.hasAttribute("data-back")&&l.step<=1)}),E=[...a],d.querySelector(".dots")?.remove(),d.setAttribute("aria-busy",String(e.pending)),e.pending&&d.append(o("p",{class:"dots","aria-hidden":"true"},"…")),d.scrollTop=d.scrollHeight}function j(){const a=n.activeElement,l=a&&u.contains(a)?a.dataset.k:void 0,b=e.pending,h=[];e.error&&h.push(o("p",{class:"err",role:"status"},i(`error.${e.error}`)," ",x(i("try_again"),"link",()=>e.retry(),{"data-k":"retry"})));const A=e.tapOnly?e.chips():ue(e.chips(),s.value),I=e.offers("other_need");if(A.length>0||I){const v=o("div",{class:"chips",role:"group","aria-label":i("suggestions")});for(const f of A){const T=x(f.badge?`${f.title} · ${f.badge}`:f.title,"chip job",()=>e.pickJob(f),{"data-k":`job:${f.jobId}`});T.disabled=b,v.append(T)}if(I){const f=x(e.label("other_need"),"chip",()=>e.other(),{"data-k":"other"});f.disabled=b,v.append(f)}h.push(v)}const w=o("div",{class:"row"});if(e.offers("guide_back")&&e.state!=="guide_step"&&w.append(x(e.label("guide_back"),"btn",()=>e.back(),{"data-k":"back"})),e.offers("talk_to_assistant")&&w.append(x(e.label("talk_to_assistant"),"btn",()=>e.talk(),{"data-k":"talk"})),e.offers("send")&&w.append(x(e.label("send"),"btn pri",()=>e.sendReport(),{"data-k":"send",...e.needsConsent()?{"aria-describedby":"jz-consent"}:{}})),w.querySelectorAll("button").forEach(v=>v.disabled=b),w.childElementCount>0&&h.push(w),e.needsConsent()){const v=x(e.label("consent")||i("allow"),"link",()=>{e.allow(),s.focus()},{"data-k":"allow"});h.push(o("p",{id:"jz-consent",class:e.consentAsked?"consent ask":"consent"},`${i("consent_line")} · `,v))}if(je.includes(e.state)||e.offers("send")){const v=o("ul",{class:"ctx"});for(const f of e.contextChips()){const T=o("li",f.removable?{}:{class:"fixed"},f.label);f.removable&&T.append(x("✕","",()=>e.removeContext(f.key),{"aria-label":i("remove",{name:f.label}),"data-k":`ctx:${f.key}`})),v.append(T)}h.push(q("ctx",i("context.title"),v)),t.reviewer&&h.push(q("team",i("team.title"),D()))}if(e.attachments.length>0||e.anchor){const v=o("ul",{class:"atts","aria-label":i("attachments")});if(e.anchor){const f=i("pointed_at",{name:e.anchor.tflowId});v.append(o("li",{class:"pt"},f,x("✕","",()=>e.setAnchor(void 0),{"aria-label":i("remove",{name:f}),"data-k":"anchor"})))}e.attachments.forEach((f,T)=>{const B=f.label??i("attachment.screenshot",{n:T+1});v.append(o("li",{class:"att"},o("img",{src:f.thumbnail,alt:B}),x("✕","",()=>e.removeAttachment(f.id),{"aria-label":i("remove",{name:B}),"data-k":`att:${f.id}`})))}),h.push(v)}const X=e.state==="closed";s.disabled=e.tapOnly||X,s.placeholder=i(e.tapOnly?"input.tap_only":"input.placeholder"),z.textContent=e.tapOnly?i("input.paused"):"",P.disabled=s.disabled||b,k.hidden=e.plusItems().length===0,k.hidden&&!g.hidden&&_(false),u.replaceChildren(...h.filter(v=>!!v&&typeof v!="string")),e.consentAsked?u.querySelector("[data-k=allow]")?.focus():l&&(u.querySelector(`[data-k="${l}"]`)??(s.disabled?u.querySelector("button"):s))?.focus()}function q(a,l,b){const h=o("details",{},o("summary",{},l),b);return h.open=M[a],h.addEventListener("toggle",()=>M[a]=h.open),h}function D(){const a=(l,b,h,A)=>{const I=o("select",{},o("option",{value:""},"—"),...b.map(w=>o("option",{value:w},i(`team.${l}.${w}`))));return I.value=h??"",I.addEventListener("change",()=>A(I.value)),o("label",{},i(`team.${l}`),I)};return o("div",{class:"team"},a("verdict",we,e.team.verdict,l=>e.setTeam({verdict:l||void 0})),a("severity",_e,e.team.severity,l=>e.setTeam({severity:l||void 0})))}function $(){m.hidden||(O(),j())}const R=e.subscribe($);return{open:L,close:c,isOpen:()=>!m.hidden,suspend(){_(false);const a=!m.hidden;return m.hidden=true,r.hidden=true,()=>{r.hidden=false,a&&(m.hidden=false,$(),(k.hidden?s:k).focus())}},destroy(){R(),r.remove(),m.remove()}}}function H(n,e){if(n.journeyId)return{journeyId:n.journeyId,stepCount:n.stepCount??0};const t=e?n.personaGuides?.find(i=>i.persona===e&&i.journeyId):void 0;return t?.journeyId?{journeyId:t.journeyId,stepCount:t.stepCount??0}:void 0}const Ce=["desktop","tablet","mobile"];function N(n,e){const t=window.innerWidth,i=e.device&&Ce.includes(e.device)?e.device:t<768?"mobile":t<1024?"tablet":"desktop",r=n.signals?.appVersion;return{pagePath:n.pagePath==="none"?"":re(location.href).slice(0,512),persona:e.persona,browser:be(navigator.userAgent),device:i,viewport:{w:Math.min(t,2e4),h:Math.min(window.innerHeight,2e4)},build:r&&r.length<=64?r:void 0}}async function Ae(n,e,t){const i=await t?.(),r={siteKey:e.siteKey,...e.reviewerToken?{reviewerToken:e.reviewerToken}:{},...i?{claims:i}:{}};return U(n,"GetHelpIndex",r).then(d=>d.jobs??[])}function V(n,e,t){return n.flatMap(i=>{if(!i.jobId||!i.title)return[];const r=H(i,t)?.stepCount??i.stepCount;return[{type:"chip",jobId:i.jobId,title:i.title,label:i.title,badge:r?r===1?e("chip.one_step"):e("chip.steps",{n:r}):e("chip.no_guide"),...r?{steps:r}:{}}]})}function J(n,e,t={}){const i=te(n),r=n.claims!==void 0||n.getToken?import("./claims-VKhPNjA7.js").then(c=>c.claimsSource(n)):void 0,d=r&&(()=>r.then(c=>c.token()));d?.();const u=document.createElement("div");u.setAttribute("data-journeeze-chat","");const s=u.attachShadow({mode:"closed"}),z=document.createElement("style");z.textContent=ye,n.nonce&&(z.nonce=n.nonce),s.append(z),document.body.append(u);let k;const g=()=>k??(k=U(i,"GetWidgetConfig",{siteKey:n.siteKey}).catch(c=>{throw k=void 0,c})),P=(t.loadJobs??(()=>Ae(i,n,d)))().catch(()=>[]),F=new Map;let m,C;const E=c=>{m?.then(y=>{y&&!_&&c(y)})},M=c=>{C=c,c&&!m&&(m=import("./walk-BEGYyGG3.js").then(y=>y.createWalk({endpoint:i,siteKey:n.siteKey,reviewerToken:n.reviewerToken,claims:d,root:s,nonce:n.nonce,journeyFor:O=>F.get(O),loadGuide:t.loadGuide}),()=>{})),E(y=>y.walker.sync(C))};let S,_=false;const L=g().then(c=>c.copy,()=>{}).then(async c=>{if(_)return;const y=he(c),O=()=>n.reviewerToken||n.userId?void 0:null,j=new W({siteKey:n.siteKey,reviewer:!!n.reviewerToken,transport:t.transport??ce(i,n,void 0,d),t:y,facts:()=>N(n,e()),hasConsent:()=>ie(G(n),O()),giveConsent:()=>ne(G(n),O())}),q=a=>import("./attach-EfetX0Vi.js").then(l=>l.plusItem(a,{session:j,root:s,options:n,endpoint:i,claims:d,config:g,suspend:()=>D.suspend()}),()=>j.note(y("note.capture_unavailable"))),D=Ie(s,j,{reviewer:!!n.reviewerToken,onPlusItem:t.onPlusItem??(a=>{q(a)})});S={session:j,view:D};const $=await P,R=e().persona;for(const a of $){const l=a.jobId?H(a,R):void 0;l&&a.jobId&&F.set(a.jobId,l.journeyId)}j.subscribe(()=>M(j.guidePosition())),j.start(V($,y,R))});return{unmount(){_=true,m?.then(c=>c?.dispose()),r?.then(c=>c.stop()),S?.view.destroy(),u.remove()},report(){L.then(()=>{S?.view.open(),S?.session.reportProblem()})},contextChanged:()=>E(c=>c.walker.refresh()),addAttachment:c=>!!S?.session.addAttachment(c),removeAttachment:c=>S?.session.removeAttachment(c)}}const Ee=(n,e)=>J(n,()=>ae(e())),ze=Object.freeze(Object.defineProperty({__proto__:null,jobChips:V,mount:Ee,mountChat:J,pageFacts:N},Symbol.toStringTag,{value:"Module"}));export{xe as M,ze as c,K as u};
@@ -1 +1 @@
1
- import{w as f}from"./loader-k4pePzAw.js";const g=/^[A-Za-z0-9_-]{1,4000}\.[A-Za-z0-9_-]{43}$/,E=4096,A=60,S=15e3;function _(e){return typeof e=="string"&&e.length<=E&&g.test(e)}function p(e){try{const t=(e.split(".")[0]??"").replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(atob(t+"=".repeat((4-t.length%4)%4)))}catch{return{}}}const d=e=>typeof e=="number"&&Number.isInteger(e)?e:void 0;function M(e){return d(p(e).exp)}const l=new Map;function y(e,t=Date.now()){const i=p(e),r=d(i.exp),s=d(i.iat);if(r===void 0||s===void 0)return;let c=l.get(e);return c===void 0&&(l.size>=32&&l.clear(),l.set(e,c=t)),c+(r-s)*1e3}function a(e,t=0,i=Date.now()){if(!_(e))return;const r=y(e,i);return r!==void 0&&r-i>t*1e3?e:void 0}function N(e,t=Date.now){let i=false,r,s=-1/0;const c=async o=>{let n;s=t();try{n=await o()}catch{f("getToken failed")}if(!i)return a(n,0,t())?(e.claims=n,n):(n!==void 0&&f("invalid claims token ignored"),a(e.claims,0,t()))},m={token(){if(i)return Promise.resolve(void 0);const o=t(),n=a(e.claims,A,o);if(n)return Promise.resolve(n);const v=e.getToken,u=a(e.claims,0,o);return typeof v!="function"?(e.claims!==void 0&&!_(e.claims)&&f("invalid claims token ignored"),Promise.resolve(u)):!r&&u&&o-s<S?Promise.resolve(u):(r??(r=c(v).finally(()=>r=void 0)),r)},current(){if(!i)return m.token(),a(e.claims,0,t())},stop(){i=true}};return m}export{S as CLAIMS_MIN_REFRESH_INTERVAL_MS,A as CLAIMS_REFRESH_MARGIN_S,E as CLAIMS_TOKEN_MAX_LEN,g as CLAIMS_TOKEN_PATTERN,y as claimsEnd,M as claimsExp,N as claimsSource,a as usableClaims,_ as wellFormedClaims};
1
+ import{w as f}from"./loader-DHgG5Y7t.js";const g=/^[A-Za-z0-9_-]{1,4000}\.[A-Za-z0-9_-]{43}$/,E=4096,A=60,S=15e3;function _(e){return typeof e=="string"&&e.length<=E&&g.test(e)}function p(e){try{const t=(e.split(".")[0]??"").replace(/-/g,"+").replace(/_/g,"/");return JSON.parse(atob(t+"=".repeat((4-t.length%4)%4)))}catch{return{}}}const d=e=>typeof e=="number"&&Number.isInteger(e)?e:void 0;function M(e){return d(p(e).exp)}const l=new Map;function y(e,t=Date.now()){const i=p(e),r=d(i.exp),s=d(i.iat);if(r===void 0||s===void 0)return;let c=l.get(e);return c===void 0&&(l.size>=32&&l.clear(),l.set(e,c=t)),c+(r-s)*1e3}function a(e,t=0,i=Date.now()){if(!_(e))return;const r=y(e,i);return r!==void 0&&r-i>t*1e3?e:void 0}function N(e,t=Date.now){let i=false,r,s=-1/0;const c=async o=>{let n;s=t();try{n=await o()}catch{f("getToken failed")}if(!i)return a(n,0,t())?(e.claims=n,n):(n!==void 0&&f("invalid claims token ignored"),a(e.claims,0,t()))},m={token(){if(i)return Promise.resolve(void 0);const o=t(),n=a(e.claims,A,o);if(n)return Promise.resolve(n);const v=e.getToken,u=a(e.claims,0,o);return typeof v!="function"?(e.claims!==void 0&&!_(e.claims)&&f("invalid claims token ignored"),Promise.resolve(u)):!r&&u&&o-s<S?Promise.resolve(u):(r??(r=c(v).finally(()=>r=void 0)),r)},current(){if(!i)return m.token(),a(e.claims,0,t())},stop(){i=true}};return m}export{S as CLAIMS_MIN_REFRESH_INTERVAL_MS,A as CLAIMS_REFRESH_MARGIN_S,E as CLAIMS_TOKEN_MAX_LEN,g as CLAIMS_TOKEN_PATTERN,y as claimsEnd,M as claimsExp,N as claimsSource,a as usableClaims,_ as wellFormedClaims};
@@ -1 +1 @@
1
- var v=Object.defineProperty;var w=(e,t,n)=>t in e?v(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var u=(e,t,n)=>w(e,typeof t!="symbol"?t+"":t,n);import{CONTEXT_FIELDS as S,CONTEXT_VALUE_MAX_LEN as T,CONTEXT_ID_PATTERN as E,API_PATH_PATTERN as N}from"./contract.js";import{w as c,p as _}from"./loader-k4pePzAw.js";class m extends Error{constructor(n,r,o=0,i){super(r);u(this,"code");u(this,"status");u(this,"retryAfterMs");this.code=n,this.status=o,this.retryAfterMs=i}}const I="https://app.journeeze.dev",b=15e3;function C(e,t=b){return typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function"?{...e,signal:AbortSignal.timeout(t)}:e}function $(e,t=location.href){try{return new URL(e,t).origin!==new URL(t).origin}catch{return true}}const k="text/plain;charset=UTF-8";function A(e,t){return`${e.replace(/\/+$/,"")}/journeeze.collector.v1.CollectorService/${t}`}function O(e,t){const n=$(e)?{"content-type":k}:{"content-type":"application/json","connect-protocol-version":"1"};return t?{...n,"if-none-match":t}:n}function y(e,t,n,r,o){const i=C({method:"POST",headers:O(e,o.etag),body:JSON.stringify(n),credentials:"omit",cache:"no-store",referrerPolicy:"no-referrer",...o.keepalive?{keepalive:true}:{}});return r(A(e,t),i)}const x=6e4;function j(e,t=Date.now()){if(!e)return;const n=Number(e.trim()),r=Number.isFinite(n)&&/^\d+$/.test(e.trim())?n*1e3:Date.parse(e)-t;return Number.isFinite(r)?Math.min(Math.max(r,0),x):void 0}async function g(e){const t=await e.json().catch(()=>{});if(!e.ok){const n=typeof t?.code=="string"?t.code:M(e.status);throw new m(n,String(t?.message??e.statusText),e.status,j(e.headers.get("retry-after")))}if(t===void 0||typeof t!="object"||t===null)throw new m("unavailable","the collector did not answer with Connect JSON",e.status);return t}async function D(e,t,n,r=fetch,o={}){return g(await y(e,t,n,r,o.keepalive?{keepalive:true}:{}))}async function F(e,t,n,r,o=fetch){const i=await y(e,t,n,o,r?{etag:r}:{});if(i.status===304)return{notModified:true};const s=await g(i),a=i.headers.get("etag");return a?{notModified:false,value:s,etag:a}:{notModified:false,value:s}}function H(e,t){return t?`${e.replace(/\/+$/,"")}${t.startsWith("/")?"":"/"}${t}`:void 0}function M(e){return e===401?"unauthenticated":e===403?"permission_denied":e===409?"already_exists":e===412?"failed_precondition":e===429?"resource_exhausted":e===404||e===408||e>=500?"unavailable":e>=400?"invalid_argument":"unknown"}function X(e,t=location.href){const{endpoint:n,apiHost:r,apiPath:o}=e;if(n!==void 0)return c("endpoint is deprecated; use apiHost"),new URL(n,t).href.replace(/\/+$/,"");let i=I;if(r!==void 0){const s=r.replace(/\/$/,"");let a=false;try{const f=new URL(s);a=f.origin===s&&(f.protocol==="https:"||/^(localhost|127\.0\.0\.1)$/.test(f.hostname))}catch{}a?i=s:c("invalid apiHost ignored")}return o===void 0?i:N.test(o)?i+o:(c("invalid apiPath ignored"),i)}function z(e){const t={};for(const n of S){if(!(n in e))continue;const r=e[n]||void 0;if(r!==void 0&&(typeof r!="string"||r.length>T||/[\0-\x1f\x7f]/.test(r))){c(`context.${n} dropped (1..=128 printable characters)`),t[n]=void 0;continue}r!==void 0&&!E.test(r)&&c(`context.${n} should be an id`),t[n]=r}return t}const P=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$|[0-9a-f]{16}|@|^[\w-]{24,}$/i;function J(e){return _(e).split("/").map(t=>{let n=t;try{n=decodeURIComponent(t)}catch{}return P.test(n)?":id":t}).join("/")}function Y(e){const t=e.signature===void 0?e.userIdSig:e.signature?e.signature.sig:void 0,n=e.signature===void 0?e.userIdExp:e.signature?e.signature.exp:void 0;return typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t)?{}:typeof n!="number"||!Number.isInteger(n)||n*1e3<=Date.now()?{}:{userIdSig:t,userIdExp:n}}const d=1,q="Feedback mode captures the element you point at, a screenshot of this page with form fields hidden, your comment, and your persona and journey step. It never records keystrokes, form contents or query strings. Your feedback is visible to the project's review team.",V="Feedback mode captures the element you point at, your comment, and your persona and journey step. No screenshot is sent. It never records keystrokes, form contents or query strings. Your feedback is visible to the project's review team.",l=e=>`jz:consent:v${d}:${e}`,p=new Set,B=e=>e.userId?`${e.siteKey}:u:${e.userId}`:e.siteKey;function G(e,t=h()){p.delete(e);try{t?.removeItem(l(e))}catch{}}function h(){try{return window.localStorage}catch{return}}function K(e,t=h()){if(p.has(e))return true;try{const n=t?.getItem(l(e));return n?JSON.parse(n).v===d:false}catch{return false}}function W(e,t=h()){p.add(e);try{t?.setItem(l(e),JSON.stringify({v:d,at:new Date().toISOString()}))}catch{}}export{m as C,q as D,x as R,k as T,h as a,G as b,D as c,X as d,z as e,B as f,V as g,K as h,W as i,Y as j,F as k,H as l,A as r,J as s,C as w};
1
+ var v=Object.defineProperty;var w=(e,t,n)=>t in e?v(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var u=(e,t,n)=>w(e,typeof t!="symbol"?t+"":t,n);import{CONTEXT_FIELDS as S,CONTEXT_VALUE_MAX_LEN as T,CONTEXT_ID_PATTERN as E,API_PATH_PATTERN as N}from"./contract.js";import{w as c,p as _}from"./loader-DHgG5Y7t.js";class m extends Error{constructor(n,r,o=0,i){super(r);u(this,"code");u(this,"status");u(this,"retryAfterMs");this.code=n,this.status=o,this.retryAfterMs=i}}const I="https://app.journeeze.dev",b=15e3;function C(e,t=b){return typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function"?{...e,signal:AbortSignal.timeout(t)}:e}function $(e,t=location.href){try{return new URL(e,t).origin!==new URL(t).origin}catch{return true}}const k="text/plain;charset=UTF-8";function A(e,t){return`${e.replace(/\/+$/,"")}/journeeze.collector.v1.CollectorService/${t}`}function O(e,t){const n=$(e)?{"content-type":k}:{"content-type":"application/json","connect-protocol-version":"1"};return t?{...n,"if-none-match":t}:n}function y(e,t,n,r,o){const i=C({method:"POST",headers:O(e,o.etag),body:JSON.stringify(n),credentials:"omit",cache:"no-store",referrerPolicy:"no-referrer",...o.keepalive?{keepalive:true}:{}});return r(A(e,t),i)}const x=6e4;function j(e,t=Date.now()){if(!e)return;const n=Number(e.trim()),r=Number.isFinite(n)&&/^\d+$/.test(e.trim())?n*1e3:Date.parse(e)-t;return Number.isFinite(r)?Math.min(Math.max(r,0),x):void 0}async function g(e){const t=await e.json().catch(()=>{});if(!e.ok){const n=typeof t?.code=="string"?t.code:M(e.status);throw new m(n,String(t?.message??e.statusText),e.status,j(e.headers.get("retry-after")))}if(t===void 0||typeof t!="object"||t===null)throw new m("unavailable","the collector did not answer with Connect JSON",e.status);return t}async function D(e,t,n,r=fetch,o={}){return g(await y(e,t,n,r,o.keepalive?{keepalive:true}:{}))}async function F(e,t,n,r,o=fetch){const i=await y(e,t,n,o,r?{etag:r}:{});if(i.status===304)return{notModified:true};const s=await g(i),a=i.headers.get("etag");return a?{notModified:false,value:s,etag:a}:{notModified:false,value:s}}function H(e,t){return t?`${e.replace(/\/+$/,"")}${t.startsWith("/")?"":"/"}${t}`:void 0}function M(e){return e===401?"unauthenticated":e===403?"permission_denied":e===409?"already_exists":e===412?"failed_precondition":e===429?"resource_exhausted":e===404||e===408||e>=500?"unavailable":e>=400?"invalid_argument":"unknown"}function X(e,t=location.href){const{endpoint:n,apiHost:r,apiPath:o}=e;if(n!==void 0)return c("endpoint is deprecated; use apiHost"),new URL(n,t).href.replace(/\/+$/,"");let i=I;if(r!==void 0){const s=r.replace(/\/$/,"");let a=false;try{const f=new URL(s);a=f.origin===s&&(f.protocol==="https:"||/^(localhost|127\.0\.0\.1)$/.test(f.hostname))}catch{}a?i=s:c("invalid apiHost ignored")}return o===void 0?i:N.test(o)?i+o:(c("invalid apiPath ignored"),i)}function z(e){const t={};for(const n of S){if(!(n in e))continue;const r=e[n]||void 0;if(r!==void 0&&(typeof r!="string"||r.length>T||/[\0-\x1f\x7f]/.test(r))){c(`context.${n} dropped (1..=128 printable characters)`),t[n]=void 0;continue}r!==void 0&&!E.test(r)&&c(`context.${n} should be an id`),t[n]=r}return t}const P=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$|[0-9a-f]{16}|@|^[\w-]{24,}$/i;function J(e){return _(e).split("/").map(t=>{let n=t;try{n=decodeURIComponent(t)}catch{}return P.test(n)?":id":t}).join("/")}function Y(e){const t=e.signature===void 0?e.userIdSig:e.signature?e.signature.sig:void 0,n=e.signature===void 0?e.userIdExp:e.signature?e.signature.exp:void 0;return typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t)?{}:typeof n!="number"||!Number.isInteger(n)||n*1e3<=Date.now()?{}:{userIdSig:t,userIdExp:n}}const d=1,q="Feedback mode captures the element you point at, a screenshot of this page with form fields hidden, your comment, and your persona and journey step. It never records keystrokes, form contents or query strings. Your feedback is visible to the project's review team.",V="Feedback mode captures the element you point at, your comment, and your persona and journey step. No screenshot is sent. It never records keystrokes, form contents or query strings. Your feedback is visible to the project's review team.",l=e=>`jz:consent:v${d}:${e}`,p=new Set,B=e=>e.userId?`${e.siteKey}:u:${e.userId}`:e.siteKey;function G(e,t=h()){p.delete(e);try{t?.removeItem(l(e))}catch{}}function h(){try{return window.localStorage}catch{return}}function K(e,t=h()){if(p.has(e))return true;try{const n=t?.getItem(l(e));return n?JSON.parse(n).v===d:false}catch{return false}}function W(e,t=h()){p.add(e);try{t?.setItem(l(e),JSON.stringify({v:d,at:new Date().toISOString()}))}catch{}}export{m as C,q as D,x as R,k as T,h as a,G as b,D as c,X as d,F as e,z as f,B as g,K as h,V as i,W as j,Y as k,H as l,A as r,J as s,C as w};
package/dist/contract.js CHANGED
@@ -1,4 +1,4 @@
1
- import { S as t, U as A } from "./loader-k4pePzAw.js";
1
+ import { S as t, U as A } from "./loader-DHgG5Y7t.js";
2
2
  const T = /^(?:\/[A-Za-z0-9._~-]+)+$/, _ = 128, E = /^[a-z0-9._:-]{1,96}$/, e = ["persona", "journeyId", "journeyStep", "device", "businessType", "state"];
3
3
  export {
4
4
  T as API_PATH_PATTERN,
@@ -1 +1 @@
1
- var I=Object.defineProperty;var _=(s,e,t)=>e in s?I(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var h=(s,e,t)=>_(s,typeof e!="symbol"?e+"":e,t);import{C as w,a as v,c as f,b as q,d as x}from"./consent-BupCs23W.js";import{usableClaims as y}from"./claims-BfpRuIu-.js";const A=new Set(["invalid_argument","failed_precondition","permission_denied","unauthenticated","not_found","already_exists","unimplemented"]),g=50,O=1e3,T=6e4,b=1440*60*1e3;function L(s){return Math.min(T,O*2**Math.max(0,s))}function M(s){return s instanceof w&&A.has(s.code)}class D{constructor(e){h(this,"deps");h(this,"items",[]);h(this,"inFlight");h(this,"attempt",0);h(this,"flushing");h(this,"timer");h(this,"disposed",false);h(this,"schedule");h(this,"cancel");h(this,"now");this.deps=e,this.schedule=e.schedule??((t,i)=>setTimeout(t,i)),this.cancel=e.cancel??(t=>clearTimeout(t)),this.now=e.now??Date.now,this.claim()}get size(){return this.items.length}enqueue(e){return new Promise(t=>{const i={request:e,settle:t};this.add(i),this.flush().then(()=>{this.items.includes(i)&&u(i,"queued")})})}stash(e){this.add({request:e})}flush(){return this.disposed?Promise.resolve():(this.timer!==void 0&&(this.cancel(this.timer),this.timer=void 0),this.flushing?this.flushing.then(()=>this.timer===void 0?this.flush():void 0):(this.flushing=this.drain().finally(()=>{this.flushing=void 0}),this.flushing))}persist(){const e=this.items.filter(t=>t!==this.inFlight);if(!(e.length===0||!this.deps.storage))try{const t=this.read(),i=this.now(),n=this.deps.user?.(),a=[...t,...e.map(r=>({owner:this.deps.owner,request:r.request,at:r.at??i,...n?{user:n}:{}}))].slice(-g);this.deps.storage?.setItem(this.deps.storageKey,JSON.stringify(a));for(const r of e)u(r,"queued");this.items=this.items.filter(r=>r===this.inFlight)}catch{}}claim(){try{const e=this.read(),t=e.filter(n=>n.owner===this.deps.owner);if(t.length===0)return;const i=e.filter(n=>n.owner!==this.deps.owner);i.length===0?this.deps.storage?.removeItem(this.deps.storageKey):this.deps.storage?.setItem(this.deps.storageKey,JSON.stringify(i));for(const n of t)this.fresh(n)&&this.add({request:n.request,at:n.at})}catch{}}dispose(){this.persist(),this.disposed=true,this.timer!==void 0&&this.cancel(this.timer),this.timer=void 0}add(e){var t;for((t=e.request).submissionId??(t.submissionId=P()),this.items.push(e);this.items.length>g;){const i=this.items[0]===this.inFlight?1:0,[n]=this.items.splice(i,1);n&&u(n,"dropped")}}async drain(){for(;!this.disposed;){const e=this.items[0];if(!e){this.attempt=0;return}this.inFlight=e;try{await this.deps.send(e.request),this.remove(e),this.attempt=0,u(e,"sent")}catch(t){if(M(t)){this.remove(e),u(e,"dropped"),this.deps.onDropped?.(t);continue}if(this.disposed){this.inFlight=void 0,this.persist();return}const i=L(this.attempt++);this.timer=this.schedule(()=>{this.timer=void 0,this.flush()},i);return}finally{this.inFlight=void 0}}}fresh(e){return e.at===void 0?true:typeof e.at=="number"&&Number.isFinite(e.at)&&this.now()-e.at<=b}remove(e){const t=this.items.indexOf(e);t>=0&&this.items.splice(t,1)}read(){const e=this.deps.storage?.getItem(this.deps.storageKey),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(i=>typeof i=="object"&&i!==null&&typeof i.owner=="string"&&typeof i.request=="object"&&i.request!==null):[]}}function F(s){if(!s)return"";let e=2166136261;for(let t=0;t<s.length;t++)e^=s.charCodeAt(t),e=Math.imul(e,16777619)>>>0;return e.toString(16).padStart(8,"0")}function P(){return crypto.randomUUID()}function u(s,e){const t=s.settle;s.settle=void 0,t?.(e)}function C(s,e,t,i=Date.now()){try{const n=s?.getItem(e),a=n?JSON.parse(n):[],r=Array.isArray(a)?a:[],c=r.filter(o=>o?.owner===t),d=r.filter(o=>o?.owner!==t);return d.length===0?s?.removeItem(e):s?.setItem(e,JSON.stringify(d)),c.filter(o=>o.request&&(o.at===void 0||i-o.at<=b)).sort((o,l)=>(o.at??0)-(l.at??0)).map(o=>o.request)}catch{return[]}}const S=s=>F(s.reviewerToken||(s.userId?`u:${s.userId}`:void 0)),N=32*1024;async function z(s){const e=C(v(),`jz:outbox:v2:${s.siteKey}`,S(s));if(q(s.siteKey),e.length===0)return;const t=x(s);let i=N;const n=(c,d)=>f(t,"SubmitFeedback",c,fetch,{keepalive:d}),r=(await Promise.allSettled(e.map(c=>{const d=E(s,c,y(s.claims)),o=new Blob([JSON.stringify(d)]).size,l=o<=i;l&&(i-=o);const m=n(d,l);return l?m.catch(p=>p instanceof w?Promise.reject(p):n(d,false)):m}))).filter(c=>c.status==="rejected").length;r&&console.warn(`[journeeze] ${r} feedback item(s) could not be sent at logout and were discarded`)}function E(s,e,t){const i=s.reviewerToken?{...e,reviewerToken:s.reviewerToken}:{...e};if(t&&(i.claims=t),s.pagePath==="none"){const{pagePath:n,...a}=i.context;i.context=a}return i}function J(s,e,t={}){const i=d=>(t.claims?.(),f(e,"SubmitFeedback",E(s,d,y(s.claims)),fetch,{keepalive:true}).then(()=>{})),n=new D({send:i,storage:t.memoryOnly?void 0:v(),storageKey:`jz:outbox:v2:${s.siteKey}`,owner:S(s),user:()=>s.userId,...t.onDropped?{onDropped:t.onDropped}:{}}),a=()=>{n.flush()},r=()=>{t.beforePersist?.(),n.persist()},c=d=>{d.persisted&&(n.claim(),n.flush())};return window.addEventListener("online",a),window.addEventListener("pagehide",r),window.addEventListener("pageshow",c),{outbox:n,dispose(){window.removeEventListener("online",a),window.removeEventListener("pagehide",r),window.removeEventListener("pageshow",c),n.dispose()}}}function B(s,e){return f(s,"GetWidgetConfig",{siteKey:e})}export{J as feedbackChannel,z as logout,S as ownerOf,B as widgetConfig};
1
+ var I=Object.defineProperty;var _=(s,e,t)=>e in s?I(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var h=(s,e,t)=>_(s,typeof e!="symbol"?e+"":e,t);import{C as w,a as v,c as f,b as q,d as x}from"./consent-bPengyOI.js";import{usableClaims as y}from"./claims-VKhPNjA7.js";const A=new Set(["invalid_argument","failed_precondition","permission_denied","unauthenticated","not_found","already_exists","unimplemented"]),g=50,O=1e3,T=6e4,b=1440*60*1e3;function L(s){return Math.min(T,O*2**Math.max(0,s))}function M(s){return s instanceof w&&A.has(s.code)}class D{constructor(e){h(this,"deps");h(this,"items",[]);h(this,"inFlight");h(this,"attempt",0);h(this,"flushing");h(this,"timer");h(this,"disposed",false);h(this,"schedule");h(this,"cancel");h(this,"now");this.deps=e,this.schedule=e.schedule??((t,i)=>setTimeout(t,i)),this.cancel=e.cancel??(t=>clearTimeout(t)),this.now=e.now??Date.now,this.claim()}get size(){return this.items.length}enqueue(e){return new Promise(t=>{const i={request:e,settle:t};this.add(i),this.flush().then(()=>{this.items.includes(i)&&u(i,"queued")})})}stash(e){this.add({request:e})}flush(){return this.disposed?Promise.resolve():(this.timer!==void 0&&(this.cancel(this.timer),this.timer=void 0),this.flushing?this.flushing.then(()=>this.timer===void 0?this.flush():void 0):(this.flushing=this.drain().finally(()=>{this.flushing=void 0}),this.flushing))}persist(){const e=this.items.filter(t=>t!==this.inFlight);if(!(e.length===0||!this.deps.storage))try{const t=this.read(),i=this.now(),n=this.deps.user?.(),a=[...t,...e.map(r=>({owner:this.deps.owner,request:r.request,at:r.at??i,...n?{user:n}:{}}))].slice(-g);this.deps.storage?.setItem(this.deps.storageKey,JSON.stringify(a));for(const r of e)u(r,"queued");this.items=this.items.filter(r=>r===this.inFlight)}catch{}}claim(){try{const e=this.read(),t=e.filter(n=>n.owner===this.deps.owner);if(t.length===0)return;const i=e.filter(n=>n.owner!==this.deps.owner);i.length===0?this.deps.storage?.removeItem(this.deps.storageKey):this.deps.storage?.setItem(this.deps.storageKey,JSON.stringify(i));for(const n of t)this.fresh(n)&&this.add({request:n.request,at:n.at})}catch{}}dispose(){this.persist(),this.disposed=true,this.timer!==void 0&&this.cancel(this.timer),this.timer=void 0}add(e){var t;for((t=e.request).submissionId??(t.submissionId=P()),this.items.push(e);this.items.length>g;){const i=this.items[0]===this.inFlight?1:0,[n]=this.items.splice(i,1);n&&u(n,"dropped")}}async drain(){for(;!this.disposed;){const e=this.items[0];if(!e){this.attempt=0;return}this.inFlight=e;try{await this.deps.send(e.request),this.remove(e),this.attempt=0,u(e,"sent")}catch(t){if(M(t)){this.remove(e),u(e,"dropped"),this.deps.onDropped?.(t);continue}if(this.disposed){this.inFlight=void 0,this.persist();return}const i=L(this.attempt++);this.timer=this.schedule(()=>{this.timer=void 0,this.flush()},i);return}finally{this.inFlight=void 0}}}fresh(e){return e.at===void 0?true:typeof e.at=="number"&&Number.isFinite(e.at)&&this.now()-e.at<=b}remove(e){const t=this.items.indexOf(e);t>=0&&this.items.splice(t,1)}read(){const e=this.deps.storage?.getItem(this.deps.storageKey),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(i=>typeof i=="object"&&i!==null&&typeof i.owner=="string"&&typeof i.request=="object"&&i.request!==null):[]}}function F(s){if(!s)return"";let e=2166136261;for(let t=0;t<s.length;t++)e^=s.charCodeAt(t),e=Math.imul(e,16777619)>>>0;return e.toString(16).padStart(8,"0")}function P(){return crypto.randomUUID()}function u(s,e){const t=s.settle;s.settle=void 0,t?.(e)}function C(s,e,t,i=Date.now()){try{const n=s?.getItem(e),a=n?JSON.parse(n):[],r=Array.isArray(a)?a:[],c=r.filter(o=>o?.owner===t),d=r.filter(o=>o?.owner!==t);return d.length===0?s?.removeItem(e):s?.setItem(e,JSON.stringify(d)),c.filter(o=>o.request&&(o.at===void 0||i-o.at<=b)).sort((o,l)=>(o.at??0)-(l.at??0)).map(o=>o.request)}catch{return[]}}const S=s=>F(s.reviewerToken||(s.userId?`u:${s.userId}`:void 0)),N=32*1024;async function z(s){const e=C(v(),`jz:outbox:v2:${s.siteKey}`,S(s));if(q(s.siteKey),e.length===0)return;const t=x(s);let i=N;const n=(c,d)=>f(t,"SubmitFeedback",c,fetch,{keepalive:d}),r=(await Promise.allSettled(e.map(c=>{const d=E(s,c,y(s.claims)),o=new Blob([JSON.stringify(d)]).size,l=o<=i;l&&(i-=o);const m=n(d,l);return l?m.catch(p=>p instanceof w?Promise.reject(p):n(d,false)):m}))).filter(c=>c.status==="rejected").length;r&&console.warn(`[journeeze] ${r} feedback item(s) could not be sent at logout and were discarded`)}function E(s,e,t){const i=s.reviewerToken?{...e,reviewerToken:s.reviewerToken}:{...e};if(t&&(i.claims=t),s.pagePath==="none"){const{pagePath:n,...a}=i.context;i.context=a}return i}function J(s,e,t={}){const i=d=>(t.claims?.(),f(e,"SubmitFeedback",E(s,d,y(s.claims)),fetch,{keepalive:true}).then(()=>{})),n=new D({send:i,storage:t.memoryOnly?void 0:v(),storageKey:`jz:outbox:v2:${s.siteKey}`,owner:S(s),user:()=>s.userId,...t.onDropped?{onDropped:t.onDropped}:{}}),a=()=>{n.flush()},r=()=>{t.beforePersist?.(),n.persist()},c=d=>{d.persisted&&(n.claim(),n.flush())};return window.addEventListener("online",a),window.addEventListener("pagehide",r),window.addEventListener("pageshow",c),{outbox:n,dispose(){window.removeEventListener("online",a),window.removeEventListener("pagehide",r),window.removeEventListener("pageshow",c),n.dispose()}}}function B(s,e){return f(s,"GetWidgetConfig",{siteKey:e})}export{J as feedbackChannel,z as logout,S as ownerOf,B as widgetConfig};
@@ -0,0 +1,105 @@
1
+ var Z=Object.defineProperty;var ee=(n,e,t)=>e in n?Z(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var N=(n,e,t)=>ee(n,typeof e!="symbol"?e+"":e,t);import{s as te,F as G,R as ne}from"./hook-M34sajh9.js";import{d as Q}from"./anchor-bnZCZtbG.js";import{C as ie,l as D,c as X,s as J,d as se,D as re,j as oe,h as ae,g as de,f as ce}from"./consent-bPengyOI.js";import{a as le,H as ue}from"./highlight-pU9nE3Qj.js";import{f as Me}from"./highlight-pU9nE3Qj.js";const B=n=>n.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(Boolean);function M(n,e){const t=B(e);if(t.length===0)return[...n];const s=[];return n.forEach((i,a)=>{const l=B(i.title??""),h=B(i.goal??""),b=(i.stepTitles??[]).flatMap(B);let E=0;for(const A of t){const F=o=>o.some(g=>g.startsWith(A)),q=F(l)?3:F(h)?2:F(b)?1:0;if(q===0)return;E+=q}s.push([i,E,a])}),s.sort((i,a)=>a[1]-i[1]||i[2]-a[2]).map(([i])=>i)}const pe=4e3;function L(n){return n instanceof ie&&n.code==="failed_precondition"}class he{constructor(e){N(this,"deps");N(this,"current",{view:"closed"});N(this,"listeners",new Set);N(this,"entries",[]);N(this,"generation",0);N(this,"asked",new Set);N(this,"pending");N(this,"pendingSignal");this.deps=e}get state(){return this.current}subscribe(e){return this.listeners.add(e),e(this.current),()=>this.listeners.delete(e)}probe(){return this.deps.loadIndex().then(()=>{},e=>{L(e)&&this.disable()})}open(){if(this.current.view==="disabled")return;const e=++this.generation;this.deps.clearHighlight(),this.set({view:"index",status:"loading",query:"",results:[],total:0}),this.deps.loadIndex().then(t=>{if(e!==this.generation)return;this.entries=(t.guides??[]).filter(a=>a.journeyId);const s=this.current.view==="index"?this.current.query:"",i=(t.jobs??[]).filter(a=>a.jobId&&a.title);this.set({view:"index",status:"ready",query:s,results:M(this.entries,s),total:this.entries.length,jobs:i})},t=>{if(e!==this.generation)return;if(L(t))return this.disable();const s=this.current.view==="index"?this.current.query:"";this.set({view:"index",status:"error",query:s,results:[],total:0})})}close(){this.current.view!=="disabled"&&(this.generation++,this.pending=void 0,this.pendingSignal=void 0,this.deps.clearHighlight(),this.set({view:"closed"}))}search(e){const t=this.current;if(t.view!=="index")return;const s=t.status==="ready"?M(this.entries,e):[];this.set({...t,query:e,results:s})}openGuide(e){if(this.current.view==="disabled")return;const t=++this.generation;this.pending=void 0,this.deps.clearHighlight(),this.set({view:"guide",status:"loading",journeyId:e,step:0,anchor:"none",checkin:"idle"}),this.deps.loadGuide(e).then(s=>{if(t!==this.generation)return;const i=ge(s,e,this.deps.endpoint);if(i.steps.length===0){this.set({view:"guide",status:"error",journeyId:e,step:0,anchor:"none",checkin:"idle"});return}this.showStep(i,0)},s=>{if(t===this.generation){if(L(s))return this.disable();this.set({view:"guide",status:"error",journeyId:e,step:0,anchor:"none",checkin:"idle"})}})}disable(){this.generation++,this.pending=void 0,this.deps.clearHighlight(),this.set({view:"disabled"})}back(){const e=this.current;if(e.view==="finished")return this.showStep(e.guide,e.guide.steps.length-1);if(e.view!=="guide"||!e.guide)return this.open();if(e.step===0)return this.open();this.generation++,this.pending=void 0,this.showStep(e.guide,e.step-1)}next(){const e=this.current;if(e.view!=="guide"||e.status!=="ready"||!e.guide||e.checkin!=="idle")return;const t=e.guide.steps[e.step];if(t&&!this.asked.has(P(e.guide,t))){this.set({...e,checkin:"asking",notice:void 0});return}this.advance()}answer(e){const t=this.current;if(!(t.view!=="guide"||t.checkin!=="asking"&&t.checkin!=="needs-consent")){if(!this.deps.hasConsent()){this.pending=e,this.set({...t,checkin:"needs-consent"});return}this.send(e)}}skipCheckin(){const e=this.current;e.view!=="guide"||e.checkin!=="asking"&&e.checkin!=="needs-consent"||(this.pending=void 0,this.markAsked(e),this.set({...e,checkin:"idle"}),this.advance())}giveConsent(){const e=this.pendingSignal,t=this.current;if(e&&(t.view==="index"||t.view==="guide")&&t.signal==="needs-consent"){this.pendingSignal=void 0,this.deps.giveConsent(),this.sendSignalNow(e);return}const s=this.current;if(s.view!=="guide"||s.checkin!=="needs-consent"||!this.pending)return;this.deps.giveConsent();const i=this.pending;this.pending=void 0,this.send(i)}declineConsent(){const e=this.current;if(this.pendingSignal&&(e.view==="index"||e.view==="guide")&&e.signal==="needs-consent"){this.pendingSignal=void 0,this.patchSignal({signal:"idle"});return}this.skipCheckin()}canSignal(){return this.deps.signalsAllowed?.()??true}hasConsent(){return this.deps.hasConsent()}sendCallout(e){if(!this.canSignal())return;const t=this.current;if(t.view!=="guide"||t.status!=="ready"||!t.guide||$(t.signal))return;const s=t.guide.steps.find(i=>i.index===e);s&&this.signal({kind:"callout",guide:t.guide,step:s})}sendRequest(e,t){if(!this.canSignal())return;const s=e.trim();if(!s||[...s].length>pe)return;const i=this.current;i.view==="index"&&!$(i.signal)?this.signal(t?{kind:"request",text:s,jobRequest:t}:{kind:"request",text:s}):i.view==="guide"&&i.status==="ready"&&i.guide&&!$(i.signal)&&this.signal({kind:"request",text:s,guide:i.guide,step:i.guide.steps[i.step]})}signal(e){if(!this.deps.hasConsent()){this.pendingSignal=e,this.patchSignal({signal:"needs-consent",signalNotice:void 0});return}this.sendSignalNow(e)}patchSignal(e){const t=this.current;(t.view==="index"||t.view==="guide")&&this.set({...t,...e})}async sendSignalNow(e){const t=this.generation;this.patchSignal({signal:"sending",signalNotice:void 0});let s;try{s=await this.deps.sendSignal(e)}catch{s="dropped"}t===this.generation&&this.patchSignal({signal:"idle",signalNotice:s})}async send(e){const t=this.current;if(t.view!=="guide"||!t.guide)return;const s=t.guide.steps[t.step];if(!s)return;this.markAsked(t);const i=this.generation;this.set({...t,checkin:"sending"});let a;try{a=await this.deps.sendCheckin({guide:t.guide,step:s,answer:e})}catch{a="dropped"}if(i!==this.generation)return;const l=this.current;l.view==="guide"&&(this.set({...l,checkin:"idle"}),this.advance(a))}refreshHighlight(){const e=this.current;if(e.view!=="guide"||e.status!=="ready"||!e.guide)return;const t=this.anchorFor(e.guide,e.step);t!==e.anchor&&this.set({...e,anchor:t})}markAsked(e){if(e.view!=="guide"||!e.guide)return;const t=e.guide.steps[e.step];t&&this.asked.add(P(e.guide,t))}advance(e){const t=this.current;if(!(t.view!=="guide"||!t.guide)){if(t.step+1<t.guide.steps.length)return this.showStep(t.guide,t.step+1,e);this.deps.clearHighlight(),this.set({view:"finished",guide:t.guide,notice:e})}}showStep(e,t,s){const i=this.anchorFor(e,t);this.set({view:"guide",status:"ready",journeyId:e.journeyId,guide:e,step:t,anchor:i,checkin:"idle",notice:s})}anchorFor(e,t){const s=this.deps.highlight(e.steps[t]?.targets);return typeof s=="string"?s:(s.then(i=>{const a=this.current;a.view==="guide"&&a.guide===e&&a.step===t&&a.anchor!==i&&this.set({...a,anchor:i})}),"none")}set(e){this.current=e;for(const t of this.listeners)t(e)}}const P=(n,e)=>`${n.journeyId}/${e.index}`;function ge(n,e,t){const s=(n.steps??[]).map((i,a)=>({index:i.index??a,title:i.title??"",instruction:i.instruction??"",tflowId:i.tflowId||void 0,targets:ve(i),stepRef:i.stepRef||void 0,screenshotUrl:D(t,i.screenshotUrl),videoStartMs:i.videoStartMs,videoEndMs:i.videoEndMs})).sort((i,a)=>i.index-a.index);return{journeyId:n.journeyId??e,slug:n.slug??"",title:n.title??"",goal:n.goal??"",steps:s,videoUrl:D(t,n.videoUrl),captionsUrl:D(t,n.captionsUrl),version:n.contentVersion||void 0}}function $(n){return n==="needs-consent"||n==="sending"}const fe=/^(tflow|testId|role|css)$/;function ve(n){const e=(n.targets??[]).filter(t=>fe.test(t.strategy??"")&&t.value).map(t=>({by:t.strategy,value:t.value,name:t.name||void 0}));return e.length||!n.tflowId?e:[{by:"tflow",value:n.tflowId}]}function be(n,e,t,s){let i;return{start(){i??(i=import("./telemetry-CdwMjZZZ.js").then(a=>a.startTelemetry({endpoint:n,siteKey:e,subscribe:l=>t.subscribe(l),claims:s}),()=>{i=void 0}))},checkin:a=>{i?.then(l=>l?.checkin(a))},job:a=>{i?.then(l=>l?.job(a))},stop:a=>{i?.then(l=>l?.stop(a))}}}const Oe=`
2
+ :host { all: initial; }
3
+ .launcher { position:fixed; left:24px; bottom:24px; z-index:2147483646; width:44px; height:44px; border-radius:22px;
4
+ border:1px solid #1D2024; background:#1D2024; color:#FFFFFF; font:600 18px/1 system-ui,sans-serif; cursor:pointer; }
5
+ .panel { position:fixed; left:24px; bottom:80px; z-index:2147483646; width:min(340px, calc(100vw - 48px));
6
+ max-height:min(70vh, 560px); overflow:auto; box-sizing:border-box; padding:16px; border:1px solid rgb(29 32 36/12%);
7
+ border-radius:10px; background:#FFFFFF; color:#1D2024; font:14px/1.45 system-ui,sans-serif; box-shadow:0 8px 24px rgb(0 0 0/12%); }
8
+ .panel h2 { font-size:15px; margin:0 0 8px; }
9
+ .panel p { margin:0 0 8px; }
10
+ .panel ul { list-style:none; padding:0; margin:8px 0 0; }
11
+ .panel li button { display:block; width:100%; text-align:left; padding:8px; margin:0 0 4px; border:1px solid rgb(29 32 36/12%);
12
+ border-radius:6px; background:#FFFFFF; color:inherit; font:inherit; cursor:pointer; }
13
+ .panel input { width:100%; box-sizing:border-box; padding:8px; border:1px solid rgb(29 32 36/24%); border-radius:6px; font:inherit; }
14
+ .panel .row { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
15
+ .panel .row button { padding:6px 12px; border:1px solid #1D2024; border-radius:6px; background:#FFFFFF; color:#1D2024; font:inherit; cursor:pointer; }
16
+ .panel .muted { color:#5D636B; font-size:13px; }
17
+ .panel img { max-width:100%; border:1px solid rgb(29 32 36/12%); border-radius:6px; }
18
+ :focus-visible { outline:2px solid #3D63C9; outline-offset:2px; }
19
+ .jz-help-highlight { position:fixed; z-index:2147483645; pointer-events:none; box-sizing:border-box;
20
+ border:2px solid #3D63C9; border-radius:6px; box-shadow:0 0 0 4px rgb(61 99 201/20%); }
21
+ `;function u(n,e={},...t){const s=document.createElement(n);for(const[i,a]of Object.entries(e))s.setAttribute(i,a);for(const i of t)i&&s.append(i);return s}const K={sent:"Thanks. Your answer was sent.",queued:"Saved. It will send when you're back online.",dropped:"Your answer couldn't be sent."},xe=(n,e,t)=>{const s=u("button",{type:"button",class:"launcher","aria-label":"Help","aria-expanded":"false","aria-controls":"jz-help-panel"},"?"),i=u("div",{id:"jz-help-panel",class:"panel",role:"dialog","aria-modal":"false","aria-label":"Help"});i.hidden=true,n.append(s,i);let a="",l=false,h;s.addEventListener("click",()=>e.state.view==="closed"?e.open():e.close()),i.addEventListener("keydown",o=>{o.key==="Escape"&&(o.stopPropagation(),e.close())});const b=(o,g,f={})=>{const C=u("button",{type:"button",...f},o);return C.addEventListener("click",g),C};function E(o){const g=n.activeElement,f=g!==null&&i.contains(g),C=f?g.id:"";s.hidden=o.view==="disabled";const m=o.view!=="closed"&&o.view!=="disabled";if(s.setAttribute("aria-expanded",String(m)),i.hidden=!m,o.view==="index"&&h&&i.contains(h.input)){F(o),f&&g&&!g.isConnected&&(C&&n.getElementById(C)||h.input).focus(),l=m;return}if(h=void 0,i.replaceChildren(...(m?A(o):[]).filter(k=>!!k)),m&&(!l||f)){const y=(C?n.getElementById(C):null)??i.querySelector("input, [role=group] button, button");y?.focus(),y instanceof HTMLInputElement&&y.setSelectionRange(y.value.length,y.value.length)}!m&&l&&s.focus(),l=m}function A(o){if(o.view==="index"){const k=u("input",{id:"jz-help-search",type:"search","aria-label":"Search help",placeholder:"How do I…",autocomplete:"off"});return k.value=o.query,k.addEventListener("input",()=>e.search(k.value)),h={input:k,status:u("p",{class:"muted",role:"status"}),retry:u("div",{class:"row"},b("Try again",()=>e.open())),list:u("ul",{"aria-label":"Guides"})},F(o),[u("h2",{},"How do I…"),k,h.status,h.retry,h.list,u("div",{class:"row"},b("Close",()=>e.close()))]}if(o.view==="finished")return[u("h2",{},`You finished “${o.guide.title}”`),o.notice&&u("p",{class:"muted",role:"status"},K[o.notice]??""),u("div",{class:"row"},b("More guides",()=>e.open(),{id:"jz-help-more"}),b("Back",()=>e.back()),b("Close",()=>e.close()))];if(o.view!=="guide")return[];if(o.status!=="ready"||!o.guide)return[u("p",{role:"status"},o.status==="loading"?"Loading guide…":"This guide isn't available right now."),u("div",{class:"row"},b("Back",()=>e.open()),b("Close",()=>e.close()))];const g=o.guide,f=g.steps[o.step];if(!f)return[];const C=o.step+1===g.steps.length,m=[u("h2",{},g.title),u("p",{class:"muted"},`Step ${o.step+1} of ${g.steps.length}`),u("p",{},u("strong",{},f.title)),f.instruction&&u("p",{},f.instruction),o.anchor==="missing"&&u("p",{class:"muted"},"The part of the page this step uses isn't shown here. Follow the steps in the text."),f.screenshotUrl&&u("img",{referrerpolicy:"no-referrer",src:f.screenshotUrl,alt:`Screenshot for: ${f.title}`,loading:"lazy"}),o.notice&&u("p",{class:"muted",role:"status"},K[o.notice]??"")];if(o.checkin==="asking")m.push(u("div",{role:"group","aria-label":"Step check-in"},u("p",{},"Did this step make sense?"),u("div",{class:"row"},b("Understood",()=>e.answer("understood"),{id:"jz-help-yes"}),b("Confused",()=>e.answer("confused")),b("Skip",()=>e.skipCheckin()))));else if(o.checkin==="needs-consent"){const k=u("p",{},a||"Loading…");a||t.consentText().then(y=>{a=y,k.textContent=y}),m.push(u("div",{role:"group","aria-label":"Consent"},k,u("div",{class:"row"},b("Allow and send",()=>e.giveConsent(),{id:"jz-help-allow"}),b("Not now",()=>e.declineConsent()))))}else o.checkin==="sending"?m.push(u("p",{role:"status"},"Sending…")):m.push(u("div",{class:"row"},b("Back",()=>e.back()),b(C?"Finish":"Next",()=>e.next(),{id:"jz-help-next"}),b("Close",()=>e.close())));return m}function F(o){if(!h)return;const{input:g,status:f,retry:C,list:m}=h;g.value!==o.query&&n.activeElement!==g&&(g.value=o.query),f.textContent=o.status==="loading"?"Loading guides…":o.status==="error"?"Help isn't available right now.":o.results.length===0?o.query?`No guide matches “${o.query}”.`:"No guides yet.":"",f.hidden=f.textContent==="",C.hidden=o.status!=="error",m.replaceChildren(...o.results.map((k,y)=>u("li",{},b(k.title||"Untitled guide",()=>e.openGuide(k.journeyId??""),{id:`jz-help-g${y}`}),k.goal?u("p",{class:"muted"},k.goal):void 0)))}const q=e.subscribe(E);return{destroy(){q(),s.remove(),i.remove()}}},V="http://www.w3.org/2000/svg",me="M6.1 6.2a2 2 0 1 1 2.7 1.9c-.7.3-1 .6-1 1.3v.5H6.4v-.6c0-1.1.4-1.6 1.2-2 .5-.2.8-.5.8-1a1 1 0 0 0-2 0v.1H6.1zM7.2 11.4h1.6V13H7.2z";function we(n){const e=document.createElementNS(V,"svg");e.setAttribute("viewBox","0 0 16 16"),e.setAttribute("width","14"),e.setAttribute("height","14"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");const t=document.createElementNS(V,"path");return t.setAttribute("d",n),t.setAttribute("fill","currentColor"),e.append(t),e}function ke(n,e){const t=document.createElement("button");return t.type="button",t.id="jz-help-callout",t.className="callout-btn",t.append(we(me),document.createTextNode("This is confusing")),t.addEventListener("click",()=>n.sendCallout(e)),t}function ye(n,e){const t=document.createElement("form");t.setAttribute("aria-label","Ask for something you could not find");const s=document.createElement("p");s.textContent="Couldn't find it? Tell us what you were trying to do.";const i=document.createElement("textarea");i.id="jz-help-request",i.setAttribute("aria-label","What were you trying to do?"),i.maxLength=4e3,i.rows=3,i.value=`I couldn't find how to ${e}`;const a=document.createElement("button");return a.type="submit",a.id="jz-help-request-send",a.textContent="Send request",t.append(s,i,a),t.addEventListener("submit",l=>{l.preventDefault(),n.sendRequest(i.value)}),t}function d(n,e={},...t){const s=document.createElement(n);for(const[i,a]of Object.entries(e))s.setAttribute(i,a);for(const i of t)i&&s.append(i);return s}function O(n,e){const t=d(n,{...e,crossorigin:"anonymous"});return Object.assign(t,{referrerPolicy:"no-referrer"}),t.setAttribute("referrerpolicy","no-referrer"),t}const W="http://www.w3.org/2000/svg";function je(n){const e=document.createElementNS(W,"svg");e.setAttribute("viewBox","0 0 16 16"),e.setAttribute("width","14"),e.setAttribute("height","14"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");const t=document.createElementNS(W,"path");return t.setAttribute("d",n),t.setAttribute("fill","currentColor"),e.append(t),e}const ze="M6.2 11.4 3 8.2l1.1-1.1 2.1 2.1 4.6-4.6 1.1 1.1z",Ce="M6.1 6.2a2 2 0 1 1 2.7 1.9c-.7.3-1 .6-1 1.3v.5H6.4v-.6c0-1.1.4-1.6 1.2-2 .5-.2.8-.5.8-1a1 1 0 0 0-2 0v.1H6.1zM7.2 11.4h1.6V13H7.2z",R={sent:"Thanks. Your answer was sent.",queued:"Saved. It will send when you're back online.",dropped:"Your answer couldn't be sent."},Y={sent:"Thanks. We'll take a look.",queued:"Saved. It will send when you're back online.",dropped:"Your request couldn't be sent."},Se=(n,e,t)=>{const s=d("button",{type:"button",class:"launcher","aria-label":"Help","aria-expanded":"false","aria-controls":"jz-help-panel"},"?"),i=d("div",{id:"jz-help-panel",class:"panel",role:"dialog","aria-modal":"false","aria-label":"Help"});i.hidden=true,n.append(s,i);let a="",l=false,h,b,E,A,F=false;const q=r=>!F&&r.view==="index"&&r.status==="ready"&&!!r.jobs?.length;s.addEventListener("click",()=>e.state.view==="closed"?e.open():e.close()),i.addEventListener("keydown",r=>{r.key==="Escape"&&(r.stopPropagation(),e.close())});const o=(r,p,v={})=>{const j=d("button",{type:"button",...v},r);return j.addEventListener("click",p),j},g=()=>{const r=d("p",{},a||"Loading…");return a||t.consentText().then(p=>{a=p,r.textContent=p}),d("div",{class:"checkin",role:"group","aria-label":"Consent"},r,d("div",{class:"row"},o("Allow and send",()=>e.giveConsent(),{id:"jz-help-allow",class:"primary"}),o("Not now",()=>e.declineConsent())))},f=()=>d("div",{class:"panel-head"},d("h2",{},"Help"),o("×",()=>e.close(),{class:"icon-btn","aria-label":"Close help"})),C=(r,p,v)=>{const j=d("button",{type:"button",id:`jz-help-${p}`,class:`checkin-btn ${p}`});return j.append(je(p==="understood"?ze:Ce),d("span",{},r)),j.addEventListener("click",v),j};function m(r){const p=n.activeElement,v=p!==null&&i.contains(p),j=v?p.id:"";s.hidden=r.view==="disabled";const z=r.view!=="closed"&&r.view!=="disabled";if(s.setAttribute("aria-expanded",String(z)),i.hidden=!z,r.view==="index"&&!q(r)&&h&&i.contains(h.input)){y(r),v&&p&&!p.isConnected&&(j&&n.getElementById(j)||h.input).focus(),l=z;return}if(h=void 0,i.replaceChildren(...(z?k(r):[]).filter(x=>!!x)),z&&(!l||v)){const T=(j?n.getElementById(j):null)??i.querySelector("[data-autofocus]")??i.querySelector("input, [role=group] button, button");T?.focus(),T instanceof HTMLInputElement&&T.setSelectionRange(T.value.length,T.value.length)}!z&&l&&s.focus(),l=z}function k(r){if(E?.owns(r))return E.content(r);if(q(r))return A??(A=import("./jobs-CAXbM5-g.js").then(S=>{E=S.jobsUi({controller:e,options:t,el:d,button:o,consentGroup:g,rerender:()=>m(e.state),checkinNotice:R})},()=>{F=true}).then(()=>m(e.state))),[f(),d("p",{class:"muted",role:"status"},"Loading…")];if(r.view==="index"){const S=d("input",{id:"jz-help-search",type:"search","aria-label":"Search help",placeholder:"How do I…",autocomplete:"off"});return S.value=r.query,S.addEventListener("input",()=>e.search(S.value)),h={input:S,status:d("p",{class:"muted",role:"status"}),retry:d("div",{class:"row"},o("Try again",()=>e.open())),request:d("div",{class:"request"}),signal:d("div",{class:"signal"}),list:d("ul",{"aria-label":"Guides"})},y(r),[f(),S,h.status,h.retry,h.request,h.signal,h.list]}if(r.view==="finished")return[f(),d("h2",{},`You finished “${r.guide.title}”`),r.notice&&d("p",{class:"muted",role:"status"},R[r.notice]??""),d("div",{class:"row"},o("More guides",()=>e.open(),{id:"jz-help-more"}),o("Back",()=>e.back()),o("Close",()=>e.close()))];if(r.view!=="guide")return[];if(r.status!=="ready"||!r.guide)return[f(),d("p",{role:"status"},r.status==="loading"?"Loading guide…":"This guide isn't available right now."),d("div",{class:"row"},o("Back",()=>e.open()),o("Close",()=>e.close()))];const p=r.guide,v=p.steps[r.step];if(!v)return[];const j=r.step+1===p.steps.length,z=p.steps.length,x=d("div",{class:"progress","aria-hidden":"true"},d("div",{class:"progress-fill"})),T=x.firstElementChild;T.style.width=`${Math.round((r.step+1)/z*100)}%`;const H=[d("h2",{},p.title),d("p",{class:"muted"},`Step ${r.step+1} of ${z}`),x,d("p",{class:"step-title"},v.title),v.instruction&&d("p",{},v.instruction),r.anchor==="missing"&&d("p",{class:"muted"},"The part of the page this step uses isn't shown here. Follow the steps in the text."),v.screenshotUrl&&O("img",{src:v.screenshotUrl,alt:`Screenshot for: ${v.title}`,loading:"lazy"})];if(p.videoUrl){const S=O("video",{controls:"",preload:"none",src:p.videoUrl});p.captionsUrl&&S.append(O("track",{kind:"captions",src:p.captionsUrl,default:""})),H.push(S)}const w=[f(),d("div",{class:"card"},...H),r.notice&&d("p",{class:"muted",role:"status"},R[r.notice]??"")];return r.checkin==="asking"?w.push(d("div",{class:"checkin",role:"group","aria-label":"Step check-in"},d("p",{},"Did this step make sense?"),d("div",{class:"row"},C("Understood","understood",()=>e.answer("understood")),C("Confused","confused",()=>e.answer("confused")),o("Skip",()=>e.skipCheckin())))):r.checkin==="needs-consent"?w.push(g()):r.checkin==="sending"?w.push(d("p",{role:"status"},"Sending…")):(r.signal==="needs-consent"?w.push(g()):r.signal==="sending"?w.push(d("p",{role:"status"},"Sending…")):r.signalNotice&&w.push(d("p",{class:"muted",role:"status"},Y[r.signalNotice]??"")),e.canSignal()&&w.push(ke(e,v.index)),w.push(d("div",{class:"row"},o("Back",()=>e.back()),o(j?"Finish":"Next",()=>e.next(),{id:"jz-help-next"}),o("Close",()=>e.close())))),w}function y(r){if(!h)return;const{input:p,status:v,retry:j,request:z,signal:x,list:T}=h;if(p.value!==r.query&&n.activeElement!==p&&(p.value=r.query),v.textContent=r.status==="loading"?"Loading guides…":r.status==="error"?"Help isn't available right now.":r.results.length===0?r.query?`No guide matches “${r.query}”.`:"No guides yet.":"",v.hidden=v.textContent==="",j.hidden=r.status!=="error",r.status==="ready"&&r.query.trim()!==""&&r.results.length===0&&e.canSignal()){const w=r.query.trim();(b!==w||!z.firstElementChild)&&(b=w,z.replaceChildren(ye(e,w)))}else z.firstElementChild&&(b=void 0,z.replaceChildren());r.signal==="needs-consent"?x.replaceChildren(g()):r.signal==="sending"?x.replaceChildren(d("p",{role:"status"},"Sending…")):r.signalNotice?x.replaceChildren(d("p",{class:"muted",role:"status"},Y[r.signalNotice]??"")):x.firstElementChild&&x.replaceChildren(),T.replaceChildren(...r.results.map((w,S)=>d("li",{},o(w.title||"Untitled guide",()=>e.openGuide(w.journeyId??""),{id:`jz-help-g${S}`}),w.goal?d("p",{class:"muted"},w.goal):void 0)))}const U=e.subscribe(m);return{destroy(){U(),E?.destroy(),s.remove(),i.remove()}}},Ee=500,Ie=6e3;async function Fe(n,e){const t=e.trim();if(!t||[...t].length>Ee||!n.canSignal()||!n.hasConsent())return;const s={siteKey:n.siteKey,consentGiven:true,text:t};n.reviewerToken&&(s.reviewerToken=n.reviewerToken);let i;try{const a=await Promise.race([Promise.resolve(n.claims?.()).then(l=>(l&&(s.claims=l),X(n.endpoint,"RouteIntent",s,n.fetchImpl))),new Promise(l=>i=setTimeout(l,Ie))]);return a?.jobId?{jobId:a.jobId,journeyId:a.journeyId||void 0}:void 0}catch{return}finally{clearTimeout(i)}}const Te=`
22
+ :host {
23
+ all: initial;
24
+ --jz-canvas:#F7F7F5; --jz-surface:#FFFFFF; --jz-raised:#F0F0EC; --jz-ink:#1D2024; --jz-muted:#5D636B;
25
+ --jz-faint:#6C727B; --jz-rule:rgb(29 32 36 / 12%); --jz-accent:#3D63C9; --jz-accent-ink:#FFFFFF;
26
+ --jz-accent-soft:rgb(61 99 201 / 10%); --jz-polished:#2F7D4F; --jz-confused:#6E4FC2;
27
+ --jz-shadow:0 1px 3px rgb(0 0 0 / 12%);
28
+ font: 400 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
29
+ color: var(--jz-ink); -webkit-font-smoothing: antialiased;
30
+ }
31
+ @media (prefers-color-scheme: dark) {
32
+ :host {
33
+ --jz-canvas:#111316; --jz-surface:#181B1F; --jz-raised:#20242A; --jz-ink:#E8EAED; --jz-muted:#A3A9B2;
34
+ --jz-faint:#8A919B; --jz-rule:rgb(232 234 237 / 12%); --jz-accent:#7F9CF0; --jz-accent-ink:#111316;
35
+ --jz-accent-soft:rgb(127 156 240 / 14%); --jz-polished:#5DBB84; --jz-confused:#A48BEA;
36
+ }
37
+ }
38
+ *, *::before, *::after { box-sizing: border-box; }
39
+ button { font: inherit; color: inherit; cursor: pointer; }
40
+ :focus-visible { outline: 2px solid var(--jz-accent); outline-offset: 2px; }
41
+ button:disabled { opacity: .45; cursor: not-allowed; }
42
+ [hidden] { display: none !important; }
43
+
44
+ .launcher { position:fixed; left:24px; bottom:24px; z-index:2147483646; width:44px; height:44px; min-width:44px; min-height:44px;
45
+ display:flex; align-items:center; justify-content:center; padding:0; border:1px solid var(--jz-accent); border-radius:999px;
46
+ background:var(--jz-accent); color:var(--jz-accent-ink); font-size:18px; font-weight:600; box-shadow:var(--jz-shadow);
47
+ transition: background 180ms ease-out, transform 180ms ease-out; }
48
+ .launcher:hover, .launcher[aria-expanded="true"] { background:var(--jz-ink); border-color:var(--jz-ink); }
49
+
50
+ .panel { position:fixed; left:24px; bottom:80px; z-index:2147483646; width:min(360px, calc(100vw - 48px));
51
+ max-height:min(75vh, 580px); overflow:auto; padding:16px; border:1px solid var(--jz-rule); border-radius:10px;
52
+ background:var(--jz-surface); color:var(--jz-ink); box-shadow:var(--jz-shadow);
53
+ transition: opacity 180ms ease-out, transform 180ms ease-out; }
54
+ .panel-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
55
+ .panel-head h2 { margin:0; font-size:14px; font-weight:600; }
56
+ .icon-btn { width:44px; height:44px; min-width:44px; display:flex; align-items:center; justify-content:center; padding:0;
57
+ border:0; border-radius:6px; background:transparent; color:var(--jz-faint); transition: color 180ms ease-out, background 180ms ease-out; }
58
+ .icon-btn:hover { color:var(--jz-ink); background:var(--jz-raised); }
59
+
60
+ .panel input { width:100%; min-height:44px; padding:8px 12px; border:1px solid var(--jz-rule); border-radius:6px;
61
+ background:var(--jz-canvas); color:var(--jz-ink); font:inherit; }
62
+ .panel input::placeholder { color:var(--jz-faint); }
63
+ .panel ul { list-style:none; padding:0; margin:12px 0 0; }
64
+ .panel li { margin:0 0 8px; }
65
+ .panel li button { display:block; width:100%; min-height:44px; text-align:left; padding:8px 12px; border:1px solid var(--jz-rule);
66
+ border-radius:6px; background:var(--jz-surface); color:inherit; font:inherit; transition: background 180ms ease-out, border-color 180ms ease-out; }
67
+ .panel li button:hover { background:var(--jz-raised); border-color:var(--jz-accent); }
68
+ .muted { color:var(--jz-muted); font-size:12px; margin:4px 0 0; }
69
+ .row { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
70
+ .row button { min-height:44px; padding:0 16px; border:1px solid var(--jz-rule); border-radius:6px; background:var(--jz-surface);
71
+ color:var(--jz-muted); transition: background 180ms ease-out, color 180ms ease-out; }
72
+ .row button:hover { color:var(--jz-ink); background:var(--jz-raised); }
73
+ .row .primary { border-color:var(--jz-accent); background:var(--jz-accent); color:var(--jz-accent-ink); }
74
+
75
+ .card { border:1px solid var(--jz-rule); border-radius:10px; padding:16px; }
76
+ .card h2 { margin:0 0 8px; font-size:14px; font-weight:600; }
77
+ .progress { height:4px; margin:8px 0 12px; border-radius:999px; background:var(--jz-raised); overflow:hidden; }
78
+ .progress-fill { height:100%; border-radius:999px; background:var(--jz-accent); transition: width 180ms ease-out; }
79
+ .step-title { margin:0 0 8px; font-weight:600; }
80
+ .panel img, .panel video { max-width:100%; margin-top:12px; border:1px solid var(--jz-rule); border-radius:6px; }
81
+
82
+ .checkin { margin-top:12px; padding-top:12px; border-top:1px solid var(--jz-rule); }
83
+ .checkin p { margin:0 0 8px; }
84
+ .callout-btn { display:inline-flex; align-items:center; gap:6px; margin-top:12px; min-height:44px; padding:0 16px;
85
+ border:1px solid var(--jz-confused); border-radius:6px; background:var(--jz-surface); color:var(--jz-confused);
86
+ transition: background 180ms ease-out, color 180ms ease-out; }
87
+ .callout-btn:hover { background:var(--jz-raised); }
88
+ .callout-btn svg { flex:none; }
89
+ .request { margin-top:12px; }
90
+ .request p { margin:0 0 8px; color:var(--jz-muted); font-size:12px; }
91
+ .request textarea { display:block; width:100%; padding:8px 12px; border:1px solid var(--jz-rule); border-radius:6px;
92
+ background:var(--jz-canvas); color:var(--jz-ink); font:inherit; resize:vertical; }
93
+ .request button { margin-top:8px; min-height:44px; padding:0 16px; border:1px solid var(--jz-accent);
94
+ border-radius:6px; background:var(--jz-accent); color:var(--jz-accent-ink); }
95
+ .checkin-btn { display:inline-flex; align-items:center; gap:6px; }
96
+ .checkin-btn.understood { color:var(--jz-polished); border-color:var(--jz-polished); }
97
+ .checkin-btn.confused { color:var(--jz-confused); border-color:var(--jz-confused); }
98
+ .checkin-btn svg { flex:none; }
99
+
100
+ @media (prefers-reduced-motion: reduce) {
101
+ :host *, :host *::before, :host *::after { animation-duration:1ms !important; transition-duration:1ms !important; }
102
+ }
103
+ .jz-help-highlight { position:fixed; z-index:2147483645; pointer-events:none; box-sizing:border-box;
104
+ border:2px solid var(--jz-accent); border-radius:6px; box-shadow:0 0 0 4px var(--jz-accent-soft); }
105
+ `;function _(n,e,t,s,i){const a={journeyId:e.slug||e.journeyId,journeyStep:String(t.index),pagePath:J(s),device:n.device||Q(i)};return n.persona&&(a.persona=n.persona),n.businessType&&(a.businessType=n.businessType),n.state&&(a.state=n.state),t.tflowId&&(a.tflowId=t.tflowId),a}function Ae(n,e,t,s){return _(n,e.guide,e.step,t,s)}function qe(n,e,t){const s={pagePath:J(e),device:n.device||Q(t)};return n.persona&&(s.persona=n.persona),n.journeyId&&(s.journeyId=n.journeyId),n.journeyStep&&(s.journeyStep=n.journeyStep),n.businessType&&(s.businessType=n.businessType),n.state&&(s.state=n.state),s}function Ne(n,e,t,s,i){if(t.kind==="callout")return{siteKey:n,consentGiven:true,kind:G.callout,context:_(e,t.guide,t.step,s,i)};const a=t.guide&&t.step?_(e,t.guide,t.step,s,i):qe(e,s,i),l={siteKey:n,consentGiven:true,kind:G.request,comment:t.text,context:a};return t.jobRequest&&(l.jobRequest=t.jobRequest),l}function He(n,e,t=xe){const s=se(n),i=n.claims!==void 0||n.getToken?import("./claims-VKhPNjA7.js").then(c=>c.claimsSource(n)):void 0,a=i&&(()=>i.then(c=>c.token()));a?.();let l,h;i?.then(c=>h=c);const b=new le({endpoint:s,siteKey:n.siteKey,reviewerToken:n.reviewerToken,claims:a});let E;const A=X(s,"GetWidgetConfig",{siteKey:n.siteKey}).then(c=>E=c,()=>{}),F=()=>!n.reviewerToken&&!n.userId,q=()=>F()&&E?.helpAudience!="reviewers",o=document.createElement("div");o.setAttribute("data-journeeze-help","");const g=o.attachShadow({mode:"closed"}),f=document.createElement("style");f.textContent=Te,n.nonce&&(f.nonce=n.nonce),g.append(f);const C=new ue(g);document.body.append(o);let m;const k=c=>(m??(m=import("./feedback-DeMvbZnh.js").then(I=>I.feedbackChannel(n,s,{memoryOnly:q(),claims:a})))).then(I=>I.outbox.enqueue(c),()=>"dropped");let y,U=false;const r=()=>de(n),p=()=>q()?null:void 0,v=()=>ae(r(),p()),j=te(n,s,e),z=()=>{U&&x.state.view!=="disabled"&&v()&&(y?.start(),j.start(A))},x=new he({endpoint:s,loadIndex:()=>b.index().then(c=>(l=c.persona||void 0,c)),loadGuide:c=>b.guide(c),highlight:c=>C.show(c),clearHighlight:()=>C.hide(),hasConsent:v,giveConsent(){oe(r(),p()),z()},signalsAllowed:()=>!F()||E?.anonymousAllowed==true,sendCheckin(c){return v()?(y?.checkin(c),k({siteKey:n.siteKey,consentGiven:true,context:Ae(e(),c,location.href,window.innerWidth),reaction:ne[c.answer]})):Promise.resolve("dropped")},sendSignal(c){return!x.canSignal()||!v()?Promise.resolve("dropped"):k(Ne(n.siteKey,e(),c,location.href,window.innerWidth))}});n.noTelemetry||(y=be(s,n.siteKey,x,()=>h?.current())),x.subscribe(z);let T,H=false,w;const S=c=>{const I=c.available?"on":c.reason;if(!(H||I===w)){w=I;try{n.onHelpStatus?.(c)}catch{}}};return x.subscribe(()=>{w!==void 0&&x.state.view==="disabled"&&S({available:false,reason:"disabled"})}),Promise.all([x.probe(),A]).then(()=>{if(!H){if(x.state.view==="disabled")return S({available:false,reason:"disabled"});S(E?.helpAudience=="reviewers"&&!n.reviewerToken?{available:false,reason:"audience"}:{available:true}),U=true,z(),T=t(g,x,{consentText:()=>A.then(c=>c?.consentText||re),persona:()=>l??e().persona,jobEvent(c){U&&x.state.view!=="disabled"&&v()&&y?.job(c)},routeIntent:c=>Fe({endpoint:s,siteKey:n.siteKey,reviewerToken:n.reviewerToken,claims:a,hasConsent:v,canSignal:()=>x.canSignal()},c),addStyle(c){const I=document.createElement("style");I.textContent=c,n.nonce&&(I.nonce=n.nonce),g.append(I)}})}}),{unmount(c){H=true,i?.then(I=>I.stop()),x.close(),y?.stop(c),j.stop(c),T?.destroy(),C.dispose(),o.remove(),m?.then(I=>I.dispose())},contextChanged:()=>{x.refreshHighlight(),j.contextChanged()}}}const Re=(n,e)=>He(n,()=>ce(e()),Se);export{le as HelpClient,he as HelpController,ue as Highlighter,pe as MAX_REQUEST_CHARS,Oe as PANEL_CSS,Ae as checkinContext,Me as findAnchor,_ as guideStepContext,L as isHelpDisabled,Re as mount,He as mountHelp,qe as pageContext,xe as placeholderView,M as searchGuides,Ne as signalRequest,ge as toView};
@@ -0,0 +1,2 @@
1
+ var g=Object.defineProperty;var w=(n,t,e)=>t in n?g(n,t,{enumerable:true,configurable:true,writable:true,value:e}):n[t]=e;var s=(n,t,e)=>w(n,typeof t!="symbol"?t+"":t,e);import{e as x}from"./consent-bPengyOI.js";import{T as m}from"./loader-DHgG5Y7t.js";const b=6e4;class L{constructor(t){s(this,"opts");s(this,"indexEntry");s(this,"guides",new Map);s(this,"inflight",new Map);s(this,"now");s(this,"freshMs");this.opts=t,this.now=t.now??Date.now,this.freshMs=t.freshMs??6e4}index(){return this.read("index","GetHelpIndex",{},()=>this.indexEntry,t=>this.indexEntry=t,()=>false)}guide(t){return this.read(`guide:${t}`,"GetGuide",{journeyId:t},()=>this.guides.get(t),e=>this.guides.set(t,e),e=>{const i=e.linksExpireAt?Date.parse(e.linksExpireAt):NaN;return Number.isFinite(i)&&i-this.now()<b})}body(t,e){const i=this.opts.reviewerToken;return{siteKey:this.opts.siteKey,...t,...i&&{reviewerToken:i},...e&&{claims:e}}}read(t,e,i,o,u,h){const a=this.opts.claims;return a?a().then(d=>this.readWith(t,e,i,d,o,u,h)):this.readWith(t,e,i,void 0,o,u,h)}readWith(t,e,i,o,u,h,a){const d=u(),r=d&&d.claims===o?d:void 0;if(r&&this.now()-r.at<this.freshMs&&!a(r.value))return Promise.resolve(r.value);const c=`${t}
2
+ ${o??""}`,f=this.inflight.get(c);if(f)return f;const v=r&&!a(r.value)?r.etag:void 0,p=x(this.opts.endpoint,e,this.body(i,o),v,this.opts.fetchImpl).then(l=>{if(l.notModified){if(!r)throw new Error("304 without a cached value");return h({...r,at:this.now()}),r.value}return h({value:l.value,etag:l.etag,at:this.now(),claims:o}),l.value}).finally(()=>this.inflight.delete(c));return this.inflight.set(c,p),p}}const M=()=>import("./resolve-CRDmtd4b.js");function E(n,t=document){if(m.test(n))for(const e of t.querySelectorAll(`[data-tflow-id="${n}"]`)){const i=e.getBoundingClientRect();if(i.width>0||i.height>0)return e}}function y(n=window){try{return n.matchMedia?.("(prefers-reduced-motion: reduce)").matches??false}catch{return false}}class N{constructor(t,e=window,i=M){s(this,"win");s(this,"load");s(this,"target");s(this,"box");s(this,"onMove",()=>this.place());s(this,"seq",0);this.win=e,this.load=i,this.box=e.document.createElement("div"),this.box.className="jz-help-highlight",this.box.setAttribute("aria-hidden","true"),this.box.hidden=true,t.append(this.box)}show(t){this.hide();const e=this.seq,[i]=t??[];return i?t?.length===1&&i.by==="tflow"?this.outline(E(i.value,this.win.document)):this.load().then(o=>e===this.seq?this.outline(o.resolveTarget(t??[],this.win.document)):"none",()=>"missing"):"none"}outline(t){return t?(this.target=t,t.scrollIntoView?.({block:"center",inline:"nearest",behavior:y(this.win)?"auto":"smooth"}),this.win.addEventListener("scroll",this.onMove,{capture:true,passive:true}),this.win.addEventListener("resize",this.onMove,{passive:true}),this.box.hidden=false,this.place(),"found"):"missing"}hide(){this.seq++,this.target&&(this.target=void 0,this.box.hidden=true,this.win.removeEventListener("scroll",this.onMove,{capture:true}),this.win.removeEventListener("resize",this.onMove))}dispose(){this.hide(),this.box.remove()}place(){if(!this.target)return;if(!this.target.isConnected)return this.hide();const t=this.target.getBoundingClientRect();Object.assign(this.box.style,{left:`${t.left-4}px`,top:`${t.top-4}px`,width:`${t.width+8}px`,height:`${t.height+8}px`})}}export{N as H,L as a,E as f};
@@ -1 +1 @@
1
- const u={like:"REACTION_LIKE",dislike:"REACTION_DISLIKE",understood:"REACTION_UNDERSTOOD",confused:"REACTION_CONFUSED"},E={request:"FEEDBACK_KIND_REQUEST",callout:"FEEDBACK_KIND_CALLOUT"},o=new WeakMap;function I(n,a,d){let i=o.get(n);i||o.set(n,i={holders:0});const e=i;let r=false;return{start(t){r||n.signals?.enabled!==true||n.noTelemetry||(r=true,e.holders++,e.running??(e.running=Promise.resolve(t).then(s=>{if(s?.signalsEnabled===true)return import("./signals-eaZX2lNd.js").then(l=>l.startSignals({options:n,endpoint:a,getContext:d,site:s}),()=>{e.running=void 0})})))},stop(t){if(!r||(r=false,--e.holders>0))return;const s=e.running;e.running=void 0,s?.then(l=>l?.stop(t))},contextChanged(){r&&e.running?.then(t=>t?.contextChanged())}}}export{E as F,u as R,I as s};
1
+ const u={like:"REACTION_LIKE",dislike:"REACTION_DISLIKE",understood:"REACTION_UNDERSTOOD",confused:"REACTION_CONFUSED"},E={request:"FEEDBACK_KIND_REQUEST",callout:"FEEDBACK_KIND_CALLOUT"},o=new WeakMap;function I(n,a,d){let i=o.get(n);i||o.set(n,i={holders:0});const e=i;let r=false;return{start(t){r||n.signals?.enabled!==true||n.noTelemetry||(r=true,e.holders++,e.running??(e.running=Promise.resolve(t).then(s=>{if(s?.signalsEnabled===true)return import("./signals-C_WxFykA.js").then(l=>l.startSignals({options:n,endpoint:a,getContext:d,site:s}),()=>{e.running=void 0})})))},stop(t){if(!r||(r=false,--e.holders>0))return;const s=e.running;e.running=void 0,s?.then(l=>l?.stop(t))},contextChanged(){r&&e.running?.then(t=>t?.contextChanged())}}}export{E as F,u as R,I as s};
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c as s, i as t, p as o, t as r, a as i } from "./loader-k4pePzAw.js";
1
+ import { c as s, i as t, p as o, t as r, a as i } from "./loader-DHgG5Y7t.js";
2
2
  export {
3
3
  s as createJourneeze,
4
4
  t as isMasked,
@@ -14,7 +14,7 @@ function I(e) {
14
14
  } catch {
15
15
  }
16
16
  }
17
- const E = /^(?:[0-9a-f]{64}|[A-Za-z0-9_-]{43})$/, k = /^pk_[0-9a-f]{32}$/, T = () => import("./widget-CcAalO4B.js"), C = () => import("./help-D_T0HiNa.js"), _ = () => import("./chat-ByOXN5k1.js").then((e) => e.c), w = /* @__PURE__ */ new Set();
17
+ const E = /^(?:[0-9a-f]{64}|[A-Za-z0-9_-]{43})$/, k = /^pk_[0-9a-f]{32}$/, T = () => import("./widget-BA2WH0yi.js"), C = () => import("./help-phTc32Gg.js"), _ = () => import("./chat-Coze4aH0.js").then((e) => e.c), w = /* @__PURE__ */ new Set();
18
18
  function p(e) {
19
19
  w.has(e) || (w.add(e), console.warn(`[journeeze] ${e}`));
20
20
  }
@@ -78,7 +78,7 @@ function R(e, t = T, a = e.chat ? _ : C) {
78
78
  }),
79
79
  reset: h("reset", () => {
80
80
  const s = !!i.mounted(), d = { ...o, userId: c };
81
- r.off(!0), i.off(!0), c = void 0, u = {}, delete o.reviewerToken, delete o.claims, I(n), import("./feedback-DtMDnAam.js").then((m) => m.logout(d)).catch(() => {
81
+ r.off(!0), i.off(!0), c = void 0, u = {}, delete o.reviewerToken, delete o.claims, I(n), import("./feedback-DeMvbZnh.js").then((m) => m.logout(d)).catch(() => {
82
82
  }).then(() => {
83
83
  s && !i.mounted() && i.on().catch(() => {
84
84
  });
@@ -1,4 +1,4 @@
1
- import{c as f,s as d}from"./consent-BupCs23W.js";import{w as h}from"./loader-k4pePzAw.js";const l=50,m=/^[a-z0-9._:-]{1,96}$/,g=/^\[data-tflow-id="([^"\\]*)"\]$/,k=/^[\x20-\x7e]{1,200}$/,w=/[{};@\\<`]|\/\*|::/,s=new Set;function $(e,n,r){const t=g.exec(e.selector)?.[1];if(t!==void 0&&m.test(t))return{anchor:t,pagePath:n,rule:e.rule,detectedAt:r};if(!(!k.test(e.selector)||w.test(e.selector)))return{selector:e.selector,pagePath:n,rule:e.rule,detectedAt:r}}function y(e){return n=>n.hasAttribute("data-jz-mask")||e.some(r=>{try{return n.matches(r)}catch{return true}})}function S(e,n){return n==="none"?"/":d(e)}function O(e,n,r,t,o,c){const a=S(r,c),u=o.toISOString();return e(n,y(t)).map(i=>$(i,a,u)).filter(i=>i!==void 0)}async function v(e){const r=O(e.scan,document.body,location.href,e.maskSelectors??[],(e.now??(()=>new Date))(),e.pagePath).filter(t=>{const o=`${t.pagePath}
1
+ import{c as f,s as d}from"./consent-bPengyOI.js";import{w as h}from"./loader-DHgG5Y7t.js";const l=50,m=/^[a-z0-9._:-]{1,96}$/,g=/^\[data-tflow-id="([^"\\]*)"\]$/,k=/^[\x20-\x7e]{1,200}$/,w=/[{};@\\<`]|\/\*|::/,s=new Set;function $(e,n,r){const t=g.exec(e.selector)?.[1];if(t!==void 0&&m.test(t))return{anchor:t,pagePath:n,rule:e.rule,detectedAt:r};if(!(!k.test(e.selector)||w.test(e.selector)))return{selector:e.selector,pagePath:n,rule:e.rule,detectedAt:r}}function y(e){return n=>n.hasAttribute("data-jz-mask")||e.some(r=>{try{return n.matches(r)}catch{return true}})}function S(e,n){return n==="none"?"/":d(e)}function O(e,n,r,t,o,c){const a=S(r,c),u=o.toISOString();return e(n,y(t)).map(i=>$(i,a,u)).filter(i=>i!==void 0)}async function v(e){const r=O(e.scan,document.body,location.href,e.maskSelectors??[],(e.now??(()=>new Date))(),e.pagePath).filter(t=>{const o=`${t.pagePath}
2
2
  ${t.anchor??t.selector}
3
3
  ${t.rule}`;return s.has(o)?false:(s.add(o),true)});for(let t=0;t<r.length;t+=l){const o=r.slice(t,t+l);try{await f(e.endpoint,"SubmitMaskFindings",{siteKey:e.siteKey,reviewerToken:e.reviewerToken,findings:o},e.fetchImpl)}catch(c){for(const a of o)s.delete(`${a.pagePath}
4
4
  ${a.anchor??a.selector}
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as I } from "react/jsx-runtime";
2
2
  import { createContext as O, useRef as l, useMemo as j, useEffect as f, useContext as N } from "react";
3
- import { t as M, c as R, w as U } from "./loader-k4pePzAw.js";
3
+ import { t as M, c as R, w as U } from "./loader-DHgG5Y7t.js";
4
4
  import { CONTEXT_FIELDS as H } from "./contract.js";
5
5
  const T = O(null), a = () => {
6
6
  }, $ = Object.freeze({
@@ -1 +1 @@
1
- import{T as c}from"./loader-k4pePzAw.js";const p=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/,b=/^[a-z]{2,32}$/,m="input:not([type]),input[type=text],input[type=email],input[type=tel],input[type=url],input[type=password]",f={button:"button,input[type=button],input[type=submit],input[type=reset],input[type=image],summary",link:"a[href],area[href]",textbox:`textarea,${m}`,searchbox:"input[type=search]",checkbox:"input[type=checkbox]",radio:"input[type=radio]",combobox:"select:not([multiple]):not([size]),input[list]",listbox:"select[multiple],select[size],datalist",option:"option",slider:"input[type=range]",spinbutton:"input[type=number]",progressbar:"progress",heading:"h1,h2,h3,h4,h5,h6",img:"img[alt]:not([alt='']),svg[aria-label]",list:"ul,ol,menu",listitem:"li",table:"table",row:"tr",cell:"td",columnheader:"th",navigation:"nav",main:"main",form:"form",dialog:"dialog",article:"article",separator:"hr",group:"fieldset,details,optgroup"},d=new Set(["button","link","heading","option","cell","columnheader","row","listitem","tab","menuitem","checkbox","radio","switch","treeitem","tooltip"]),r=t=>(t??"").replace(/\s+/g," ").trim(),h=t=>{const o=t.getBoundingClientRect();return o.width>0||o.height>0};function g(t){const o=t.ownerDocument,e=[],n=t.getAttribute("id");if(n)for(const s of o.querySelectorAll("label"))s.getAttribute("for")===n&&e.push(s);const a=t.parentElement?.closest("label");return a&&!e.includes(a)&&e.push(a),e}function y(t,o){const e=t.ownerDocument,n=t.getAttribute("aria-labelledby");if(n){const i=r(n.split(/\s+/).map(l=>e.getElementById(l)?.textContent??"").join(" "));if(i)return i}const a=r(t.getAttribute("aria-label"));if(a)return a;const s=r(g(t).map(i=>i.textContent).join(" "));if(s)return s;const u=r(t.getAttribute("alt"));if(u)return u;if(t instanceof HTMLInputElement&&/^(button|submit|reset)$/.test(t.type)){const i=r(t.value);if(i)return i}if(d.has(o)){const i=r(t.textContent);if(i)return i}return r(t.getAttribute("title"))||r(t.getAttribute("placeholder"))}function v(t,o){const e=n=>[...o.querySelectorAll(n)];try{switch(t.by){case"tflow":return c.test(t.value)?e(`[data-tflow-id="${t.value}"]`):[];case"testId":return p.test(t.value)?e(`[data-testid="${t.value}"]`):[];case"role":{if(!b.test(t.value))return[];const n=f[t.value],a=e(n?`[role="${t.value}"],${n}`:`[role="${t.value}"]`),s=r(t.name);return a.filter(u=>{const i=u.getAttribute("role");return i&&i.split(/\s+/)[0]!==t.value?false:!s||y(u,t.value)===s})}case"css":return e(t.value)}}catch{}return[]}function A(t,o=document){for(const e of t){const n=v(e,o).filter(h);if(n.length===1)return n[0]}}export{y as accessibleName,A as resolveTarget};
1
+ import{T as c}from"./loader-DHgG5Y7t.js";const p=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/,b=/^[a-z]{2,32}$/,m="input:not([type]),input[type=text],input[type=email],input[type=tel],input[type=url],input[type=password]",f={button:"button,input[type=button],input[type=submit],input[type=reset],input[type=image],summary",link:"a[href],area[href]",textbox:`textarea,${m}`,searchbox:"input[type=search]",checkbox:"input[type=checkbox]",radio:"input[type=radio]",combobox:"select:not([multiple]):not([size]),input[list]",listbox:"select[multiple],select[size],datalist",option:"option",slider:"input[type=range]",spinbutton:"input[type=number]",progressbar:"progress",heading:"h1,h2,h3,h4,h5,h6",img:"img[alt]:not([alt='']),svg[aria-label]",list:"ul,ol,menu",listitem:"li",table:"table",row:"tr",cell:"td",columnheader:"th",navigation:"nav",main:"main",form:"form",dialog:"dialog",article:"article",separator:"hr",group:"fieldset,details,optgroup"},d=new Set(["button","link","heading","option","cell","columnheader","row","listitem","tab","menuitem","checkbox","radio","switch","treeitem","tooltip"]),r=t=>(t??"").replace(/\s+/g," ").trim(),h=t=>{const o=t.getBoundingClientRect();return o.width>0||o.height>0};function g(t){const o=t.ownerDocument,e=[],n=t.getAttribute("id");if(n)for(const s of o.querySelectorAll("label"))s.getAttribute("for")===n&&e.push(s);const a=t.parentElement?.closest("label");return a&&!e.includes(a)&&e.push(a),e}function y(t,o){const e=t.ownerDocument,n=t.getAttribute("aria-labelledby");if(n){const i=r(n.split(/\s+/).map(l=>e.getElementById(l)?.textContent??"").join(" "));if(i)return i}const a=r(t.getAttribute("aria-label"));if(a)return a;const s=r(g(t).map(i=>i.textContent).join(" "));if(s)return s;const u=r(t.getAttribute("alt"));if(u)return u;if(t instanceof HTMLInputElement&&/^(button|submit|reset)$/.test(t.type)){const i=r(t.value);if(i)return i}if(d.has(o)){const i=r(t.textContent);if(i)return i}return r(t.getAttribute("title"))||r(t.getAttribute("placeholder"))}function v(t,o){const e=n=>[...o.querySelectorAll(n)];try{switch(t.by){case"tflow":return c.test(t.value)?e(`[data-tflow-id="${t.value}"]`):[];case"testId":return p.test(t.value)?e(`[data-testid="${t.value}"]`):[];case"role":{if(!b.test(t.value))return[];const n=f[t.value],a=e(n?`[role="${t.value}"],${n}`:`[role="${t.value}"]`),s=r(t.name);return a.filter(u=>{const i=u.getAttribute("role");return i&&i.split(/\s+/)[0]!==t.value?false:!s||y(u,t.value)===s})}case"css":return e(t.value)}}catch{}return[]}function A(t,o=document){for(const e of t){const n=v(e,o).filter(h);if(n.length===1)return n[0]}}export{y as accessibleName,A as resolveTarget};
package/dist/script.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as c, c as u } from "./loader-k4pePzAw.js";
1
+ import { t as c, c as u } from "./loader-DHgG5Y7t.js";
2
2
  const e = document.querySelector("script[data-journeeze-site-key]"), o = e?.dataset.journeezeSiteKey;
3
3
  if (o && !window.Journeeze) {
4
4
  const n = c(o), t = e?.dataset ?? {}, a = t.journeezeEndpoint, r = t.journeezeApiHost, i = t.journeezeApiPath, s = u({