1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[606],{15186:(e,t,r)=>{r.d(t,{B:()=>c,D:()=>d});var s=r(54568),l=r(7620),a=r(27797),n=r(25703),o=r(22322),i=r(1675);function d(e,t){var r,s,l;if("string"==typeof e)return{text:e,value:e||"row-".concat(t+1)};let a=null!=(r=null==e?void 0:e.text)?r:"";return{...e,text:a,value:String(null!=(l=null!=(s=null==e?void 0:e.value)?s:a)?l:"row-".concat(t+1))}}function c(e){var t,r;let{row:c,currentQuestionId:u,disabled:x,onChange:m}=e,{questions:p}=(0,o.V0)(),[h,b]=(0,l.useState)(!1),g=c&&"object"==typeof c&&c.displayLogic?c.displayLogic:null,v=null!=(r=null==g||null==(t=g.conditions)?void 0:t.length)?r:0;return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("button",{type:"button",disabled:x,onClick:()=>b(e=>!e),title:v>0?"Shown conditionally (".concat(v,")"):"Add show-if logic",className:(0,n.cn)("flex items-center gap-1 rounded px-1.5 py-1 text-[11px] font-medium transition-colors",v>0?"text-primary hover:bg-primary/10":"text-muted-foreground/50 hover:text-foreground"),children:[(0,s.jsx)(a.A,{className:"h-3.5 w-3.5"}),"Show if",v>0?" (".concat(v,")"):""]}),h&&(0,s.jsxs)("div",{className:"absolute right-0 z-20 mt-1 w-[340px] rounded-lg border bg-popover p-3 shadow-lg",children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-xs font-semibold",children:"Show this row ifâ¦"}),(0,s.jsx)("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",onClick:()=>b(!1),children:"Done"})]}),(0,s.jsx)(i.L,{group:g,onChange:e=>{let t=d(c,0);if(e&&e.conditions.length>0)m({...t,displayLogic:e});else{let{displayLogic:e,...r}=t;m(r)}},questions:p,currentQuestionId:u,disabled:x})]})]})}},64885:(e,t,r)=>{r.d(t,{d:()=>c});var s=r(54568),l=r(7620),a=r(83127),n=r(22322),o=r(44513),i=r(15186);let d=e=>"string"==typeof e&&e.includes("{q:")?(0,a.acg)(e):[];function c(e){let{rows:t,currentQuestionId:r}=e,{questions:c}=(0,n.V0)(),{schema:u}=(0,o.f)(),[x,m]=(0,l.useState)({}),p=(0,l.useMemo)(()=>{var e,t;return null!=(t=null==(e=c.find(e=>e.id===r))?void 0:e.blockId)?t:null},[c,r]),h=(0,l.useMemo)(()=>{let e=new Set;for(let s of t||[]){var r;let t=s&&"object"==typeof s?null==(r=s.displayLogic)?void 0:r.conditions:null;if(Array.isArray(t))for(let r of t)for(let t of((null==r?void 0:r.questionId)&&e.add(String(r.questionId).toLowerCase()),[...d(null==r?void 0:r.valueExpression),...d(null==r?void 0:r.expression)]))e.add(t)}let s=new Map(c.map(e=>[String(e.id).toLowerCase(),e]));return Array.from(e).map(e=>s.get(e)).filter(Boolean)},[t,c]);if(0===h.length)return null;let b=new Map(h.map(e=>[e.id,e.type])),g={};for(let[e,t]of Object.entries(x))t&&(g[e]=(0,a.kDJ)(b.get(e))?{selected:[t]}:{value:t});let v=new Set((0,a.JVX)((t||[]).map((e,t)=>(0,i.D)(e,t)),g,{schema:u,scopeBlockId:p}).map(e=>e.value));return(0,s.jsxs)("div",{className:"mt-4 rounded-lg border border-dashed border-primary/30 bg-primary/5 p-3",children:[(0,s.jsx)("span",{className:"mb-2 block text-[10px] font-medium uppercase tracking-wider text-primary",children:"Preview row logic"}),(0,s.jsx)("div",{className:"mb-3 space-y-2",children:h.map(e=>{var t,r;let l=Array.isArray(e.options)?e.options:[];return(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("span",{className:"min-w-[140px] truncate text-muted-foreground",children:e.text||"Untitled"}),l.length>0?(0,s.jsxs)("select",{className:"h-7 flex-1 rounded border border-input bg-background px-2 text-xs",value:null!=(t=x[e.id])?t:"",onChange:t=>m(r=>({...r,[e.id]:t.target.value})),children:[(0,s.jsx)("option",{value:"",children:"(no answer)"}),l.map(e=>(0,s.jsx)("option",{value:e.value,children:e.text},e.value))]}):(0,s.jsx)("input",{type:"text",className:"h-7 flex-1 rounded border border-input bg-background px-2 text-xs",placeholder:"(no answer)",value:null!=(r=x[e.id])?r:"",onChange:t=>m(r=>({...r,[e.id]:t.target.value}))})]},e.id)})}),(0,s.jsx)("ul",{className:"space-y-1 text-xs",children:(t||[]).map((e,t)=>{let r=(0,i.D)(e,t),l=v.has(r.value);return(0,s.jsxs)("li",{className:l?"text-foreground":"text-muted-foreground
1/50 line-through",children:[l?"â ":"â ",r.text||"Row ".concat(t+1)]},r.value)})})]})}},90606:(e,t,r)=>{r.r(t),r.d(t,{GridEditor:()=>A});var s=r(54568),l=r(7620),a=r(87181),n=r(37195),o=r(2167),i=r(12494),d=r(33444),c=r(22322),u=r(23741);let x=e=>{var t;return"string"==typeof e?e:String(null!=(t=null==e?void 0:e.text)?t:"")},m=e=>{var t,r;return"string"==typeof e?e:String(null!=(r=null!=(t=null==e?void 0:e.value)?t:null==e?void 0:e.text)?r:"")},p=e=>e.split("\n").map(e=>e.trim()).filter(Boolean);var h=r(96442),b=r(25703);let g=(0,h.default)(()=>Promise.resolve().then(r.bind(r,63e3)).then(e=>({default:e.RichTextEditor})),{loadableGenerated:{webpack:()=>[63e3]},ssr:!1,loading:()=>(0,s.jsx)("div",{className:"h-14 animate-pulse rounded-md border bg-muted/30"})});function v(e){let{label:t,richText:r,disabled:a,placeholder:n,className:o,inputClassName:i,onApply:c,onClear:u}=e,[x,m]=(0,l.useState)(!1),p=!!r;return(0,s.jsx)("div",{className:(0,b.cn)("min-w-0 flex-1",o),children:p||x?(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(g,{content:r||t,onChange:(e,t)=>
1c({text:t,richText:e}),disabled:a,placeholder:n}),!a&&(0,s.jsx)("button",{type:"button",onClick:()=>{m(!1),u()},className:"text-[11px] text-muted-foreground hover:text-destructive hover:underline",children:"Clear formatting"})]}):(0,s.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,s.jsx)(d.p,{value:t,onChange:e=>c({text:e.target.value}),disabled:a,className:(0,b.cn)("h-8 min-w-0 flex-1 text-sm",i),placeholder:n}),!a&&(0,s.jsx)("button",{type:"button",onClick:()=>m(!0),title:"Format label (bold, italic, linksâ¦)",className:"shrink-0 text-[11px] text-muted-foreground hover:text-primary hover:underline",children:"Format"})]})})}var f=r(2133),y=r(15186),j=r(64885);function w(e){let{initial:t,hint:r,placeholder:a,onApply:n,onCancel:o}=e,[i,d]=(0,l.useState)(t),c=i.split("\n").some(e=>e.trim());return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("textarea",{value:i,onChange:e=>d(e.target.value),rows:Math.max(4,i.split("\n").length+1),autoFocus:!0,className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-primary/50",placeholder:a}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:r}),(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsx)("button",{type:"button",onClick:()=>c&&n(i),disabled:!c,className:"text-sm text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:"Apply"}),(0,s.jsx)("button",{type:"button",onClick:o,className:"text-sm text-muted-foreground hover:text-foreground",children:"Cancel"})]})]})}let N=new Set(["MULTI","SINGLE","DROPDOWN","IMAGE_SELECT"]),k=e=>{var t;return"string"==typeof e?e:null!=(t=null==e?void 0:e.text)?t:""},C=e=>{var t,r;return"string"==typeof e?e:String(null!=(r=null!=(t=null==e?void 0:e.value)?t:null==e?void 0:e.text)?r:"")};function A(e){var t,r;let{question:h,onChange:b,disabled:g}=e,{questions:A}=(0,c.V0)(),S=h.options||[{text:"Column 1",value:"1"},{text:"Column 2",value:"2"}],T=h.validation||{},R=T.rows||["Row 1","Row 2"],D="GRID_MULTI"===h.type,E=T.dynamicRowsFrom,M=!!E,L=A.filter(e=>{var t,r;return e.id!==h.id&&N.has(e.type)&&Array.isArray(e.options)&&e.options.length>0&&(null!=(t=e.position)?t:0)<(null!=(r=h.position)?r:Number.MAX_SAFE_INTEGER)}),G=e=>b({validation:{...T,rows:e}}),[I,O]=(0,l.useState)(!1),[q,_]=(0,l.useState)(!1),F=e=>e&&"object"==typeof e&&Array.isArray(e.columns)&&e.columns.length?e.columns:void 0,z=R.some(e=>!!F(e)),B=(e,t)=>{let r=[...R];r[e]={...r[e],columns:t},G(r)},P=T.rowDefaults||{},U=(e,t)=>{let r={...P};null==t||""===t||Array.isArray(t)&&0===t.length?delete r[e]:r[e]=t,b({validation:{...T,rowDefaults:r}})},H=Array.isArray(T.rowGroups)?T.rowGroups:[],V=e=>b({validation:{...T,rowGroups:e.length?e:void 0}}),Q=e=>{let t=A.find(t=>t.id===e),r=((null==t?void 0:t.options)||[]).map(e=>({text:e.text,value:e.value}));b({validation:{...T,dynamicRowsFrom:e,dynamicRowsMode:T.dynamicRowsMode||"SELECTED",rows:r}})};return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3 space-y-2",children:[(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 text-primary"}),(0,s.jsx)("input",{type:"checkbox",checked:M,disabled:g||0===L.length,onChange:e=>e.target.checked?Q(L[0].id):(()=>{let{dynamicRowsFrom:e,dynamicRowsMode:t,...r}=T;b({validation:{...r,rows:["Row 1","Row 2"]}})})(),className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Build rows from a previous question"]}),0===L.length?(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Add a choice question before this grid to use its answers as rows."}):M?(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsx)("select",{className:"h-8 rounded-md border border-input bg-background px-2 text-sm",value:E,onChange:e=>Q(e.target.value),disabled:g,children:L.map((e,t)=>{var r;return(0,s.jsxs)("option",{value:e.id,children:[(0,u.h)(e,null!=(r=e.position)?r:t),": ",(e.text||"Untitled").slice(0,40)]},e.id)})}),(0,s.jsxs)("select",{className:"h-8 rounded-md border border-input bg-background px-2 text-sm",value:T.dynamicRowsMode||"
1SELECTED",onChange:e=>b({validation:{...T,dynamicRowsMode:e.target.value}}),disabled:g,children:[(0,s.jsx)("option",{value:"SELECTED",children:"Options they selected"}),(0,s.jsx)("option",{value:"UNSELECTED",children:"Options they didnât select"})]})]}):(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Rows are filtered to the options each respondent picks. Off by default."})]}),M?(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"text-sm font-medium mb-2 block",children:["Candidate rows ",(0,s.jsx)("span",{className:"font-normal text-muted-foreground",children:"(from the source question â filtered per respondent)"})]}),(0,s.jsx)("ul",{className:"space-y-1 text-sm text-muted-foreground",children:R.map((e,t)=>(0,s.jsx)("li",{className:"rounded-md bg-muted/40 px-2 py-1",children:k(e)},t))})]}):(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Row Labels"}),I?(0,s.jsx)(w,{initial:R.map(x).join("\n"),placeholder:"One row per line\nComfort\nPrice",hint:"One row per line. Unchanged lines keep their row (scale, defaults, group); removed lines delete the row.",onApply:e=>{let{rows:t,keptKeys:r}=function(e,t){let r=new Map;for(let t of e){let e=x(t),s=r.get(e);s?s.push(t):r.set(e,[t])}let s=[],l=new Set,a=new Set;for(let e of p(t)){let t=e.toLowerCase();if(a.has(t))continue;a.add(t);let n=r.get(e),o=null==n?void 0:n.shift();void 0!==o?(s.push(o),l.add(m(o))):(s.push(e),l.add(e))}return{rows:s,keptKeys:l}}(R,e);0!==t.length&&(b({validation:{...function(e,t){let r={...e};if(r.rowDefaults&&"object"==typeof r.rowDefaults){let e=Object.fromEntries(Object.entries(r.rowDefaults).filter(e=>{let[r]=e;return t.has(r)}));Object.keys(e).length?r.rowDefaults=e:delete r.rowDefaults}if(Array.isArray(r.rowGroups)){let e=r.rowGroups.map(e=>({...e,rows:Array.isArray(null==e?void 0:e.rows)?e.rows.filter(e=>t.has(e)):[]}));e.length?r.rowGroups=e:delete r.rowGroups}return r}(T,r),rows:t}}),O(!1))},onCancel:()=>O(!1)}):(0,s.jsxs)("div",{className:"space-y-1.5",children:[R.map((e,t)=>{let r=F(e);return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(v,{label:k(e),richText:e&&"object"==typeof e?e.richText:void 0,disabled:g,placeholder:"Row ".concat(t+1),onApply:e=>((e,t)=>{let r=[...R],s=r[e];"string"==typeof s?r[e]=t.richText?{text:t.text,value:s,richText:t.richText}:t.text:r[e]={...s,text:t.text,...void 0!==t.richText?{richText:t.richText}:{}},G(r)})(t,e),onClear:()=>(e=>{let t=[...R],r=t[e];if(r&&"object"==typeof r&&"richText"in r){let{richText:s,...l}=r;t[e]=l}G(t)})(t)}),!g&&(0,s.jsxs)("button",{type:"button",onClick:()=>(e=>{let t=[...R],r=t[e];if(F(r)){let{columns:s,...l}=r;t[e]=l}else{let s=S.map(e=>({text:e.text,value:String(e.value)}));t[e]="string"==typeof r?{text:r,value:r,columns:s}:{...r,columns:s}}G(t)})(t),"aria-pressed":!!r,title:r?"This row has its own scale â click to use the shared columns":"Give this row its own scale (profile matrix)",className:"flex shrink-0 items-center gap-1 rounded-md border px-2 py-1 text-[11px] font-medium transition-colors ".concat(r?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:bg-muted"),children:[(0,s.jsx)(n.A,{className:"h-3 w-3"})," Scale"]}),(0,s.jsx)(y.B,{row:e,currentQuestionId:h.id,disabled:g,onChange:e=>{let r=[...R];r[t]=e,G(r)}}),!g&&R.length>1&&(0,s.jsx)("button",{onClick:()=>G(R.filter((e,r)=>r!==t)),className:"text-muted-foreground/40 hover:text-destructive",children:(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"})})]}),r&&(0,s.jsxs)("div",{className:"ml-4 mt-1.5 space-y-1 rounded-md border border-primary/20 bg-primary/[0.03] p-2",children:[r.map((e,l)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(v,{label:e.text,richText:e.richText,disabled:g,placeholder:"Point ".concat(l+1),inputClassName:"h-7 text-xs",onApply:e=>B(t,r.map((t,r)=>r===l?{...t,text:e.text,...void 0!==e.richText?{richText:e.richText}:{}}:t)),onClear:()=>B(t,r.map((e,t)=>{if(t!==l)return e;let{richText:r,...s}=e;return s}))}),D&&!g&&(0,s.jsx)("button",{type:"button",onClick:()=>B(t,r.map((e,t)=>t===l?{...e,exclusive:!e.exclusive||void 0}
1:e)),"aria-pressed":!!e.exclusive,title:e.exclusive?"Exclusive: clears other cells in the row":"Mark exclusive",className:"shrink-0 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors ".concat(e.exclusive?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:bg-muted"),children:"Excl"}),!g&&r.length>1&&(0,s.jsx)("button",{onClick:()=>B(t,r.filter((e,t)=>t!==l)),className:"text-muted-foreground/40 hover:text-destructive",children:(0,s.jsx)(o.A,{className:"h-3 w-3"})})]},l)),!g&&(0,s.jsxs)("button",{onClick:()=>B(t,[...r,{text:"Point ".concat(r.length+1),value:(e=>{let t=new Set(e.map(e=>String(e.value))),r=e.length+1;for(;t.has(String(r));)r++;return String(r)})(r)}]),className:"flex items-center gap-1 text-xs text-primary hover:underline",children:[(0,s.jsx)(i.A,{className:"h-3 w-3"})," Add scale point"]})]})]},t)}),!g&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsxs)("button",{onClick:()=>G([...R,"Row ".concat(R.length+1)]),className:"text-sm text-primary hover:underline flex items-center gap-1",children:[(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"})," Add row"]}),(0,s.jsx)("button",{onClick:()=>O(!0),className:"text-xs text-muted-foreground hover:text-primary hover:underline",children:"Bulk edit"})]}),z&&(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Rows with their own scale render as labeled cards (no shared header), so table view and transpose don't apply."})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm font-medium mb-2 block",children:"Column Headers"}),q?(0,s.jsx)(w,{initial:S.map(e=>e.value&&String(e.value)!==e.text?"".concat(e.text," | ").concat(e.value):e.text).join("\n"),placeholder:'One column per line\nAgree\nDisagree | 2 â optional "| value"',hint:"One column per line. Add | value to set a reporting value; columns keeping their value keep flags like Exclusive.",onApply:e=>{let t=function(e,t){let r=new Map(e.map(e=>[String(e.value),e])),s=new Set,l=new Set,a=[];return p(t).forEach((e,t)=>{let[n,o]=e.split("|"),i=n.trim();if(!i)return;let d=i.toLowerCase();if(s.has(d))return;s.add(d);let c=(null==o?void 0:o.trim())||String(t+1),u=2,x=c;for(;l.has(c);)c="".concat(x,"_").concat(u++);l.add(c);let m=r.get(c);a.push(m?{...m,text:i,value:c}:{text:i,value:c})}),a}(S,e);0!==t.length&&(b({options:t}),_(!1))},onCancel:()=>_(!1)}):(0,s.jsxs)("div",{className:"space-y-1.5",children:[S.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(v,{label:e.text,richText:e.richText,disabled:g,placeholder:"Column ".concat(t+1),onApply:e=>((e,t)=>{let r=[...S];r[e]={...r[e],text:t.text,...void 0!==t.richText?{richText:t.richText}:{}},b({options:r})})(t,e),onClear:()=>(e=>{let t=[...S],{richText:r,...s}=t[e];t[e]=s,b({options:t})})(t)}),D&&!g&&(0,s.jsx)("button",{type:"button",onClick:()=>{let e=[...S];e[t]={...e[t],exclusive:!e[t].exclusive||void 0},b({options:e})},"aria-pressed":!!e.exclusive,title:e.exclusive?"Exclusive: clears other cells in the row":"Mark exclusive (e.g. a âNoneâ column)",className:"shrink-0 rounded-md border px-2 py-1 text-[11px] font-medium transition-colors ".concat(e.exclusive?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:bg-muted"),children:"Exclusive"}),!g&&S.length>1&&(0,s.jsx)("button",{onClick:()=>b({options:S.filter((e,r)=>r!==t)}),className:"text-muted-foreground/40 hover:text-destructive",children:(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"})})]},t)),!g&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsxs)("button",{onClick:()=>b({options:[...S,{text:"Column ".concat(S.length+1),value:String(S.length+1)}]}),className:"text-sm text-primary hover:underline flex items-center gap-1",children:[(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"})," Add column"]}),(0,s.jsx)("button",{onClick:()=>_(!0),className:"text-xs text-muted-foreground hover:text-primary hover:underline",children:"Bulk edit"})]})]})]}),!M&&R.length>0&&S.length>0&&(0,s.jsxs)("details",{className:"rounded-md border p-2",children:[(0,s.jsxs)("summary",{className:"cursor-pointer text-xs font-medium text-muted-foreground",children:["Default answers (optional) â pre-select ",D?"columns":"a column"," per row"]}),(0,s.jsxs)("div",{className:"mt-2 space-y-2",children:[R.map((e,t)=>{var r;let l=C(e),a=null!=(r=F(e))?r:S;return(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"w-28 shrink-0 truncate text-xs text-muted-foreground",title:k(e),children:k(e)||"Row ".concat(t+1)}),D?(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map(e=>{let t=Array.isArray(P[l])&&P[l].includes(String(e.value));return(0,s.jsx)("button",{type:"button",disabled:g,"aria-pressed":t,onClick:()=>((e,t)=>{let r=Array.isArray(P[e])?P[e]:[];U(e,r.includes(t)?r.filter(e=>e!==t):[...r,t])})(l,String(e.value)),className:"rounded border px-2 py-0.5 text-xs transition-colors ".concat(t?"border-primary bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted"),children:e.text},e.value)})}):(0,s.jsxs)("select",{className:"h-7 flex-1 rounded border border-input bg-background px-2 text-xs",value:"string"==typeof P[l]?P[l]:"",onCh
1ange:e=>U(l,e.target.value),disabled:g,children:[(0,s.jsx)("option",{value:"",children:"No default"}),a.map(e=>(0,s.jsx)("option",{value:String(e.value),children:e.text},e.value))]})]},t)}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Respondents can change these. Defaults follow the row label â rename a row and re-set its default."})]})]}),!M&&R.length>0&&(0,s.jsxs)("details",{className:"rounded-md border p-2",children:[(0,s.jsx)("summary",{className:"cursor-pointer text-xs font-medium text-muted-foreground",children:"Statement groups (optional) â labeled sub-headers within the matrix"}),(0,s.jsxs)("div",{className:"mt-2 space-y-3",children:[H.map((e,t)=>(0,s.jsxs)("div",{className:"rounded border bg-muted/20 p-2",children:[(0,s.jsxs)("div",{className:"mb-1.5 flex items-center gap-2",children:[(0,s.jsx)(d.p,{className:"h-7 flex-1 text-sm font-medium",value:e.label,onChange:e=>V(H.map((r,s)=>s===t?{...r,label:e.target.value}:r)),disabled:g,placeholder:"Group ".concat(t+1," heading")}),!g&&(0,s.jsx)("button",{onClick:()=>V(H.filter((e,r)=>r!==t)),className:"text-muted-foreground/40 hover:text-destructive",children:(0,s.jsx)(o.A,{className:"h-3.5 w-3.5"})})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:R.map((r,l)=>{let a=C(r),n=e.rows.includes(a);return(0,s.jsx)("button",{type:"button",disabled:g,"aria-pressed":n,onClick:()=>((e,t)=>{var r;let s=null==(r=H[e])?void 0:r.rows.includes(t),l=H.map(e=>({...e,rows:e.rows.filter(e=>e!==t)}));s||l[e].rows.push(t),V(l)})(t,a),className:"rounded border px-2 py-0.5 text-xs transition-colors ".concat(n?"border-primary bg-primary/10 text-primary":"text-muted-foreground hover:bg-muted"),title:k(r),children:k(r)||"Row ".concat(l+1)},l)})})]},t)),!g&&(0,s.jsxs)("button",{onClick:()=>V([...H,{label:"Group ".concat(H.length+1),rows:[]}]),className:"text-sm text-primary hover:underline flex items-center gap-1",children:[(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"})," Add group"]}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"Assign each statement to a group; a statement can be in one group, and any left unassigned show (unlabeled) at the end."})]})]}),(0,s.jsxs)("div",{className:"space-y-3 border-t pt-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{className:"text-xs font-medium",children:"Display"}),(0,s.jsxs)("select",{"aria-label":"Display",className:"w-full max-w-[240px] rounded-md border border-input bg-background px-3 py-2 text-sm",value:T.display||"table",onChange:e=>b({validation:{...T,display:e.target.value}}),disabled:g,children:[(0,s.jsx)("option",{value:"table",children:"Table (grid)"}),(0,s.jsx)("option",{value:"list",children:"Stacked list (one card per row)"}),(0,s.jsx)("option",{value:"carousel",children:"Carousel (one row at a time)"}),(0,s.jsx)("option",{value:"accordion",children:"Accordion (rows expand and collapse)"}),!D&&(0,s.jsx)("option",{value:"rowDropdown",children:"Dropdown per row"})]})]}),"table"===(T.display||"table")&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("label",{className:"text-xs font-medium",children:"Mobile display"}),(0,s.jsxs)("select",{"aria-label":"Mobile display",className:"w-full max-w-[240px] rounded-md border border-input bg-background px-3 py-2 text-sm",value:T.mobileDisplay||"auto",onChange:e=>b({validation:{...T,mobileDisplay:e.target.value}}),disabled:g,children:[(0,s.jsx)("option",{value:"auto",children:"Auto (stacked list, or theme default)"}),(0,s.jsx)("option",{value:"list",children:"Stacked list"}),(0,s.jsx)("option",{value:"chips",children:"Wrapped chips"}),(0,s.jsx)("option",{value:"accordion",children:"Accordion"}),(0,s.jsx)("option",{value:"carousel",children:"Carousel"}),(0,s.jsx)("option",{value:"segmented",children:"Segmented bar (short labels)"}),(0,s.jsx)("option",{value:"table",children:"Same table as desktop"})]}),(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"How this grid renders on phones. Desktop keeps the table above."}),"segmented"===T.mobileDisplay&&(0,f.d)(S)&&(0,s.jsx)("p",{className:"text-[11px] font-medium text-amber-600 dar
1k:text-amber-500",children:"Some column labels are too long (or there are too many) for segments â phones will fall back to the stacked list. Segmented works best with numeric or one-word labels (1â5, SD/D/N/A/SA, Yes/No)."})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-4",children:[(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("input",{type:"checkbox",checked:!!T.randomizeRows,onChange:e=>b({validation:{...T,randomizeRows:e.target.checked}}),disabled:g,className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Randomize rows"]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:[(0,s.jsx)("input",{type:"checkbox",checked:!!T.randomizeColumns,onChange:e=>b({validation:{...T,randomizeColumns:e.target.checked}}),disabled:g,className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Randomize columns"]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs",title:z?"Not available while rows have their own scales":void 0,children:[(0,s.jsx)("input",{type:"checkbox",checked:!!T.transpose&&!z,onChange:e=>b({validation:{...T,transpose:e.target.checked}}),disabled:g||z,className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Transpose (swap rows/columns)"]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs",title:"Column headers stay pinned while a long grid scrolls",children:[(0,s.jsx)("input",{type:"checkbox",checked:!!T.stickyHeader,onCh
1ange:e=>b({validation:{...T,stickyHeader:e.target.checked}}),disabled:g,className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Repeat headers on scroll"]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs",title:"Append a Not-applicable column; it's excluded from the analysis base",children:[(0,s.jsx)("input",{type:"checkbox",checked:!!T.naColumn,onChange:e=>b({validation:{...T,naColumn:e.target.checked}}),disabled:g,className:"h-3.5 w-3.5 rounded border-gray-300 text-primary focus:ring-primary"}),"Add a âNot applicableâ column"]}),T.naColumn&&(0,s.jsx)("input",{value:null!=(t=T.naLabel)?t:"",onChange:e=>b({validation:{...T,naLabel:e.target.value}}),disabled:g,placeholder:"N/A",className:"h-7 w-40 rounded border border-input bg-background px-2 text-xs"}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs",children:["Minimum rows required",(0,s.jsx)("input",{type:"number",min:1,value:null!=(r=T.minRows)?r:"",onChange:e=>{let t=parseInt(e.target.value,10);b({validation:{...T,minRows:Number.isFinite(t)&&t>0?t:void 0}})},disabled:g,placeholder:"All",title:"Respondents must answer at least this many rows (blank = every row when required)",className:"h-6 w-16 rounded border border-input bg-background px-1.5 text-xs"})]})]})]}),(0,s.jsxs)("div",{className:"mt-4 rounded-lg border border-dashed border-muted-foreground/20 p-4 overflow-x-auto",children:[(0,s.jsxs)("span",{className:"text-[10px] font-medium text-muted-foreground uppercase tracking-wider block mb-3",children:["Preview (",D?"Multi-select":"Single-select",")"]}),(0,s.jsxs)("table",{className:"w-full text-xs",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"text-left p-1.5"}),S.map((e,t)=>(0,s.jsx)("th",{className:"text-center p-1.5 font-medium",children:e.text},t))]})}),(0,s.jsx)("tbody",{children:R.map((e,t)=>{let r=F(e);return r?(0,s.jsxs)("tr",{className:"border-t border-muted/30",children:[(0,s.jsx)("td",{className:"p-1.5 font-medium",children:k(e)}),(0,s.jsx)("td",{colSpan:S.length,className:"p-1.5",children:(0,s.jsx)("div",{className:"flex flex-wrap justify-center gap-2",children:r.map((e,r)=>(0,s.jsxs)("span",{className:"flex items-center gap-1 rounded border border-muted/50 px-1.5 py-0.5",children:[(0,s.jsx)("input",{type:D?"checkbox":"radio",disabled:!0,name:"grid-preview-".concat(t)}),e.text]},r))})})]},t):(0,s.jsxs)("tr",{className:"border-t border-muted/30",children:[(0,s.jsx)("td",{className:"p-1.5 font-medium",children:k(e)}),S.map((e,r)=>(0,s.jsx)("td",{className:"text-center p-1.5",children:(0,s.jsx)("input",{type:D?"checkbox":"radio",disabled:!0,name:"grid-preview-".concat(t)})},r))]},t)})})]})]}),(0,s.jsx)(j.d,{rows:R,currentQuestionId:h.id})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.