use-chisel 0.1.10 → 0.1.11

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.
@@ -1,6 +1,6 @@
1
1
  function h(n){return{version:1,content:n.split(`
2
2
  `).map(t=>({type:"paragraph",children:[{text:t}]}))}}function m(n){return n.content.map(t=>t.children.map(e=>"type"in e?e.text||e.url:e.text).join("")).join(`
3
- `)}function u(n){let t=n.content.slice();for(;t.length;){let e=t[t.length-1],o=e.children.slice();for(;o.length;){let r=o[o.length-1],a="type"in r?r.text||r.url:r.text,i=a.trimEnd();if(i)return o[o.length-1]=i===a?r:{...r,text:i},t[t.length-1]={...e,children:o},{...n,content:t};o.pop()}t.pop()}return h("")}var x=5242880,y=20971520,s=["image/jpeg","image/png","image/gif","image/webp","image/avif","image/bmp"],p=["video/mp4","video/webm","video/quicktime"],b=[...s,...p].join(",");function f(n){let t=s.includes(n.type);return!t&&!p.includes(n.type)?"Choose a JPG, PNG, GIF, WebP, AVIF, BMP, MP4, WebM, or MOV file.":!Number.isSafeInteger(n.size)||n.size<=0?"This file is empty or invalid.":n.size>(t?5242880:20971520)?`${t?"Images must be 5 MB":"Videos must be 20 MB"} or smaller.`:null}function d(n){try{let t=new URL(n),e=/^\d+(?:\.\d+){3}$/.test(t.hostname)&&/^(0\.|10\.|127\.|169\.254\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(t.hostname);if(t.protocol!=="https:"||t.username||t.password||!t.hostname.includes(".")||e||/\.(localhost|local|internal)$/.test(t.hostname)||t.hostname.includes(":"))return null;let o=t.pathname.replace(/\/+$/,"");return t.pathname=o.endsWith("/chisel")?o:`${o}/chisel`,t.search="",t.hash="",t.toString()}catch{return null}}function c(n,t){let e=new URL(n);e.search="",e.hash="",e.searchParams.set("mode","comment"),e.searchParams.set("path",t.path),e.searchParams.set("thread",t.id),e.searchParams.set("breakpoint",t.breakpoint??"desktop");let o=t.context?.width??{desktop:1440,tablet:768,mobile:390}[t.breakpoint??"desktop"];return e.searchParams.set("width",String(o)),e.toString()}function l(n,t){return["# Website feedback for Codex","Apply the requested changes in the source code. Preserve unrelated behavior. Verify each affected page and viewport.",...n.map((e,o)=>[`## ${o+1}. ${e.path} \xB7 ${e.breakpoint??"desktop"}`,`Thread: ${c(t,e)}`,`Status: ${e.status??(e.resolved?"resolved":"open")}`,e.context?`Viewport: ${e.context.width} \xD7 ${e.context.height}px
3
+ `)}function u(n){let t=n.content.slice();for(;t.length;){let e=t[t.length-1],o=e.children.slice();for(;o.length;){let r=o[o.length-1],a="type"in r?r.text||r.url:r.text,i=a.trimEnd();if(i)return o[o.length-1]=i===a?r:{...r,text:i},t[t.length-1]={...e,children:o},{...n,content:t};o.pop()}t.pop()}return h("")}var x=5242880,y=20971520,s=["image/jpeg","image/png","image/gif","image/webp","image/avif","image/bmp"],p=["video/mp4","video/webm","video/quicktime"],b=[...s,...p].join(",");function f(n){let t=s.includes(n.type);return!t&&!p.includes(n.type)?"Choose a JPG, PNG, GIF, WebP, AVIF, BMP, MP4, WebM, or MOV file.":!Number.isSafeInteger(n.size)||n.size<=0?"This file is empty or invalid.":n.size>(t?5242880:20971520)?`${t?"Images must be 5 MB":"Videos must be 20 MB"} or smaller.`:null}function d(n){try{let t=new URL(n),e=/^\d+(?:\.\d+){3}$/.test(t.hostname)&&/^(0\.|10\.|127\.|169\.254\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(t.hostname);if(t.protocol!=="https:"||t.username||t.password||!t.hostname.includes(".")||e||/\.(localhost|local|internal)$/.test(t.hostname)||t.hostname.includes(":"))return null;let o=t.pathname.replace(/\/+$/,"");return t.pathname=o.endsWith("/chisel")?o:`${o}/chisel`,t.search="",t.hash="",t.toString()}catch{return null}}function c(n,t){let e=new URL(n);e.search="",e.hash="",e.searchParams.set("mode","comment"),e.searchParams.set("path",t.path),e.searchParams.set("thread",t.id),e.searchParams.set("breakpoint",t.breakpoint??"desktop");let o=t.context?.width??{desktop:1440,tablet:768,mobile:390}[t.breakpoint??"desktop"];return e.searchParams.set("width",String(o)),e.toString()}function l(n,t){return["# Website feedback for agents","Apply the requested changes in the source code. Preserve unrelated behavior. Verify each affected page and viewport.",...n.map((e,o)=>[`## ${o+1}. ${e.path} \xB7 ${e.breakpoint??"desktop"}`,`Thread: ${c(t,e)}`,`Status: ${e.status??(e.resolved?"resolved":"open")}`,e.context?`Viewport: ${e.context.width} \xD7 ${e.context.height}px
4
4
  Captured: ${e.context.capturedAt}${e.context.deployment?`
5
5
  Deployment: ${e.context.deployment}`:""}`:"",e.selector?`Element: ${e.selector}`:"Page/area comment",e.area?`Area: ${JSON.stringify(e.area)}`:"",`${e.author}: ${e.text}`,...(e.replies??[]).map(r=>typeof r=="string"?r:`${r.author}: ${r.text}`),...(e.attachments??[]).map(r=>r.previewUrl?`![${r.name.replace(/[\[\]]/g,"")}](${r.previewUrl})`:`Attachment: ${r.name} (open the thread to view)`),...(e.changes??[]).map(r=>`${r.property}: ${JSON.stringify(r.before)} \u2192 ${JSON.stringify(r.after)}`)].filter(Boolean).join(`
6
6
 
@@ -1,6 +1,6 @@
1
- "use client";import{forwardRef as Ze,createElement as Je}from"react";var xe=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Ce(e,a,o=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:xe(e),size:24,node:a,...o.length>0?{aliases:o}:{}}}var he=e=>{let a="",o=!1;for(let t of e){if(t==="-"||t==="_"||t<=" "){o=a.length>0;continue}a.length===0?a+=t.toLowerCase():a+=o?t.toUpperCase():t,o=!1}return a};var ge=e=>{let a=he(e);return a.charAt(0).toUpperCase()+a.slice(1)};import{forwardRef as Ke,createElement as ye}from"react";var G=(...e)=>e.filter((a,o,t)=>!!a&&a.trim()!==""&&t.indexOf(a)===o).join(" ").trim();var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function de(e){return e!=null}function Se(e,a={}){let o=a.attributeNames??{},t=d=>o[d]??d,l=e.size??e.width??v.width,u=e.size??e.height??v.height,r=e.aliases?.filter(d=>typeof d=="string"&&d.trim()!=="").map(d=>`lucide-${d}`)??[],c=[...e.name?[`lucide-${e.name}`]:[],...r],i=a.className?.split(" ").filter(Boolean)??[],L=a.includeDefaultClasses===!1?G(...i):G("lucide",...c,...i),s=a.absoluteStrokeWidth?Number(a.strokeWidth??v["stroke-width"])*Number(e.size??e.width??v.width)/Number(a.size??a.width??v.width):a.strokeWidth??v["stroke-width"];return["svg",{...Object.entries(v).reduce((d,[f,n])=>(d[t(f)]=n,d),{}),..."color"in a&&a.color&&{[t("stroke")]:a.color},..."size"in a&&de(a.size)&&{[t("width")]:a.size,[t("height")]:a.size},..."width"in a&&de(a.width)&&{[t("width")]:a.width},..."height"in a&&de(a.height)&&{[t("height")]:a.height},[t("stroke-width")]:s,...L&&{[t("class")]:L},[t("viewBox")]:`0 0 ${l} ${u}`,...a.hasA11yProp===!1?{[t("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(d=>{let[f,n,x]=d,h=a.nonScalingStroke?{[t("vector-effect")]:"non-scaling-stroke",...n}:n;return x?[f,h,x]:[f,h]})]}function ke(e,a={}){return Se(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var we=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};import{createContext as ze,useContext as Ne,useMemo as Va,createElement as za}from"react";var Xe=ze({});var Pe=()=>Ne(Xe);var Ae=Ke(({color:e,size:a,width:o,height:t,strokeWidth:l,absoluteStrokeWidth:u,nonScalingStroke:r,className:c="",children:i,iconNode:L=[],icon:s={node:L,aliases:[],size:24},...m},d)=>{let{size:f=24,strokeWidth:n=2,absoluteStrokeWidth:x=!1,nonScalingStroke:h=!1,color:R="currentColor",className:S=""}=Pe()??{},F=!!i||we(m),[ae,te,I=[]]=ke(s,{color:e??R,width:o??a??f,height:t??a??f,strokeWidth:l??n,absoluteStrokeWidth:u??x,nonScalingStroke:r??h,className:G(S,c),hasA11yProp:F,attributes:m});return ye(ae,{ref:d,...te},[...I.map(([g,b])=>ye(g,b)),...Array.isArray(i)?i:[i]])});function k(e,a=[],o=[]){let t=typeof e=="string"?Ce(e,a,o):e,l=Ze(({className:u,...r},c)=>Je(Ae,{ref:c,icon:t,className:u,...r}));return t.name&&(l.displayName=ge(t.name)),l}var Qe={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]},W=k(Qe);var $e={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]},V=k($e);var _e={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]},z=k(_e);var je={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]},N=k(je);var Ye={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]},X=k(Ye);var ea={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]},K=k(ea);var aa={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]},q=k(aa);import{useEffect as U,useRef as y,useState as Q}from"react";function D(e){return{version:1,content:e.split(`
2
- `).map(a=>({type:"paragraph",children:[{text:a}]}))}}function $(e){return e.content.map(a=>a.children.map(o=>"type"in o?o.text||o.url:o.text).join("")).join(`
3
- `)}function _(e){let a=e.content.slice();for(;a.length;){let o=a[a.length-1],t=o.children.slice();for(;t.length;){let l=t[t.length-1],u="type"in l?l.text||l.url:l.text,r=u.trimEnd();if(r)return t[t.length-1]=r===u?l:{...l,text:r},a[a.length-1]={...o,children:t},{...e,content:a};t.pop()}a.pop()}return D("")}function le(e){try{let a=JSON.parse(localStorage.getItem(e)??"null");return a?.version===1&&Date.now()-a.time<7*864e5?a.value:null}catch{return null}}function H(e,a){try{return a===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify({version:1,time:Date.now(),value:a})),!0}catch{return!1}}function re(e,a,o){let t=e;for(let l of[...a].sort((u,r)=>u-r))if(!(l<=t)){if(!o.has(l))break;t=l}return t}var j=["image/jpeg","image/png","image/gif","image/webp","image/avif","image/bmp"],Be=["video/mp4","video/webm","video/quicktime"],De=[...j,...Be].join(",");function Me(e){let a=j.includes(e.type);return!a&&!Be.includes(e.type)?"Choose a JPG, PNG, GIF, WebP, AVIF, BMP, MP4, WebM, or MOV file.":!Number.isSafeInteger(e.size)||e.size<=0?"This file is empty or invalid.":e.size>(a?5242880:20971520)?`${a?"Images must be 5 MB":"Videos must be 20 MB"} or smaller.`:null}import{useEffect as ta,useRef as Re,useState as be}from"react";import{createEditor as oa,Editor as C,Element as E,Node as ua,Path as da,Range as se,Transforms as M}from"slate";import{withHistory as la}from"slate-history";import{Editable as ra,Slate as sa,withReact as fa,ReactEditor as Fe}from"slate-react";import{Fragment as qe,jsx as w,jsxs as Ue}from"react/jsx-runtime";function fe(e){return e.content.length?e.content.map(a=>({type:"paragraph",children:a.children.length?a.children.map(o=>"type"in o&&o.type==="link"?{type:"link",url:o.url,children:[{text:o.text||o.url}]}:{...o}):[{text:""}]})):[{type:"paragraph",children:[{text:""}]}]}function ve(e){return{version:1,content:e.map(a=>({type:"paragraph",children:E.isElement(a)?a.children.map(o=>E.isElement(o)?{type:"link",url:o.url,text:ua.string(o)}:{...o}):[{text:a.text}]}))}}function ie(e){return/^(https?:\/\/|mailto:)[^\s]+$/i.test(e)}function ia(e,a){if(!e.selection){let o=window.getSelection(),t=o&&Fe.toSlateRange(e,o,{exactMatch:!1,suppressThrow:!0});M.select(e,t??C.end(e,[]))}C.marks(e)?.[a]?C.removeMark(e,a):C.addMark(e,a,!0)}function Te(){let e=fa(la(oa()),"application/x-chisel-review-fragment"),{isInline:a,insertText:o,insertData:t,insertBreak:l}=e;e.isInline=c=>c.type==="link"||a(c);function u(c,i){C.above(e,{at:c,match:L=>E.isElement(L)&&L.type==="link"})||(M.wrapNodes(e,{type:"link",url:i,children:[]},{at:c,split:!0}),M.collapse(e,{edge:"end"}))}function r(){if(!e.selection||!se.isCollapsed(e.selection))return;let c=C.above(e,{match:d=>E.isElement(d)&&d.type==="paragraph"});if(!c)return;let i=e.selection.anchor,s=C.string(e,{anchor:C.start(e,c[1]),focus:i}).match(/\S+$/)?.[0];if(!s||!ie(s))return;let m=C.before(e,i,{distance:s.length,unit:"offset"});if(m){u({anchor:m,focus:i},s);let d=C.above(e,{match:f=>E.isElement(f)&&f.type==="link"});d&&e.selection&&C.isEnd(e,e.selection.anchor,d[1])&&M.select(e,C.start(e,da.next(d[1])))}}return e.insertText=c=>{if(Fe.isComposing(e)){o(c);return}c===" "&&r();let i={"*":"bold",_:"italic","~":"strikethrough","`":"code"}[c];if(i&&e.selection&&se.isCollapsed(e.selection)){let L=C.above(e,{match:s=>E.isElement(s)&&s.type==="paragraph"});if(L){let s=e.selection.anchor,m=C.string(e,{anchor:C.start(e,L[1]),focus:s}),d=m.lastIndexOf(c),f=m.slice(d+1);if(d>=0&&(!d||/[\s*_~`]/.test(m[d-1]))&&f&&f.trim()===f){let n=C.before(e,s,{distance:f.length,unit:"offset"}),x=n&&C.before(e,n,{unit:"offset"});if(n&&x){M.select(e,{anchor:n,focus:s}),C.addMark(e,i,!0),M.collapse(e,{edge:"end"}),M.delete(e,{at:{anchor:x,focus:n}}),C.removeMark(e,i);return}}}}o(c)},e.insertBreak=()=>{r(),l()},e.insertData=c=>{let i=c.getData("text/plain");ie(i)?e.selection&&!se.isCollapsed(e.selection)?u(e.selection,i):M.insertNodes(e,[{type:"link",url:i,children:[{text:i}]},{text:""}]):t(c)},e}function ca({attributes:e,children:a,element:o}){return o.type==="link"?w("a",{...e,href:ie(o.url)?o.url:void 0,onClick:t=>t.preventDefault(),children:a}):w("p",{...e,children:a})}function na({attributes:e,children:a,leaf:o}){let t=w(qe,{children:a});return o.bold&&(t=w("strong",{children:t})),o.italic&&(t=w("em",{children:t})),o.strikethrough&&(t=w("s",{children:t})),o.code&&(t=w("code",{children:t})),w("span",{...e,children:t})}function Z({onFiles:e,disabled:a}){let o=Re(null);return Ue(qe,{children:[w("input",{ref:o,type:"file",accept:De,multiple:!0,hidden:!0,onChange:t=>{e(t.target.files),t.target.value=""}}),w("button",{type:"button",className:"review-retry-upload","aria-label":"Attach image or video",title:"Images up to 5 MB \xB7 Videos up to 20 MB",disabled:a,onClick:()=>o.current?.click(),children:w(z,{size:16,strokeWidth:1.75})})]})}function J({text:e,defaultBody:a,disabled:o,label:t,placeholder:l,autoFocus:u,onChange:r,onSubmit:c,onFiles:i,uploading:L}){let[s]=be(Te),[m]=be(()=>fe(a??D(e))),d=Re(e);return ta(()=>{if(e===d.current)return;let f=d.current;d.current=e,f&&e.startsWith(f)?M.insertText(s,e.slice(f.length),{at:C.end(s,[])}):(C.withoutNormalizing(s,()=>{M.removeNodes(s,{at:[],match:(n,x)=>x.length===1}),M.insertNodes(s,fe(D(e)),{at:[0]}),M.deselect(s)}),e||(s.history={undos:[],redos:[]}))},[s,e]),Ue(sa,{editor:s,initialValue:m,onChange:f=>{if(!s.operations.some(x=>x.type!=="set_selection"))return;let n=ve(f);d.current=$(n),r(d.current,n)},children:[w(ra,{className:"review-composer-editor",role:"textbox","aria-multiline":"true","aria-label":t,placeholder:l,readOnly:o,autoFocus:u,renderElement:ca,renderLeaf:na,onKeyDown:f=>{if(f.nativeEvent.isComposing)return;let n=f.metaKey||f.ctrlKey;if(f.key==="Enter"){f.preventDefault(),n?s.insertBreak():c();return}let x=n?{b:"bold",i:"italic",e:"code",...f.shiftKey?{s:"strikethrough"}:{}}[f.key.toLowerCase()]:void 0;x&&(f.preventDefault(),ia(s,x))}}),i&&w("div",{className:"chisel-attachment-controls",children:w(Z,{onFiles:i,disabled:o||L})})]})}import{useEffect as pa,useRef as ma,useState as La}from"react";import{Fragment as Oe,jsx as P,jsxs as Y}from"react/jsx-runtime";function Ia({src:e,name:a,mimeType:o,onError:t,close:l}){let u=ma(null);return pa(()=>{u.current?.showModal()},[]),P("dialog",{ref:u,className:"review-media-lightbox","aria-label":`Preview ${a}`,onCancel:r=>{r.preventDefault(),l()},onClick:r=>{r.target===r.currentTarget&&l()},children:Y("div",{className:"review-media-lightbox-content",children:[Y("header",{children:[P("span",{children:a}),P("a",{href:e,download:a,"aria-label":`Download ${a}`,title:"Download",children:P(V,{size:20,"aria-hidden":"true"})}),P("button",{type:"button","aria-label":"Close preview",onClick:l,children:P(q,{size:20})})]}),o.startsWith("image/")?P("img",{src:e,alt:a,onError:t}):P("video",{src:e,controls:!0,autoPlay:!0,playsInline:!0,"aria-label":a,onError:t})]})})}function ee({src:e,name:a,mimeType:o,onError:t}){let[l,u]=La(!1);return Y(Oe,{children:[P("button",{type:"button",className:"review-media-thumbnail","aria-label":`Preview ${a}`,onClick:()=>u(!0),children:o.startsWith("image/")?P("img",{src:e,alt:a,loading:"lazy",onError:t}):Y(Oe,{children:[P("video",{src:e,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true",onError:t}),P("span",{className:"review-media-play","aria-hidden":"true",children:P(X,{size:20,fill:"currentColor"})})]})}),l&&P(Ia,{src:e,name:a,mimeType:o,onError:t,close:()=>u(!1)})]})}import{Fragment as ka,jsx as p,jsxs as A}from"react/jsx-runtime";function ce(e,a,o){if(e)try{let t=le(e);if(t?.text===a&&$(t.body)===a)return t.body}catch{}return o??D(a)}function ne(e,a,o,t=!1){e&&H(e,t||a.trim()?{text:a,body:o}:null)}function He({body:e}){return p("div",{className:"review-comment-body",children:e.content.map((a,o)=>p("p",{children:a.children.map((t,l)=>{if("type"in t&&t.type==="link")return p("a",{href:/^(https?:|mailto:)/i.test(t.url)?t.url:void 0,target:"_blank",rel:"noopener noreferrer",children:t.text||t.url},l);if(!("text"in t))return null;let u=p(ka,{children:t.text});return"bold"in t&&t.bold&&(u=p("strong",{children:u})),"italic"in t&&t.italic&&(u=p("em",{children:u})),"strikethrough"in t&&t.strikethrough&&(u=p("s",{children:u})),"code"in t&&t.code&&(u=p("code",{children:u})),p("span",{children:u},l)})},o))})}function xa({attachment:e,loadMedia:a}){let[o,t]=Q(e.previewUrl??""),[l,u]=Q(!1),[r,c]=Q(0),i=y(0);U(()=>{if(e.previewUrl){t(e.previewUrl);return}t("");let s=!0,m=!1,d=new AbortController;async function f(){if(!(m||document.visibilityState==="hidden")){m=!0;try{let h=await a(e.id,d.signal);s&&(t(h),u(!1),i.current=Date.now()+240*1e3)}catch{s&&u(!0)}finally{m=!1}}}function n(){Date.now()>=i.current&&f()}f();let x=window.setInterval(n,60*1e3);return window.addEventListener("focus",n),document.addEventListener("visibilitychange",n),()=>{s=!1,d.abort(),window.clearInterval(x),window.removeEventListener("focus",n),document.removeEventListener("visibilitychange",n)}},[e.id,e.previewUrl,r,a]);function L(){u(!0),Date.now()>=i.current&&c(s=>s+1)}return A("figure",{className:"review-attachment",children:[o&&!l?p(ee,{src:o,name:e.name,mimeType:e.mimeType,onError:L}):p("div",{className:"review-attachment-placeholder",role:"status",children:l?p("button",{type:"button",className:"review-retry-upload",onClick:()=>c(s=>s+1),children:"Retry attachment"}):"Loading attachment\u2026"}),p("figcaption",{children:e.name})]})}function Ee(e){let a=Math.max(0,Math.floor((Date.now()-Date.parse(e))/6e4));return a<1?"Just now":a<60?`${a}m`:a<1440?`${Math.floor(a/60)}h`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function Ca({comment:e,activity:a,loadMedia:o,editable:t,editing:l,saving:u,onStartEdit:r,onCancelEdit:c,onSaveEdit:i,onDraftChange:L,onEditStyles:s,draftKey:m}){let[d,f]=Q(e.text),n=y(e.body??D(e.text)),x=y(!1),h=y(!1);U(()=>{l?L(d!==e.text||JSON.stringify(n.current)!==JSON.stringify(e.body??D(e.text))):h.current&&m&&H(m,null),h.current=l},[l]),U(()=>{l||(f(e.text),n.current=e.body??D(e.text))},[l,e.text,e.body]);async function R(){if(!(u||x.current||!d.trim()&&!e.attachments?.length)){x.current=!0;try{await i(d.trimEnd(),_(n.current))&&(m&&H(m,null),L(!1))}finally{x.current=!1}}}return A("article",{className:"review-comment","data-activity":a,children:[p("span",{className:"review-comment-avatar",children:e.authorImage?p("img",{src:e.authorImage,alt:""}):e.author.slice(0,1).toUpperCase()}),A("div",{className:"review-comment-content",children:[A("header",{className:"review-comment-header",children:[p("span",{className:"review-comment-author",children:e.author}),e.pending?p("span",{className:"review-comment-time",role:"status",children:"Sending\u2026"}):p("time",{className:"review-comment-time",dateTime:e.date,title:new Date(e.date).toLocaleString(),children:Ee(e.date)}),t&&!l&&p("button",{type:"button",className:"review-comment-edit","aria-label":"Edit comment",title:"Edit comment",disabled:u,onClick:()=>{let S=m?le(m):null;S&&typeof S.text=="string"&&(f(S.text),n.current=ce(m,S.text)),r()},children:p(N,{size:16})})]}),l?A("form",{className:"review-inline-edit",onSubmit:S=>{S.preventDefault(),R()},children:[p(J,{text:d,defaultBody:n.current,disabled:u,label:"Edit comment",placeholder:"Edit comment\u2026",autoFocus:!0,onSubmit:()=>{R()},onChange:(S,F)=>{f(S),n.current=F,ne(m,S,F,!0),L(S!==e.text||JSON.stringify(F)!==JSON.stringify(e.body??D(e.text)))}}),A("div",{className:"review-inline-edit-actions",children:[s&&p("button",{type:"button",disabled:u,onClick:s,children:"Edit styles"}),p("button",{type:"button",disabled:u,onClick:c,children:"Cancel"}),p("button",{type:"submit",disabled:u||!d.trim()&&!e.attachments?.length,children:"Save"})]})]}):p(He,{body:e.body??D(e.text)}),e.attachments?.length>0&&p("div",{className:"review-attachments",children:e.attachments.map(S=>p(xa,{attachment:S,loadMedia:o},S.id))})]})]})}function ha(e){let a=e.useAttachments(e.disabled,e.existingAttachments?.length??0),o=y(ce(e.draftKey,e.text,e.defaultBody)),t=y(!1);U(()=>(e.onAttachmentDraftChange?.(a.uploading||a.attachments.length>0),()=>e.onAttachmentDraftChange?.(!1)),[a.uploading,a.attachments.length,e.onAttachmentDraftChange]);async function l(){if(!(e.disabled||a.blocked||t.current||!e.text.trim()&&!a.attachments.length&&!e.existingAttachments?.length)){t.current=!0;try{await e.onSubmit(e.text.trimEnd(),_(o.current),a.tokens,a.previews)&&(e.draftKey&&H(e.draftKey,null),a.clear())}finally{t.current=!1}}}return p("form",{className:"review-composer chisel-review-composer","aria-label":e.commentId?"Edit comment":"New comment",onSubmit:u=>{u.preventDefault(),l()},onPasteCapture:u=>{u.clipboardData.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.clipboardData.files))},onDragOver:u=>{u.dataTransfer.types.includes("Files")&&u.preventDefault()},onDropCapture:u=>{u.dataTransfer.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.dataTransfer.files))},children:e.renderContent(A("div",{className:"chisel-composer-input",children:[p(J,{text:e.text,defaultBody:o.current,disabled:e.disabled,label:"Comment",placeholder:"Leave a comment\u2026",autoFocus:!0,onSubmit:()=>{l()},onChange:(u,r)=>{o.current=r,ne(e.draftKey,u,r),e.onText(u)}}),a.previewsUI,a.controls]}),a.attachments.length>0||!!e.existingAttachments?.length,a.blocked,p(Z,{onFiles:a.upload,disabled:e.disabled||a.uploading}))})}function ga(e){let a=e.useAttachments(e.saving),o=y(ce(e.draftKey,e.reply)),t=y(!1);U(()=>(e.onAttachmentDraftChange?.(a.uploading||a.attachments.length>0),()=>e.onAttachmentDraftChange?.(!1)),[a.uploading,a.attachments.length,e.onAttachmentDraftChange]);async function l(){if(!(e.saving||a.blocked||t.current||!e.reply.trim()&&!a.attachments.length)){t.current=!0;try{await e.onReply(e.reply.trimEnd(),_(o.current),a.tokens,a.previews)&&(e.draftKey&&H(e.draftKey,null),o.current=D(""),a.clear())}finally{t.current=!1}}}return A("form",{className:"review-composer chisel-review-reply","aria-label":"Reply to thread",hidden:e.submittingReply,onSubmit:u=>{u.preventDefault(),l()},onPasteCapture:u=>{u.clipboardData.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.clipboardData.files))},onDragOver:u=>{u.dataTransfer.types.includes("Files")&&u.preventDefault()},onDropCapture:u=>{u.dataTransfer.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.dataTransfer.files))},children:[p("span",{className:"feedback-avatar feedback-reply-avatar",children:e.replyAuthor?.image?p("img",{src:e.replyAuthor.image,alt:""}):(e.replyAuthor?.name||"You").slice(0,1).toUpperCase()}),A("div",{className:"chisel-reply-field",children:[p(J,{text:e.reply,defaultBody:o.current,disabled:e.saving,label:"Reply",placeholder:"Write a reply\u2026",onSubmit:()=>{l()},onChange:(u,r)=>{o.current=r,ne(e.draftKey,u,r),e.onReplyText(u)}}),a.previewsUI,a.controls,p("div",{className:"chisel-attachment-controls",children:p(Z,{onFiles:a.upload,disabled:e.saving||a.uploading})}),p("button",{type:"submit",className:"chisel-reply-submit","aria-label":"Reply",disabled:e.saving||a.blocked||!e.reply.trim()&&!a.attachments.length,children:p(W,{size:16,strokeWidth:1.75})})]})]})}function Sa(e){let a=e.comment,[o,t]=Q(null),l=y(!1),u=y(e.onEditDraftChange);u.current=e.onEditDraftChange,U(()=>()=>{u.current?.(!1)},[]);function r(d){l.current=d,e.onEditDraftChange?.(d)}async function c(d){d&&e.onBeginEdit&&!await e.onBeginEdit()||!d&&l.current&&e.onDiscardEdit&&!await e.onDiscardEdit()||(r(!1),t(d))}function i(d,f){return p(Ca,{draftKey:e.draftKey?`${e.draftKey}:edit:${d.id}`:void 0,comment:d,activity:f?a.rootActivity:d.activity,loadMedia:e.loadMedia,editable:!!(e.expanded&&e.onEdit&&e.userId&&d.authorId===e.userId&&!d.pending),editing:o===d.id,saving:e.saving,onEditStyles:f?e.onEditStyles:void 0,onStartEdit:()=>{c(d.id)},onCancelEdit:()=>{c(null)},onDraftChange:r,onSaveEdit:async(n,x)=>{let h=await e.onEdit?.(f?null:d.id,n,x);return h&&(r(!1),t(null)),!!h}},d.id)}let L=y(null),s=y(new Set),m=y(a.readActivity??0);return U(()=>{if(!e.expanded||!L.current||a.pending||a.readActivity===null)return;let d=[a.rootActivity,...a.replies.map(x=>x.activity)],f=new IntersectionObserver(x=>{if(document.visibilityState!=="visible")return;for(let R of x)R.isIntersecting&&R.intersectionRatio>0&&s.current.add(Number(R.target.dataset.activity));let h=re(Math.max(m.current,a.readActivity??0),d,s.current);h>m.current&&(m.current=h,e.onRead(a.id,h))},{threshold:0});function n(){if(f.disconnect(),document.visibilityState==="visible")for(let x of L.current?.querySelectorAll("[data-activity]")??[])f.observe(x)}return n(),document.addEventListener("visibilitychange",n),()=>{f.disconnect(),document.removeEventListener("visibilitychange",n)}},[a,e.expanded,e.onRead]),A("div",{className:"chisel-review-thread-content",children:[e.expanded&&a.context&&A("p",{className:"review-capture-context",children:[a.context.width," \xD7 ",a.context.height,"px \xB7 ",a.breakpoint??"desktop",a.context.deployment?` \xB7 ${a.context.deployment}`:"",A("time",{dateTime:a.context.capturedAt,title:new Date(a.context.capturedAt).toLocaleString(),children:[" \xB7 ",Ee(a.context.capturedAt)]})]}),A("div",{ref:L,className:"review-thread",children:[i(a,!0),e.expanded&&a.replies.map(d=>i(d,!1))]}),e.expanded?!o&&p(ga,{...e}):p("button",{type:"button",className:"chisel-expand-thread",onClick:e.onExpand,children:a.replies.length?`${a.replies.length} ${a.replies.length===1?"reply":"replies"}`:"Reply\u2026"})]})}import{useCallback as Ge,useRef as We}from"react";function wa(e,a){let o=We(new Map),t=We(!1),l=Ge(async()=>{if(!t.current){t.current=!0;try{for(;o.current.size;){let[r,c]=o.current.entries().next().value;try{await e(r,c)}catch(i){if([400,403,404].includes(i.status??0)){o.current.delete(r);continue}throw i}o.current.get(r)===c&&o.current.delete(r),a(r,c)}}catch{}finally{t.current=!1}}},[e,a]),u=Ge((r,c)=>{o.current.set(r,Math.max(c,o.current.get(r)??0)),l()},[l]);return{flush:l,markDisplayed:u}}import{useEffect as Pa,useRef as pe,useState as me}from"react";import{jsx as T,jsxs as Le}from"react/jsx-runtime";function ya(e=!1,a=0,o){let[t,l]=me([]),[u,r]=me(!1),[c,i]=me(""),L=pe(!0),s=pe(!1),m=pe(new Map),d=I=>o.discard(I);Pa(()=>(L.current=!0,()=>{L.current=!1;for(let I of m.current.values())URL.revokeObjectURL(I.preview),d(I).catch(()=>{})}),[]);function f(){L.current&&l([...m.current.values()].map(I=>({...I})))}function n(){for(let I of m.current.values())URL.revokeObjectURL(I.preview);m.current.clear(),L.current&&(l([]),i(""))}async function x(I){let g=m.current.get(I);if(!(!g||s.current||e)){s.current=!0,r(!0);try{await d(g),m.current.delete(I),URL.revokeObjectURL(g.preview),f(),i("")}catch(b){L.current&&i(b instanceof Error?b.message:"The attachment could not be removed.")}finally{s.current=!1,L.current&&r(!1)}}}async function h(I){for(let g of I){if(!L.current)return;let b=g.status==="failed";g.status="uploading",f();try{g.token=await o.send(g,b,()=>L.current),g.status="ready"}catch(B){g.status="failed",L.current&&i(B instanceof Error?B.message:"The upload failed. Your comment is still here.")}finally{L.current||await d(g).catch(()=>{})}f()}}async function R(I){if(!I?.length||s.current||e)return;let g=Array.from(I),b=g.map(B=>Me(B)).find(Boolean);if(b){i(b);return}if(a+m.current.size+g.length>20){i("Attach up to 20 files per comment.");return}s.current=!0,r(!0),i("");try{let B=await o.userId();if(!B)throw new Error("Sign in again to attach files.");if(!L.current)return;let oe=g.map(O=>{let ue=crypto.randomUUID(),Ie={id:ue,name:O.name,mimeType:O.type,size:O.size,file:O,bucket:j.includes(O.type)?"chisel-review-images":"chisel-review-videos",path:`${B}/${ue}`,preview:URL.createObjectURL(O),stored:!1,status:"uploading"};return m.current.set(ue,Ie),Ie});f(),await h(oe)}catch(B){L.current&&i(B instanceof Error?B.message:"The upload failed. Your comment is still here.")}finally{s.current=!1,L.current&&r(!1)}}async function S(){if(!(s.current||e)){s.current=!0,r(!0),i("");try{await h([...m.current.values()].filter(I=>I.status==="failed"))}finally{s.current=!1,L.current&&r(!1)}}}let F=t.some(I=>I.status==="failed"),ae=Le("div",{className:"chisel-attachment-controls",children:[u&&T("span",{role:"status",children:"Uploading\u2026"}),F&&Le("button",{type:"button",className:"review-retry-upload",disabled:u||e,onClick:()=>{S()},children:[T(K,{size:16,strokeWidth:1.75}),"Retry upload"]}),c&&T("span",{className:"chisel-attachment-error",role:"alert",children:c})]}),te=t.length>0&&T("div",{className:"chisel-attachment-previews",children:t.map(I=>Le("div",{className:"chisel-attachment-preview","data-state":I.status,children:[T(ee,{src:I.preview,name:I.name,mimeType:I.mimeType}),T("span",{title:I.name,children:I.name}),T("button",{type:"button","aria-label":`Remove ${I.name}`,disabled:u||e,onClick:()=>{x(I.id)},children:T(q,{size:16,strokeWidth:1.75})})]},I.id))});return{attachments:t,uploading:u,blocked:u||F,controls:ae,previewsUI:te,clear:n,upload:R,previews:t.map(({id:I,name:g,mimeType:b,size:B,preview:oe})=>({id:I,name:g,mimeType:b,size:B,previewUrl:oe})),tokens:t.flatMap(I=>I.token?[I.token]:[])}}var Ve=new WeakMap;async function Aa(e,a,o){let t=Ve.get(e);if(!t){let u=await a.userId();if(!u)throw new Error("Sign in again to save the snapshot.");let r=crypto.randomUUID();t={id:r,name:e.name,mimeType:e.type,size:e.size,file:e,bucket:"chisel-review-images",path:`${u}/${r}`,preview:"",stored:!1,status:"uploading"},Ve.set(e,t)}let l=t.token??await a.send(t,t.stored,()=>!0);if(!l)throw new Error("The snapshot upload was incomplete.");t.token=l,await o(l)}export{Z as ReviewAttachmentButton,He as ReviewBody,ha as ReviewComposer,J as ReviewEditor,Sa as ReviewThread,fe as bodyToEditor,Te as createReviewEditor,re as displayedActivity,ve as editorToBody,Aa as uploadSnapshot,wa as useReadQueue,ya as useReviewAttachments};
1
+ "use client";import{forwardRef as Je,createElement as Qe}from"react";var Ce=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function he(e,a,o=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Ce(e),size:24,node:a,...o.length>0?{aliases:o}:{}}}var ge=e=>{let a="",o=!1;for(let t of e){if(t==="-"||t==="_"||t<=" "){o=a.length>0;continue}a.length===0?a+=t.toLowerCase():a+=o?t.toUpperCase():t,o=!1}return a};var Se=e=>{let a=ge(e);return a.charAt(0).toUpperCase()+a.slice(1)};import{forwardRef as Ze,createElement as Ae}from"react";var W=(...e)=>e.filter((a,o,t)=>!!a&&a.trim()!==""&&t.indexOf(a)===o).join(" ").trim();var v={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function re(e){return e!=null}function ke(e,a={}){let o=a.attributeNames??{},t=d=>o[d]??d,l=e.size??e.width??v.width,u=e.size??e.height??v.height,r=e.aliases?.filter(d=>typeof d=="string"&&d.trim()!=="").map(d=>`lucide-${d}`)??[],n=[...e.name?[`lucide-${e.name}`]:[],...r],i=a.className?.split(" ").filter(Boolean)??[],I=a.includeDefaultClasses===!1?W(...i):W("lucide",...n,...i),s=a.absoluteStrokeWidth?Number(a.strokeWidth??v["stroke-width"])*Number(e.size??e.width??v.width)/Number(a.size??a.width??v.width):a.strokeWidth??v["stroke-width"];return["svg",{...Object.entries(v).reduce((d,[f,c])=>(d[t(f)]=c,d),{}),..."color"in a&&a.color&&{[t("stroke")]:a.color},..."size"in a&&re(a.size)&&{[t("width")]:a.size,[t("height")]:a.size},..."width"in a&&re(a.width)&&{[t("width")]:a.width},..."height"in a&&re(a.height)&&{[t("height")]:a.height},[t("stroke-width")]:s,...I&&{[t("class")]:I},[t("viewBox")]:`0 0 ${l} ${u}`,...a.hasA11yProp===!1?{[t("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(d=>{let[f,c,x]=d,g=a.nonScalingStroke?{[t("vector-effect")]:"non-scaling-stroke",...c}:c;return x?[f,g,x]:[f,g]})]}function we(e,a={}){return ke(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Pe=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};import{createContext as Ne,useContext as Xe,useMemo as za,createElement as Na}from"react";var Ke=Ne({});var ye=()=>Xe(Ke);var Be=Ze(({color:e,size:a,width:o,height:t,strokeWidth:l,absoluteStrokeWidth:u,nonScalingStroke:r,className:n="",children:i,iconNode:I=[],icon:s={node:I,aliases:[],size:24},...L},d)=>{let{size:f=24,strokeWidth:c=2,absoluteStrokeWidth:x=!1,nonScalingStroke:g=!1,color:b="currentColor",className:O=""}=ye()??{},S=!!i||Pe(L),[F,oe,ue=[]]=we(s,{color:e??b,width:o??a??f,height:t??a??f,strokeWidth:l??c,absoluteStrokeWidth:u??x,nonScalingStroke:r??g,className:W(O,n),hasA11yProp:S,attributes:L});return Ae(F,{ref:d,...oe},[...ue.map(([p,h])=>Ae(p,h)),...Array.isArray(i)?i:[i]])});function k(e,a=[],o=[]){let t=typeof e=="string"?he(e,a,o):e,l=Je(({className:u,...r},n)=>Qe(Be,{ref:n,icon:t,className:u,...r}));return t.name&&(l.displayName=Se(t.name)),l}var $e={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]},V=k($e);var _e={name:"download",size:24,node:[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]},z=k(_e);var je={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]},N=k(je);var Ye={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]},X=k(Ye);var ea={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]},K=k(ea);var aa={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]},Z=k(aa);var ta={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]},q=k(ta);import{useEffect as U,useRef as y,useState as $}from"react";function D(e){return{version:1,content:e.split(`
2
+ `).map(a=>({type:"paragraph",children:[{text:a}]}))}}function _(e){return e.content.map(a=>a.children.map(o=>"type"in o?o.text||o.url:o.text).join("")).join(`
3
+ `)}function j(e){let a=e.content.slice();for(;a.length;){let o=a[a.length-1],t=o.children.slice();for(;t.length;){let l=t[t.length-1],u="type"in l?l.text||l.url:l.text,r=u.trimEnd();if(r)return t[t.length-1]=r===u?l:{...l,text:r},a[a.length-1]={...o,children:t},{...e,content:a};t.pop()}a.pop()}return D("")}function se(e){try{let a=JSON.parse(localStorage.getItem(e)??"null");return a?.version===1&&Date.now()-a.time<7*864e5?a.value:null}catch{return null}}function E(e,a){try{return a===null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify({version:1,time:Date.now(),value:a})),!0}catch{return!1}}function fe(e,a,o){let t=e;for(let l of[...a].sort((u,r)=>u-r))if(!(l<=t)){if(!o.has(l))break;t=l}return t}var Y=["image/jpeg","image/png","image/gif","image/webp","image/avif","image/bmp"],De=["video/mp4","video/webm","video/quicktime"],Me=[...Y,...De].join(",");function be(e){let a=Y.includes(e.type);return!a&&!De.includes(e.type)?"Choose a JPG, PNG, GIF, WebP, AVIF, BMP, MP4, WebM, or MOV file.":!Number.isSafeInteger(e.size)||e.size<=0?"This file is empty or invalid.":e.size>(a?5242880:20971520)?`${a?"Images must be 5 MB":"Videos must be 20 MB"} or smaller.`:null}import{useEffect as oa,useRef as Fe,useState as Re}from"react";import{createEditor as ua,Editor as C,Element as G,Node as da,Path as la,Range as ie,Transforms as M}from"slate";import{withHistory as ra}from"slate-history";import{Editable as sa,Slate as fa,withReact as ia,ReactEditor as ve}from"slate-react";import{Fragment as Ue,jsx as w,jsxs as Oe}from"react/jsx-runtime";function ce(e){return e.content.length?e.content.map(a=>({type:"paragraph",children:a.children.length?a.children.map(o=>"type"in o&&o.type==="link"?{type:"link",url:o.url,children:[{text:o.text||o.url}]}:{...o}):[{text:""}]})):[{type:"paragraph",children:[{text:""}]}]}function Te(e){return{version:1,content:e.map(a=>({type:"paragraph",children:G.isElement(a)?a.children.map(o=>G.isElement(o)?{type:"link",url:o.url,text:da.string(o)}:{...o}):[{text:a.text}]}))}}function ne(e){return/^(https?:\/\/|mailto:)[^\s]+$/i.test(e)}function ca(e,a){if(!e.selection){let o=window.getSelection(),t=o&&ve.toSlateRange(e,o,{exactMatch:!1,suppressThrow:!0});M.select(e,t??C.end(e,[]))}C.marks(e)?.[a]?C.removeMark(e,a):C.addMark(e,a,!0)}function qe(){let e=ia(ra(ua()),"application/x-chisel-review-fragment"),{isInline:a,insertText:o,insertData:t,insertBreak:l}=e;e.isInline=n=>n.type==="link"||a(n);function u(n,i){C.above(e,{at:n,match:I=>G.isElement(I)&&I.type==="link"})||(M.wrapNodes(e,{type:"link",url:i,children:[]},{at:n,split:!0}),M.collapse(e,{edge:"end"}))}function r(){if(!e.selection||!ie.isCollapsed(e.selection))return;let n=C.above(e,{match:d=>G.isElement(d)&&d.type==="paragraph"});if(!n)return;let i=e.selection.anchor,s=C.string(e,{anchor:C.start(e,n[1]),focus:i}).match(/\S+$/)?.[0];if(!s||!ne(s))return;let L=C.before(e,i,{distance:s.length,unit:"offset"});if(L){u({anchor:L,focus:i},s);let d=C.above(e,{match:f=>G.isElement(f)&&f.type==="link"});d&&e.selection&&C.isEnd(e,e.selection.anchor,d[1])&&M.select(e,C.start(e,la.next(d[1])))}}return e.insertText=n=>{if(ve.isComposing(e)){o(n);return}n===" "&&r();let i={"*":"bold",_:"italic","~":"strikethrough","`":"code"}[n];if(i&&e.selection&&ie.isCollapsed(e.selection)){let I=C.above(e,{match:s=>G.isElement(s)&&s.type==="paragraph"});if(I){let s=e.selection.anchor,L=C.string(e,{anchor:C.start(e,I[1]),focus:s}),d=L.lastIndexOf(n),f=L.slice(d+1);if(d>=0&&(!d||/[\s*_~`]/.test(L[d-1]))&&f&&f.trim()===f){let c=C.before(e,s,{distance:f.length,unit:"offset"}),x=c&&C.before(e,c,{unit:"offset"});if(c&&x){M.select(e,{anchor:c,focus:s}),C.addMark(e,i,!0),M.collapse(e,{edge:"end"}),M.delete(e,{at:{anchor:x,focus:c}}),C.removeMark(e,i);return}}}}o(n)},e.insertBreak=()=>{r(),l()},e.insertData=n=>{let i=n.getData("text/plain");ne(i)?e.selection&&!ie.isCollapsed(e.selection)?u(e.selection,i):M.insertNodes(e,[{type:"link",url:i,children:[{text:i}]},{text:""}]):t(n)},e}function na({attributes:e,children:a,element:o}){return o.type==="link"?w("a",{...e,href:ne(o.url)?o.url:void 0,onClick:t=>t.preventDefault(),children:a}):w("p",{...e,children:a})}function pa({attributes:e,children:a,leaf:o}){let t=w(Ue,{children:a});return o.bold&&(t=w("strong",{children:t})),o.italic&&(t=w("em",{children:t})),o.strikethrough&&(t=w("s",{children:t})),o.code&&(t=w("code",{children:t})),w("span",{...e,children:t})}function J({onFiles:e,disabled:a}){let o=Fe(null);return Oe(Ue,{children:[w("input",{ref:o,type:"file",accept:Me,multiple:!0,hidden:!0,onChange:t=>{e(t.target.files),t.target.value=""}}),w("button",{type:"button",className:"review-retry-upload","aria-label":"Attach image or video",title:"Images up to 5 MB \xB7 Videos up to 20 MB",disabled:a,onClick:()=>o.current?.click(),children:w(N,{size:16,strokeWidth:1.75})})]})}function Q({text:e,defaultBody:a,disabled:o,label:t,placeholder:l,autoFocus:u,onChange:r,onSubmit:n,onFiles:i,uploading:I}){let[s]=Re(qe),[L]=Re(()=>ce(a??D(e))),d=Fe(e);return oa(()=>{if(e===d.current)return;let f=d.current;d.current=e,f&&e.startsWith(f)?M.insertText(s,e.slice(f.length),{at:C.end(s,[])}):(C.withoutNormalizing(s,()=>{M.removeNodes(s,{at:[],match:(c,x)=>x.length===1}),M.insertNodes(s,ce(D(e)),{at:[0]}),M.deselect(s)}),e||(s.history={undos:[],redos:[]}))},[s,e]),Oe(fa,{editor:s,initialValue:L,onChange:f=>{if(!s.operations.some(x=>x.type!=="set_selection"))return;let c=Te(f);d.current=_(c),r(d.current,c)},children:[w(sa,{className:"review-composer-editor",role:"textbox","aria-multiline":"true","aria-label":t,placeholder:l,readOnly:o,autoFocus:u,renderElement:na,renderLeaf:pa,onKeyDown:f=>{if(f.nativeEvent.isComposing)return;let c=f.metaKey||f.ctrlKey;if(f.key==="Enter"){f.preventDefault(),c?s.insertBreak():n();return}let x=c?{b:"bold",i:"italic",e:"code",...f.shiftKey?{s:"strikethrough"}:{}}[f.key.toLowerCase()]:void 0;x&&(f.preventDefault(),ca(s,x))}}),i&&w("div",{className:"chisel-attachment-controls",children:w(J,{onFiles:i,disabled:o||I})})]})}import{useEffect as ma,useRef as La,useState as Ia}from"react";import{Fragment as He,jsx as P,jsxs as ee}from"react/jsx-runtime";function xa({src:e,name:a,mimeType:o,onError:t,close:l}){let u=La(null);return ma(()=>{u.current?.showModal()},[]),P("dialog",{ref:u,className:"review-media-lightbox","aria-label":`Preview ${a}`,onCancel:r=>{r.preventDefault(),l()},onClick:r=>{r.target===r.currentTarget&&l()},children:ee("div",{className:"review-media-lightbox-content",children:[ee("header",{children:[P("span",{children:a}),P("a",{href:e,download:a,"aria-label":`Download ${a}`,title:"Download",children:P(z,{size:20,"aria-hidden":"true"})}),P("button",{type:"button","aria-label":"Close preview",onClick:l,children:P(q,{size:20})})]}),o.startsWith("image/")?P("img",{src:e,alt:a,onError:t}):P("video",{src:e,controls:!0,autoPlay:!0,playsInline:!0,"aria-label":a,onError:t})]})})}function ae({src:e,name:a,mimeType:o,onError:t}){let[l,u]=Ia(!1);return ee(He,{children:[P("button",{type:"button",className:"review-media-thumbnail","aria-label":`Preview ${a}`,onClick:()=>u(!0),children:o.startsWith("image/")?P("img",{src:e,alt:a,loading:"lazy",onError:t}):ee(He,{children:[P("video",{src:e,muted:!0,playsInline:!0,preload:"metadata","aria-hidden":"true",onError:t}),P("span",{className:"review-media-play","aria-hidden":"true",children:P(K,{size:20,fill:"currentColor"})})]})}),l&&P(xa,{src:e,name:a,mimeType:o,onError:t,close:()=>u(!1)})]})}import{Fragment as wa,jsx as m,jsxs as A}from"react/jsx-runtime";function pe(e,a,o){if(e)try{let t=se(e);if(t?.text===a&&_(t.body)===a)return t.body}catch{}return o??D(a)}function me(e,a,o,t=!1){e&&E(e,t||a.trim()?{text:a,body:o}:null)}function Ee({body:e}){return m("div",{className:"review-comment-body",children:e.content.map((a,o)=>m("p",{children:a.children.map((t,l)=>{if("type"in t&&t.type==="link")return m("a",{href:/^(https?:|mailto:)/i.test(t.url)?t.url:void 0,target:"_blank",rel:"noopener noreferrer",children:t.text||t.url},l);if(!("text"in t))return null;let u=m(wa,{children:t.text});return"bold"in t&&t.bold&&(u=m("strong",{children:u})),"italic"in t&&t.italic&&(u=m("em",{children:u})),"strikethrough"in t&&t.strikethrough&&(u=m("s",{children:u})),"code"in t&&t.code&&(u=m("code",{children:u})),m("span",{children:u},l)})},o))})}function Ca({attachment:e,loadMedia:a}){let[o,t]=$(e.previewUrl??""),[l,u]=$(!1),[r,n]=$(0),i=y(0);U(()=>{if(e.previewUrl){t(e.previewUrl);return}t("");let s=!0,L=!1,d=new AbortController;async function f(){if(!(L||document.visibilityState==="hidden")){L=!0;try{let g=await a(e.id,d.signal);s&&(t(g),u(!1),i.current=Date.now()+240*1e3)}catch{s&&u(!0)}finally{L=!1}}}function c(){Date.now()>=i.current&&f()}f();let x=window.setInterval(c,60*1e3);return window.addEventListener("focus",c),document.addEventListener("visibilitychange",c),()=>{s=!1,d.abort(),window.clearInterval(x),window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",c)}},[e.id,e.previewUrl,r,a]);function I(){u(!0),Date.now()>=i.current&&n(s=>s+1)}return A("figure",{className:"review-attachment",children:[o&&!l?m(ae,{src:o,name:e.name,mimeType:e.mimeType,onError:I}):m("div",{className:"review-attachment-placeholder",role:"status",children:l?m("button",{type:"button",className:"review-retry-upload",onClick:()=>n(s=>s+1),children:"Retry attachment"}):"Loading attachment\u2026"}),m("figcaption",{children:e.name})]})}function Ge(e){let a=Math.max(0,Math.floor((Date.now()-Date.parse(e))/6e4));return a<1?"Just now":a<60?`${a}m`:a<1440?`${Math.floor(a/60)}h`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric"})}function ha({comment:e,activity:a,loadMedia:o,editable:t,editing:l,saving:u,onStartEdit:r,onCancelEdit:n,onSaveEdit:i,onDraftChange:I,onEditStyles:s,draftKey:L}){let[d,f]=$(e.text),c=y(e.body??D(e.text)),x=y(!1),g=l&&!(u&&x.current),b=y(!1);U(()=>{l?I(d!==e.text||JSON.stringify(c.current)!==JSON.stringify(e.body??D(e.text))):b.current&&L&&E(L,null),b.current=l},[l]),U(()=>{l||(f(e.text),c.current=e.body??D(e.text))},[l,e.text,e.body]);async function O(){if(!(u||x.current||!d.trim()&&!e.attachments?.length)){x.current=!0;try{await i(d.trimEnd(),j(c.current))&&(L&&E(L,null),I(!1))}finally{x.current=!1}}}return A("article",{className:"review-comment","data-activity":a,children:[m("span",{className:"review-comment-avatar",children:e.authorImage?m("img",{src:e.authorImage,alt:""}):e.author.slice(0,1).toUpperCase()}),A("div",{className:"review-comment-content",children:[A("header",{className:"review-comment-header",children:[m("span",{className:"review-comment-author",children:e.author}),e.pending?m("span",{className:"review-comment-time",role:"status",children:"Sending\u2026"}):m("time",{className:"review-comment-time",dateTime:e.date,title:new Date(e.date).toLocaleString(),children:Ge(e.date)}),t&&!l&&m("button",{type:"button",className:"review-comment-edit","aria-label":"Edit comment",title:"Edit comment",disabled:u,onClick:()=>{let S=L?se(L):null;S&&typeof S.text=="string"&&(f(S.text),c.current=pe(L,S.text)),r()},children:m(X,{size:16})})]}),g?A("form",{className:"review-inline-edit",onSubmit:S=>{S.preventDefault(),O()},children:[m(Q,{text:d,defaultBody:c.current,disabled:u,label:"Edit comment",placeholder:"Edit comment\u2026",autoFocus:!0,onSubmit:()=>{O()},onChange:(S,F)=>{f(S),c.current=F,me(L,S,F,!0),I(S!==e.text||JSON.stringify(F)!==JSON.stringify(e.body??D(e.text)))}}),A("div",{className:"review-inline-edit-actions",children:[s&&m("button",{type:"button",disabled:u,onClick:s,children:"Edit styles"}),m("button",{type:"button",disabled:u,onClick:n,children:"Cancel"}),m("button",{type:"submit",disabled:u||!d.trim()&&!e.attachments?.length,children:"Save"})]})]}):m(Ee,{body:e.body??D(e.text)}),e.attachments?.length>0&&m("div",{className:"review-attachments",children:e.attachments.map(S=>m(Ca,{attachment:S,loadMedia:o},S.id))})]})]})}function ga(e){let a=e.useAttachments(e.disabled,e.existingAttachments?.length??0),o=y(pe(e.draftKey,e.text,e.defaultBody)),t=y(!1);U(()=>(e.onAttachmentDraftChange?.(a.uploading||a.attachments.length>0),()=>e.onAttachmentDraftChange?.(!1)),[a.uploading,a.attachments.length,e.onAttachmentDraftChange]);async function l(){if(!(e.disabled||a.blocked||t.current||!e.text.trim()&&!a.attachments.length&&!e.existingAttachments?.length)){t.current=!0;try{await e.onSubmit(e.text.trimEnd(),j(o.current),a.tokens,a.previews)&&(e.draftKey&&E(e.draftKey,null),a.clear())}finally{t.current=!1}}}return m("form",{className:"review-composer chisel-review-composer","aria-label":e.commentId?"Edit comment":"New comment",onSubmit:u=>{u.preventDefault(),l()},onPasteCapture:u=>{u.clipboardData.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.clipboardData.files))},onDragOver:u=>{u.dataTransfer.types.includes("Files")&&u.preventDefault()},onDropCapture:u=>{u.dataTransfer.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.dataTransfer.files))},children:e.renderContent(A("div",{className:"chisel-composer-input",children:[m(Q,{text:e.text,defaultBody:o.current,disabled:e.disabled,label:"Comment",placeholder:"Leave a comment\u2026",autoFocus:!0,onSubmit:()=>{l()},onChange:(u,r)=>{o.current=r,me(e.draftKey,u,r),e.onText(u)}}),a.previewsUI,a.controls]}),a.attachments.length>0||!!e.existingAttachments?.length,a.blocked,m(J,{onFiles:a.upload,disabled:e.disabled||a.uploading}))})}function Sa(e){let a=e.useAttachments(e.saving),o=y(pe(e.draftKey,e.reply)),t=y(!1);U(()=>(e.onAttachmentDraftChange?.(a.uploading||a.attachments.length>0),()=>e.onAttachmentDraftChange?.(!1)),[a.uploading,a.attachments.length,e.onAttachmentDraftChange]);async function l(){if(!(e.saving||a.blocked||t.current||!e.reply.trim()&&!a.attachments.length)){t.current=!0;try{await e.onReply(e.reply.trimEnd(),j(o.current),a.tokens,a.previews)&&(e.draftKey&&E(e.draftKey,null),o.current=D(""),a.clear())}finally{t.current=!1}}}return A("form",{className:"review-composer chisel-review-reply","aria-label":"Reply to thread",hidden:e.submittingReply,onSubmit:u=>{u.preventDefault(),l()},onPasteCapture:u=>{u.clipboardData.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.clipboardData.files))},onDragOver:u=>{u.dataTransfer.types.includes("Files")&&u.preventDefault()},onDropCapture:u=>{u.dataTransfer.files.length&&(u.preventDefault(),u.stopPropagation(),a.upload(u.dataTransfer.files))},children:[m("span",{className:"feedback-avatar feedback-reply-avatar",children:e.replyAuthor?.image?m("img",{src:e.replyAuthor.image,alt:""}):(e.replyAuthor?.name||"You").slice(0,1).toUpperCase()}),A("div",{className:"chisel-reply-field",children:[m(Q,{text:e.reply,defaultBody:o.current,disabled:e.saving,label:"Reply",placeholder:"Write a reply\u2026",onSubmit:()=>{l()},onChange:(u,r)=>{o.current=r,me(e.draftKey,u,r),e.onReplyText(u)}}),a.previewsUI,a.controls,m("div",{className:"chisel-attachment-controls",children:m(J,{onFiles:a.upload,disabled:e.saving||a.uploading})}),m("button",{type:"submit",className:"chisel-reply-submit","aria-label":"Reply",disabled:e.saving||a.blocked||!e.reply.trim()&&!a.attachments.length,children:m(V,{size:16,strokeWidth:1.75})})]})]})}function ka(e){let a=e.comment,[o,t]=$(null),l=y(!1),u=y(e.onEditDraftChange);u.current=e.onEditDraftChange,U(()=>()=>{u.current?.(!1)},[]);function r(d){l.current=d,e.onEditDraftChange?.(d)}async function n(d){d&&e.onBeginEdit&&!await e.onBeginEdit()||!d&&l.current&&e.onDiscardEdit&&!await e.onDiscardEdit()||(r(!1),t(d))}function i(d,f){return m(ha,{draftKey:e.draftKey?`${e.draftKey}:edit:${d.id}`:void 0,comment:d,activity:f?a.rootActivity:d.activity,loadMedia:e.loadMedia,editable:!!(e.expanded&&e.onEdit&&e.userId&&d.authorId===e.userId&&!d.pending),editing:o===d.id,saving:e.saving,onEditStyles:f?e.onEditStyles:void 0,onStartEdit:()=>{n(d.id)},onCancelEdit:()=>{n(null)},onDraftChange:r,onSaveEdit:async(c,x)=>{let g=await e.onEdit?.(f?null:d.id,c,x);return g&&(r(!1),t(null)),!!g}},d.id)}let I=y(null),s=y(new Set),L=y(a.readActivity??0);return U(()=>{if(!e.expanded||!I.current||a.pending||a.readActivity===null)return;let d=[a.rootActivity,...a.replies.map(x=>x.activity)],f=new IntersectionObserver(x=>{if(document.visibilityState!=="visible")return;for(let b of x)b.isIntersecting&&b.intersectionRatio>0&&s.current.add(Number(b.target.dataset.activity));let g=fe(Math.max(L.current,a.readActivity??0),d,s.current);g>L.current&&(L.current=g,e.onRead(a.id,g))},{threshold:0});function c(){if(f.disconnect(),document.visibilityState==="visible")for(let x of I.current?.querySelectorAll("[data-activity]")??[])f.observe(x)}return c(),document.addEventListener("visibilitychange",c),()=>{f.disconnect(),document.removeEventListener("visibilitychange",c)}},[a,e.expanded,e.onRead]),A("div",{className:"chisel-review-thread-content",children:[e.expanded&&a.context&&A("p",{className:"review-capture-context",children:[a.context.width," \xD7 ",a.context.height,"px \xB7 ",a.breakpoint??"desktop",a.context.deployment?` \xB7 ${a.context.deployment}`:"",A("time",{dateTime:a.context.capturedAt,title:new Date(a.context.capturedAt).toLocaleString(),children:[" \xB7 ",Ge(a.context.capturedAt)]})]}),A("div",{ref:I,className:"review-thread",children:[i(a,!0),e.expanded&&a.replies.map(d=>i(d,!1))]}),e.expanded?!o&&m(Sa,{...e}):m("button",{type:"button",className:"chisel-expand-thread",onClick:e.onExpand,children:a.replies.length?`${a.replies.length} ${a.replies.length===1?"reply":"replies"}`:"Reply\u2026"})]})}import{useCallback as We,useRef as Ve}from"react";function Pa(e,a){let o=Ve(new Map),t=Ve(!1),l=We(async()=>{if(!t.current){t.current=!0;try{for(;o.current.size;){let[r,n]=o.current.entries().next().value;try{await e(r,n)}catch(i){if([400,403,404].includes(i.status??0)){o.current.delete(r);continue}throw i}o.current.get(r)===n&&o.current.delete(r),a(r,n)}}catch{}finally{t.current=!1}}},[e,a]),u=We((r,n)=>{o.current.set(r,Math.max(n,o.current.get(r)??0)),l()},[l]);return{flush:l,markDisplayed:u}}import{useEffect as ya,useRef as te,useState as Le}from"react";import{jsx as T,jsxs as Ie}from"react/jsx-runtime";function Aa(e=!1,a=0,o){let[t,l]=Le([]),[u,r]=Le(!1),[n,i]=Le(""),I=te(!0),s=te(!1),L=te(new Map),d=te(null),f=p=>o.discard(p);ya(()=>(I.current=!0,()=>{I.current=!1;for(let p of L.current.values())URL.revokeObjectURL(p.preview),f(p).catch(()=>{})}),[]);function c(){I.current&&l([...L.current.values()].filter(p=>p.id!==d.current).map(p=>({...p})))}function x(){for(let p of L.current.values())URL.revokeObjectURL(p.preview);L.current.clear(),I.current&&(l([]),i(""))}async function g(p){let h=L.current.get(p);if(!(!h||s.current||e)){s.current=!0,r(!0),d.current=p,c();try{await f(h),L.current.delete(p),URL.revokeObjectURL(h.preview),c(),i("")}catch(R){I.current&&i(R instanceof Error?R.message:"The attachment could not be removed.")}finally{d.current=null,s.current=!1,c(),I.current&&r(!1)}}}async function b(p){for(let h of p){if(!I.current)return;let R=h.status==="failed";h.status="uploading",c();try{h.token=await o.send(h,R,()=>I.current),h.status="ready"}catch(B){h.status="failed",I.current&&i(B instanceof Error?B.message:"The upload failed. Your comment is still here.")}finally{I.current||await f(h).catch(()=>{})}c()}}async function O(p){if(!p?.length||s.current||e)return;let h=Array.from(p),R=h.map(B=>be(B)).find(Boolean);if(R){i(R);return}if(a+L.current.size+h.length>20){i("Attach up to 20 files per comment.");return}s.current=!0,r(!0),i("");try{let B=await o.userId();if(!B)throw new Error("Sign in again to attach files.");if(!I.current)return;let de=h.map(H=>{let le=crypto.randomUUID(),xe={id:le,name:H.name,mimeType:H.type,size:H.size,file:H,bucket:Y.includes(H.type)?"chisel-review-images":"chisel-review-videos",path:`${B}/${le}`,preview:URL.createObjectURL(H),stored:!1,status:"uploading"};return L.current.set(le,xe),xe});c(),await b(de)}catch(B){I.current&&i(B instanceof Error?B.message:"The upload failed. Your comment is still here.")}finally{s.current=!1,I.current&&r(!1)}}async function S(){if(!(s.current||e)){s.current=!0,r(!0),i("");try{await b([...L.current.values()].filter(p=>p.status==="failed"))}finally{s.current=!1,I.current&&r(!1)}}}let F=t.some(p=>p.status==="failed"),oe=Ie("div",{className:"chisel-attachment-controls",children:[u&&T("span",{role:"status",children:"Uploading\u2026"}),F&&Ie("button",{type:"button",className:"review-retry-upload",disabled:u||e,onClick:()=>{S()},children:[T(Z,{size:16,strokeWidth:1.75}),"Retry upload"]}),n&&T("span",{className:"chisel-attachment-error",role:"alert",children:n})]}),ue=t.length>0&&T("div",{className:"chisel-attachment-previews",children:t.map(p=>Ie("div",{className:"chisel-attachment-preview","data-state":p.status,children:[T(ae,{src:p.preview,name:p.name,mimeType:p.mimeType}),T("span",{title:p.name,children:p.name}),T("button",{type:"button","aria-label":`Remove ${p.name}`,disabled:u||e,onClick:()=>{g(p.id)},children:T(q,{size:16,strokeWidth:1.75})})]},p.id))});return{attachments:t,uploading:u,blocked:u||F,controls:oe,previewsUI:ue,clear:x,upload:O,previews:t.map(({id:p,name:h,mimeType:R,size:B,preview:de})=>({id:p,name:h,mimeType:R,size:B,previewUrl:de})),tokens:t.flatMap(p=>p.token?[p.token]:[])}}var ze=new WeakMap;async function Ba(e,a,o){let t=ze.get(e);if(!t){let u=await a.userId();if(!u)throw new Error("Sign in again to save the snapshot.");let r=crypto.randomUUID();t={id:r,name:e.name,mimeType:e.type,size:e.size,file:e,bucket:"chisel-review-images",path:`${u}/${r}`,preview:"",stored:!1,status:"uploading"},ze.set(e,t)}let l=t.token??await a.send(t,t.stored,()=>!0);if(!l)throw new Error("The snapshot upload was incomplete.");t.token=l,await o(l)}export{J as ReviewAttachmentButton,Ee as ReviewBody,ga as ReviewComposer,Q as ReviewEditor,ka as ReviewThread,ce as bodyToEditor,qe as createReviewEditor,fe as displayedActivity,Te as editorToBody,Ba as uploadSnapshot,Pa as useReadQueue,Aa as useReviewAttachments};
4
4
  /*! Bundled license information:
5
5
 
6
6
  lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
@@ -1,19 +1,19 @@
1
- "use client";import{useEffect as le,useLayoutEffect as et,useRef as z,useState as S}from"react";import{forwardRef as Hr,createElement as Er}from"react";var Fo=a=>a?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function To(a,t,r=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Fo(a),size:24,node:t,...r.length>0?{aliases:r}:{}}}var qo=a=>{let t="",r=!1;for(let l of a){if(l==="-"||l==="_"||l<=" "){r=t.length>0;continue}t.length===0?t+=l.toLowerCase():t+=r?l.toUpperCase():l,r=!1}return t};var Uo=a=>{let t=qo(a);return t.charAt(0).toUpperCase()+t.slice(1)};import{forwardRef as Ur,createElement as No}from"react";var Ea=(...a)=>a.filter((t,r,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===r).join(" ").trim();var Qe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function Jt(a){return a!=null}function Ho(a,t={}){let r=t.attributeNames??{},l=w=>r[w]??w,d=a.size??a.width??Qe.width,c=a.size??a.height??Qe.height,n=a.aliases?.filter(w=>typeof w=="string"&&w.trim()!=="").map(w=>`lucide-${w}`)??[],m=[...a.name?[`lucide-${a.name}`]:[],...n],L=t.className?.split(" ").filter(Boolean)??[],y=t.includeDefaultClasses===!1?Ea(...L):Ea("lucide",...m,...L),B=t.absoluteStrokeWidth?Number(t.strokeWidth??Qe["stroke-width"])*Number(a.size??a.width??Qe.width)/Number(t.size??t.width??Qe.width):t.strokeWidth??Qe["stroke-width"];return["svg",{...Object.entries(Qe).reduce((w,[N,R])=>(w[l(N)]=R,w),{}),..."color"in t&&t.color&&{[l("stroke")]:t.color},..."size"in t&&Jt(t.size)&&{[l("width")]:t.size,[l("height")]:t.size},..."width"in t&&Jt(t.width)&&{[l("width")]:t.width},..."height"in t&&Jt(t.height)&&{[l("height")]:t.height},[l("stroke-width")]:B,...y&&{[l("class")]:y},[l("viewBox")]:`0 0 ${d} ${c}`,...t.hasA11yProp===!1?{[l("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},a.node.map(w=>{let[N,R,_]=w,C=t.nonScalingStroke?{[l("vector-effect")]:"non-scaling-stroke",...R}:R;return _?[N,C,_]:[N,C]})]}function Eo(a,t={}){return Ho(a,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Oo=a=>{for(let t in a)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};import{createContext as Fr,useContext as Tr,useMemo as $l,createElement as Kl}from"react";var qr=Fr({});var zo=()=>Tr(qr);var Wo=Ur(({color:a,size:t,width:r,height:l,strokeWidth:d,absoluteStrokeWidth:c,nonScalingStroke:n,className:m="",children:L,iconNode:y=[],icon:B={node:y,aliases:[],size:24},...V},w)=>{let{size:N=24,strokeWidth:R=2,absoluteStrokeWidth:_=!1,nonScalingStroke:C=!1,color:k="currentColor",className:K=""}=zo()??{},J=!!L||Oo(V),[ae,h,b=[]]=Eo(B,{color:a??k,width:r??t??N,height:l??t??N,strokeWidth:d??R,absoluteStrokeWidth:c??_,nonScalingStroke:n??C,className:Ea(K,m),hasA11yProp:J,attributes:V});return No(ae,{ref:w,...h},[...b.map(([X,ne])=>No(X,ne)),...Array.isArray(L)?L:[L]])});function g(a,t=[],r=[]){let l=typeof a=="string"?To(a,t,r):a,d=Hr(({className:c,...n},m)=>Er(Wo,{ref:m,icon:l,className:c,...n}));return l.name&&(d.displayName=Uo(l.name)),d}var Or={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]},Oa=g(Or);var zr={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]},za=g(zr);var Nr={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]},fa=g(Nr);var Wr={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},ca=g(Wr);var Gr={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]},ea=g(Gr);var Vr={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]},aa=g(Vr);var Xr={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]},Na=g(Xr);var $r={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]},ba=g($r);var Kr={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]},Ca=g(Kr);var Zr={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]},Wa=g(Zr);var jr={name:"grip-horizontal",size:24,node:[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]},Ga=g(jr);var _r={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]},pa=g(_r);var Jr={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]},ta=g(Jr);var Yr={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]},Va=g(Yr);var Qr={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]},ma=g(Qr);var el={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]},Xa=g(el);var al={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]},ka=g(al);var tl={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]},wa=g(tl);var ol={name:"pipette",size:24,node:[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]]},$a=g(ol);var rl={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]},Ka=g(rl);var ll={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]},ha=g(ll);var dl={name:"smartphone",size:24,node:[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]},Za=g(dl);var sl={name:"square-dashed",size:24,node:[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]],aliases:["box-select"]},oa=g(sl);var ul={name:"tablet",size:24,node:[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]},ja=g(ul);var il={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]},ra=g(il);var nl={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]},Sa=g(nl);import{useEffect as jo,useId as ml,useState as $e}from"react";import{useEffect as fl,useRef as Vo,useState as ya}from"react";import{createPortal as cl}from"react-dom";function Go(a,t,r,l=1){a/=255,t/=255,r/=255;let d=Math.max(a,t,r),c=Math.min(a,t,r),n=d-c;return{h:(n?d===a?((t-r)/n+6)%6:d===t?(r-a)/n+2:(a-t)/n+4:0)*60,s:d?n/d:0,v:d,a:l}}function St({h:a,s:t,v:r,a:l}){let d=c=>{let n=(c+a/60)%6;return Math.round(255*r*(1-t*Math.max(0,Math.min(n,4-n,1)))).toString(16).padStart(2,"0")};return`#${d(5)}${d(3)}${d(1)}${l<1?Math.round(l*255).toString(16).padStart(2,"0"):""}`}function yt(a){if(typeof document<"u"){let t=document.createElement("canvas");t.width=t.height=1;let r=t.getContext("2d");if(r){r.fillStyle=a,r.fillRect(0,0,1,1);let[l,d,c,n]=r.getImageData(0,0,1,1).data;return Go(l,d,c,n/255)}}return Go(0,0,0)}import{jsx as De,jsxs as _a}from"react/jsx-runtime";function Yt({label:a,value:t,onChange:r,disabled:l}){let d=Vo(null),c=Vo(null),[n,m]=ya(null),[L,y]=ya({h:0,s:0,v:0,a:1}),[B,V]=ya(""),[w,N]=ya(!1),[R,_]=ya(!1),[C,k]=ya(!1);function K(){m(null)}fl(()=>{if(!n)return;let h=H=>{!c.current?.contains(H.target)&&!d.current?.contains(H.target)&&K()},b=H=>{H.key==="Escape"&&(H.preventDefault(),H.stopPropagation(),K(),d.current?.focus())},X=d.current?.getBoundingClientRect(),ne=H=>{if(c.current?.contains(H.target))return;let pe=d.current?.getBoundingClientRect();(pe?.top!==X?.top||pe?.left!==X?.left)&&K()};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",b,!0),window.addEventListener("resize",K),document.addEventListener("scroll",ne,!0),c.current?.querySelector("input")?.focus({preventScroll:!0}),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",b,!0),window.removeEventListener("resize",K),document.removeEventListener("scroll",ne,!0)}},[n]);function J(h){h.a===0&&(h={...h,a:1}),y(h);let b=St(h);V(b.slice(1).toUpperCase()),N(!1),r(b)}function ae(h){let b=h.currentTarget.getBoundingClientRect();J({...L,s:Math.max(0,Math.min(1,(h.clientX-b.left)/b.width)),v:1-Math.max(0,Math.min(1,(h.clientY-b.top)/b.height))})}return _a("div",{className:"comment-box-color",children:[De("button",{ref:d,className:"comment-color-trigger",type:"button","aria-label":`${a} picker`,"aria-haspopup":"dialog","aria-expanded":!!n,disabled:l,onClick:()=>{if(n){K();return}let h=yt(t);y(h),V(St(h).slice(1).toUpperCase()),N(!1),_("EyeDropper"in window);let b=d.current.getBoundingClientRect();m({left:Math.max(8,Math.min(b.right-256,window.innerWidth-264)),top:Math.max(8,Math.min(b.bottom+8,window.innerHeight-330))})},children:De("span",{style:{background:t}})}),De("span",{className:"comment-color-value",title:t,children:t}),n&&cl(_a("div",{ref:c,className:"chisel-color-picker",role:"dialog","aria-label":`${a} color picker`,style:n,onKeyDown:h=>{if(h.key!=="Tab")return;let b=Array.from(c.current.querySelectorAll("button:not(:disabled), input:not(:disabled)"));h.shiftKey&&document.activeElement===b[0]?(h.preventDefault(),b[b.length-1]?.focus()):!h.shiftKey&&document.activeElement===b[b.length-1]&&(h.preventDefault(),b[0]?.focus())},children:[_a("div",{className:"chisel-color-plane",style:{backgroundColor:`hsl(${L.h} 100% 50%)`},onPointerDown:h=>{h.currentTarget.setPointerCapture(h.pointerId),ae(h)},onPointerMove:h=>{h.currentTarget.hasPointerCapture(h.pointerId)&&ae(h)},children:[De("span",{className:"chisel-color-thumb",style:{left:`${L.s*100}%`,top:`${(1-L.v)*100}%`,background:St({...L,a:1})}}),De("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} saturation`,min:0,max:100,value:Math.round(L.s*100),onChange:h=>J({...L,s:Number(h.target.value)/100})}),De("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} brightness`,min:0,max:100,value:Math.round(L.v*100),onChange:h=>J({...L,v:Number(h.target.value)/100})})]}),_a("div",{className:"chisel-color-tools",children:[De("input",{className:"chisel-color-hue",type:"range","aria-label":`${a} hue`,min:0,max:360,value:Math.round(L.h),style:{"--hue":`hsl(${L.h} 100% 50%)`},onChange:h=>J({...L,h:Number(h.target.value)})}),De("button",{type:"button","aria-label":`Pick ${a.toLowerCase()} from screen`,title:R?"Pick a color from the screen":"Screen color picker is not supported in this browser",disabled:!R||C,onClick:async()=>{let h=window.EyeDropper;if(h){k(!0);try{let b=await new h().open();c.current&&J(yt(b.sRGBHex))}catch{}finally{k(!1)}}},children:De($a,{size:18})})]}),_a("label",{className:"chisel-color-hex",children:["HEX",De("input",{"aria-label":`${a} hex`,value:B,maxLength:9,spellCheck:!1,"aria-invalid":w,onChange:h=>{let b=h.target.value.replace(/^#/,"");V(b);let X=/^(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(b);if(N(!X),X){let ne=yt(`#${b}`);y(ne),r(`#${b}`)}}})]}),w&&De("span",{className:"chisel-color-error",role:"status",children:"Enter a valid hex color."})]}),document.body)]})}import{useRef as pl}from"react";import{jsx as Xo}from"react/jsx-runtime";function Ja({onMoveStart:a}){let t=pl(null);function r(l,d,c){let n=l.closest(".comment-box,.comment-thread"),m=n?.closest(".feedback-viewport");if(!n||!m)return;let L=m.getBoundingClientRect(),y=m.closest(".feedback-preview-scroll"),B=y?.getBoundingClientRect(),V=Math.max(L.left,B?.left??L.left),w=Math.min(L.right,B?B.left+y.clientWidth:L.right),N=Math.min(L.bottom,B?B.top+y.clientHeight:L.bottom),R=n.getBoundingClientRect();for(let[_,C]of[["x",Math.max(V+8-R.left,Math.min(d,w-8-R.right))],["y",Math.max(L.top+8-R.top,Math.min(c,N-8-R.bottom))]]){let k=`--comment-drag-${_}`;n.style.setProperty(k,`${(parseFloat(n.style.getPropertyValue(k))||0)+C}px`)}}return Xo("button",{type:"button",className:"comment-window-drag","aria-label":"Move comment window",title:"Drag to move \xB7 Arrow keys to nudge",onPointerDown:l=>{!l.isPrimary||l.button!==0||(l.preventDefault(),a?.(),l.currentTarget.closest(".comment-box,.comment-thread")?.getAnimations().forEach(d=>d.cancel()),l.currentTarget.setPointerCapture(l.pointerId),t.current={id:l.pointerId,x:l.clientX,y:l.clientY},l.currentTarget.dataset.dragging="true")},onPointerMove:l=>{let d=t.current;!d||d.id!==l.pointerId||(r(l.currentTarget,l.clientX-d.x,l.clientY-d.y),d.x=l.clientX,d.y=l.clientY)},onPointerUp:l=>{l.currentTarget.hasPointerCapture(l.pointerId)&&l.currentTarget.releasePointerCapture(l.pointerId)},onLostPointerCapture:l=>{t.current=null,delete l.currentTarget.dataset.dragging},onKeyDown:l=>{let d={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[l.key];if(!d)return;l.preventDefault(),l.stopPropagation(),a?.();let c=l.shiftKey?40:10;r(l.currentTarget,d[0]*c,d[1]*c)},children:Xo(Ga,{size:16,"aria-hidden":"true"})})}function $o(a,t,r,l){let d={[a]:t},c=r.find(n=>n!==a);if(!c||!r.includes(a))return d;if(r.includes("width")){let n=parseFloat(l.width)/parseFloat(l.height),m=parseFloat(t);if(!Number.isFinite(n)||n<=0||!Number.isFinite(m))return d;d[c]=`${a==="width"?m/n:m*n}px`}else d[c]=t;return d}var Ko=new Set(["color","background-color","opacity","font-family","font-size","font-weight","border-color","border-width","width","height",...["padding","margin"].flatMap(a=>["top","right","bottom","left"].map(t=>`${a}-${t}`))]);function Zo(a,t){let r={...a},l={...a};for(let d of Array.isArray(t)?t:[])!d||!Object.prototype.hasOwnProperty.call(a,d.property)||typeof d.before!="string"||typeof d.after!="string"||d.property!=="text"&&(!Ko.has(d.property)||!CSS.supports(d.property,d.after))||(r[d.property]=d.before,l[d.property]=d.after);return{initial:r,values:l}}function vt(a,t){if(!Array.isArray(t))return()=>{};let r=a.style,l=a.getAttribute("style"),d=a.textContent,c=!1;for(let m of t)!m||typeof m.after!="string"||(m.property==="text"&&!a.children.length?(a.textContent=m.after,c=!0):r&&Ko.has(m.property)&&CSS.supports(m.property,m.after)&&r.setProperty(m.property,m.after,"important"));let n=!1;return()=>{n||(n=!0,l===null?a.removeAttribute("style"):a.setAttribute("style",l),c&&!a.children.length&&(a.textContent=d))}}import{Fragment as gl,jsx as O,jsxs as ie}from"react/jsx-runtime";var Jo=[["Text color","color","color"],["Background","background-color","color"],["Opacity","opacity","number"],["Font","font-family","font"],["Font size","font-size","number"],["Font weight","font-weight","weight"],["Border color","border-color","color"],["Border width","border-width","number"]],hl=["top","bottom","left","right"],_o=[{label:"Size",pairs:[["width","height"]]},...["padding","margin"].map(a=>({label:a[0].toUpperCase()+a.slice(1),pairs:[[`${a}-top`,`${a}-bottom`],[`${a}-left`,`${a}-right`]]}))];function xl(a){let t=a.ownerDocument.defaultView.getComputedStyle(a);return Object.fromEntries([["text",a.children.length?"":a.textContent??""],...["width","height"].map(r=>[r,t.getPropertyValue(r)]),...Jo.map(([,r])=>[r,t.getPropertyValue(r)]),...["padding","margin"].flatMap(r=>hl.map(l=>[`${r}-${l}`,t.getPropertyValue(`${r}-${l}`)]))])}function Qt({target:a,text:t,onText:r,onCancel:l,onPost:d,style:c,changes:n=[],editing:m=!1,commentId:L,renderComposer:y,hasExistingAttachments:B=!1,onDraftChange:V,hidden:w=!1,draftKey:N,onDiscard:R}){let[_]=$e(()=>Zo(a?xl(a):{},n)),C=_.initial,[k,K]=$e(_.values),[J]=$e(()=>({style:a?.getAttribute("style")??null,text:a?.textContent??null})),[ae,h]=$e({}),[b,X]=$e(!1),[ne]=$e(t),[I,H]=$e(!1),[pe,me]=$e(""),[Se,Da]=$e(!1),Aa=ml();function tt(){a&&(J.style===null?a.removeAttribute("style"):a.setAttribute("style",J.style),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(J.text??"")))}async function ga(A=!0){A&&R&&!await R()||(tt(),l())}jo(()=>(a&&vt(a,n),tt),[a,J]);function Ie(A,he){if(!a)return;if(A==="text"){K(T=>({...T,text:he})),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(he));return}let de=_o.flatMap(T=>T.pairs).find(T=>T.includes(A)&&ae[T.join(":")]),ye=de?$o(A,he,de,C):{[A]:he};K(T=>({...T,...ye}));for(let[T,E]of Object.entries(ye))CSS.supports(T,E)&&a.style.setProperty(T,E,"important")}let Z=Object.entries(k).some(([A,he])=>he!==C[A]),Ma=!!(t.trim()||Z||I||m&&t!==ne);jo(()=>(V?.(Ma),()=>V?.(!1)),[Ma,V]);async function ot(A=t,he,de,ye){if(b||!A.trim()&&!de?.length&&!B)return!1;let T=Object.entries(k).filter(([E,W])=>W!==C[E]).map(([E,W])=>({property:E,before:C[E],after:W}));if(T.some(E=>E.property!=="text"&&!CSS.supports(E.property,E.after)))return me("Check the style values before posting."),!1;X(!0),me("");try{let E=await d(T,A.trimEnd(),he,de,ye);return E?await ga(!1):me("Could not post. Your changes are still here; please try again."),E}catch{return me("Could not post. Please try again."),!1}finally{X(!1)}}let rt=(A,he=!1,de=!1,ye)=>ie(gl,{children:[ie("div",{className:"comment-box-prompt",children:[a&&O("button",{type:"button",className:"comment-box-symbol","aria-label":"Comment settings",title:"Comment settings","aria-expanded":Se,"aria-controls":Aa,disabled:b,onClick:()=>Da(T=>!T),children:O(ha,{})}),A]}),a&&ie("div",{className:"comment-box-settings",id:Aa,hidden:!Se,children:[ie("div",{className:"comment-box-element",children:[ie("code",{children:["<",a.tagName.toLowerCase(),">"]}),Z&&O("span",{className:"comment-box-preview-status",role:"status",children:"Unsaved preview"}),O(Ja,{})]}),ie("fieldset",{className:"comment-box-properties",disabled:b||!Se,children:[ie("label",{className:"comment-box-row",children:[O("span",{children:"Text"}),O("input",{"aria-label":"Element text",value:k.text,disabled:!!a.children.length,title:a.children.length?"Select a text-only element to change its text":void 0,onChange:T=>Ie("text",T.target.value)})]}),["Typography","Appearance"].map(T=>ie("div",{className:"comment-box-control-group",children:[O("h3",{children:T}),Jo.filter(([,E])=>T==="Typography"===["color","font-family","font-size","font-weight"].includes(E)).map(([E,W,be])=>ie("div",{className:"comment-box-row",children:[O("span",{children:E}),be==="color"?Se&&O(Yt,{label:E,value:k[W],disabled:b,onChange:q=>Ie(W,q)}):be==="font"?O("select",{"aria-label":E,value:k[W],onChange:q=>Ie(W,q.target.value),children:Array.from(new Set([C[W],"Arial, sans-serif","Georgia, serif","system-ui","monospace"])).map(q=>O("option",{value:q,children:q},q))}):be==="weight"?O("select",{"aria-label":E,value:k[W],onChange:q=>Ie(W,q.target.value),children:Array.from(new Set([C[W],...[100,200,300,400,500,600,700,800,900].map(String)])).map(q=>O("option",{children:q},q))}):ie("div",{className:"comment-box-number",children:[O("input",{type:"number","aria-label":E,value:Number.isFinite(parseFloat(k[W]))?parseFloat(k[W]):"",min:0,max:W==="opacity"?1:void 0,step:"any",onChange:q=>Ie(W,q.target.value+(W==="opacity"?"":"px"))}),W!=="opacity"&&O("span",{children:"px"})]})]},W))]},T)),_o.map(T=>ie("details",{className:"comment-box-group",open:!0,children:[ie("summary",{children:[T.label,O(ea,{size:12,"aria-hidden":"true"})]}),T.pairs.map(E=>{let W=E.join(":"),be=T.label==="Size"?"Lock aspect ratio":`Link ${T.label.toLowerCase()} ${E[0].split("-")[1]} and ${E[1].split("-")[1]}`;return ie("div",{className:"comment-box-pair",children:[O("button",{className:"comment-box-link",type:"button","aria-label":be,title:be,"aria-pressed":!!ae[W],onClick:()=>h(q=>({...q,[W]:!q[W]})),children:O(pa,{size:12})}),E.map(q=>{let Ee=q.includes("-")?q.split("-")[1]:q;return ie("label",{className:"comment-box-row",children:[O("span",{children:Ee[0].toUpperCase()+Ee.slice(1)}),ie("span",{className:"comment-box-number",children:[O("input",{type:"number",step:"any",min:q.startsWith("margin-")?void 0:0,"aria-label":q.replace("-"," ").replace(/^width$/,"Width").replace(/^height$/,"Height"),value:Number.isFinite(parseFloat(k[q]))?parseFloat(k[q]):"",onChange:Ht=>Ie(q,`${Ht.target.value}px`)}),O("span",{children:"px"})]})]},q)})]},W)})]},T.label))]})]}),pe&&O("p",{className:"comment-box-error",role:"alert",children:pe}),ie("footer",{className:"comment-box-footer",children:[O("button",{type:"button",className:"comment-box-cancel",onClick:()=>{ga()},disabled:b,children:"Cancel"}),O("span",{}),ye,O("button",{type:"submit",className:"comment-box-submit","aria-label":m?"Save comment":"Post comment",title:m?"Save comment":"Post comment",disabled:b||de||!t.trim()&&!he&&!B,children:b?O("span",{className:"comment-box-saving"}):O(fa,{})})]})]}),lt=`comment-box${y?" comment-box-native":""}`,dt=A=>{A.key==="Escape"&&!b&&(A.preventDefault(),A.stopPropagation(),ga())};return y?O("div",{className:lt,hidden:w,"data-settings-open":Se,style:c,onKeyDown:dt,children:y({draftKey:N,text:t,onText:r,disabled:b,commentId:L,onAttachmentDraftChange:H,onSubmit:ot,renderContent:rt})}):O("form",{className:lt,hidden:w,"data-settings-open":Se,style:c,"aria-label":m?"Edit comment":"New comment",onKeyDown:dt,onSubmit:A=>{A.preventDefault(),ot()},children:rt(O("input",{"aria-label":"Comment",placeholder:"Leave a comment\u2026",value:t,onChange:A=>r(A.target.value),autoFocus:!0,maxLength:4e3,required:!0,disabled:b}))})}import{useEffect as Ll,useLayoutEffect as Il,useRef as Dt,useState as At}from"react";function xa(a,t,r="/"){if(!a.trim())return null;try{let l=new URL(a.trim(),new URL(r,t)),d=decodeURIComponent(l.pathname);return!/^https?:$/.test(l.protocol)||l.origin!==t||l.username||l.password||/^\/(chisel|feedback)(\/|$)/.test(d)?null:l.pathname+l.search+l.hash}catch{return null}}function Pt(a){return a.split(/[?#]/,1)[0]}function eo(a){try{let{pathname:t,search:r,hash:l}=a.location;return t.startsWith("/")?t+r+l:null}catch{return null}}function Yo(a,t){let r;try{r=a.history}catch{return()=>{}}let l=r.pushState,d=r.replaceState,c=!0,n=()=>{let y=eo(a);c&&y!==null&&t(y)},m=function(...y){l.apply(this,y),n()},L=function(...y){d.apply(this,y),n()};return r.pushState=m,r.replaceState=L,a.addEventListener("popstate",n),a.addEventListener("hashchange",n),n(),()=>{c=!1,r.pushState===m&&(r.pushState=l),r.replaceState===L&&(r.replaceState=d),a.removeEventListener("popstate",n),a.removeEventListener("hashchange",n)}}import{Fragment as bl,jsx as Ae,jsxs as la}from"react/jsx-runtime";function ao({path:a,routes:t,disabled:r,onNavigate:l,onOpen:d,counts:c}){let n=Dt(null),m=Dt(null),L=Dt(null),y=Dt(!1),[B,V]=At(!1),[w,N]=At(""),[R,_]=At(!1),[C,k]=At(""),K=Pt(a),J=[...new Set([a,...t].map(Pt))],ae=w.trim();if(/^https?:\/\//i.test(ae))try{let I=new URL(ae);I.origin===window.location.origin&&(ae=I.pathname)}catch{}else ae=Pt(ae);let h=ae.toLocaleLowerCase(),b=J.filter(I=>I.toLocaleLowerCase().includes(h));function X(I=!1){n.current&&(n.current.open=!1),V(!1),I&&m.current?.focus({preventScroll:!0})}Il(()=>{if(!B)return;let I=()=>{let H=n.current,pe=H?.closest(".feedback-sidebar-panel");H&&pe&&H.style.setProperty("--feedback-page-space",`${Math.max(0,H.getBoundingClientRect().top-pe.getBoundingClientRect().top-12)}px`)};return I(),L.current?.focus(),L.current?.select(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[B]),Ll(()=>{if(!B)return;let I=me=>{!y.current&&!n.current?.contains(me.target)&&X()},H=me=>{me.key!=="Escape"||y.current||(me.preventDefault(),me.stopPropagation(),X(!0))},pe=()=>{y.current||X()};return document.addEventListener("pointerdown",I),document.addEventListener("keydown",H,!0),window.addEventListener("blur",pe),()=>{document.removeEventListener("pointerdown",I),document.removeEventListener("keydown",H,!0),window.removeEventListener("blur",pe)}},[B]);async function ne(I){if(!(r||y.current)){y.current=!0,_(!0),k("");try{await l(I)&&X(!0)}catch(H){k(H instanceof Error&&H.message?H.message:"This page could not be opened. Try again.")}finally{y.current=!1,_(!1)}}}return la("details",{ref:n,className:"feedback-page-control",onToggle:I=>V(I.currentTarget.open),children:[la("summary",{ref:m,"aria-label":`Current page: ${a}`,"aria-disabled":r||R,tabIndex:r||R?-1:0,onClick:I=>{I.preventDefault(),!(r||R||!n.current)&&(n.current.open?X():(N(""),k(""),d?.(),n.current.open=!0,V(!0)))},children:[Ae(Wa,{"aria-hidden":"true"}),Ae("span",{title:a,children:a}),Ae(ca,{className:"feedback-page-chevron","aria-hidden":"true"})]}),la("div",{className:"feedback-page-popover",children:[la("form",{className:"feedback-page-form",onSubmit:I=>{I.preventDefault(),ne(w)},children:[Ae("input",{ref:L,"aria-label":"Page URL or path",value:w,placeholder:"Enter a URL or path",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,disabled:r||R,onChange:I=>{N(I.target.value),k("")}}),Ae("button",{type:"submit","aria-label":"Go to page",title:"Go to page","aria-busy":R,disabled:r||R||!w.trim(),children:Ae(Oa,{"aria-hidden":"true"})})]}),C&&Ae("p",{className:"feedback-page-error",role:"alert",children:C}),la("nav",{className:"feedback-page-routes","aria-label":"Known pages",children:[b.map(I=>la("button",{type:"button",title:I,"aria-current":I===K?"page":void 0,disabled:r||R,onClick:()=>{I===K?X(!0):ne(I)},children:[Ae("span",{children:h?la(bl,{children:[I.slice(0,I.toLocaleLowerCase().indexOf(h)),Ae("mark",{children:I.slice(I.toLocaleLowerCase().indexOf(h),I.toLocaleLowerCase().indexOf(h)+ae.length)}),I.slice(I.toLocaleLowerCase().indexOf(h)+ae.length)]}):I}),c?.[I]&&la("small",{"aria-hidden":"true",children:[c[I].open," open",c[I].unread?` \xB7 ${c[I].unread} unread`:""]}),I===K&&Ae(fa,{"aria-hidden":"true"})]},I)),!b.length&&Ae("p",{className:"feedback-page-empty",children:"No matching pages"})]})]})]})}import{useEffect as er,useRef as to,useState as Cl}from"react";import{jsx as Ya,jsxs as Qo}from"react/jsx-runtime";function kl({request:a,finish:t,returnFocus:r}){let l=to(null);return er(()=>(l.current?.showModal(),()=>r?.focus({preventScroll:!0})),[]),Qo("dialog",{ref:l,className:"feedback-confirmation","aria-labelledby":"feedback-confirmation-title","aria-describedby":"feedback-confirmation-description",onCancel:d=>{d.preventDefault(),t(!1)},children:[Ya("h2",{id:"feedback-confirmation-title",children:a.title}),Ya("p",{id:"feedback-confirmation-description",children:a.description}),Qo("div",{children:[Ya("button",{type:"button",autoFocus:!0,onClick:()=>t(!1),children:"Cancel"}),Ya("button",{type:"button","data-danger":a.danger,onClick:()=>t(!0),children:a.action})]})]})}function ar(){let[a,t]=Cl(null),r=to(null),l=to(null);er(()=>()=>l.current?.(!1),[]);function d(n){l.current?.(n),l.current=null,t(null)}function c(n){return l.current?Promise.resolve(!1):(r.current=document.activeElement,t(n),new Promise(m=>{l.current=m}))}return{confirm:c,dialog:a&&Ya(kl,{request:a,finish:d,returnFocus:r.current})}}function tr(a){if(!(a.defaultPrevented||a.repeat||a.isComposing||a.ctrlKey||a.metaKey||a.altKey||a.composedPath().some(r=>{let l=r;return l.nodeType===1&&(l.isContentEditable||l.closest('input,textarea,select,[role="textbox"],[role="combobox"],[contenteditable]:not([contenteditable="false"])'))})))switch(a.key.toLowerCase()){case"c":return a.shiftKey?"toggle-comments":"comment";case"e":return"edit";case"v":return"view";case"d":return"desktop";case"t":return"tablet";case"m":return"mobile"}}function oo(a){return a<768?"mobile":a<1024?"tablet":"desktop"}var or={desktop:0,tablet:1,mobile:2};function Qa(a,t){return or[a??"desktop"]<=or[t]}function rr(a){let t,r=()=>clearTimeout(t);return{cancel:r,schedule(){r(),t=setTimeout(a,70)}}}function lr(a,t,r){let m=(C,k)=>Math.max(8,Math.min(C,k)),L=a.x+36+8,y=a.x+-4-8-t.width,B=r.width-t.width-8,V=Math.max(0,r.height-16);if(L<=B||y>=8)return{left:m(L<=B?L:y,B),top:m(a.y,r.height-Math.min(t.height,V)-8),maxHeight:V};let w=m(a.y+36+8,r.height-8),N=m(a.y+-4-8,r.height-8),R=r.height-w-8,_=N-8;return R>=_?{left:m(a.x+-4,B),top:w,maxHeight:R}:{left:m(a.x+-4,B),top:N-Math.min(t.height,_),maxHeight:_}}function ro(a,t,r){let l=null;try{l=a.selector?t?.querySelector(a.selector)??null:null}catch{}let d=l?.getBoundingClientRect(),c=a.relative;return d&&c&&d.width&&d.height?{left:d.left+d.width*c.x,top:d.top+d.height*c.y,width:d.width*c.width,height:d.height*c.height}:{left:a.x-r.x,top:a.y-r.y,width:a.width,height:a.height}}var Mt=new WeakMap;function Bt(a,t=!1,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||!a.animate)return r?.cancel(),null;let l=r?.playState==="running",d=window.getComputedStyle(a);if(a.dataset.expanded==="true"){let w={opacity:0,transform:"translateY(4px)"},N={opacity:1,transform:"translateY(0px)"},R=l?{opacity:d.opacity,transform:d.transform}:t?N:w;return r?.cancel(),a.animate([R,t?w:N],{duration:t?100:140,easing:"cubic-bezier(.4,0,.2,1)"})}let c=a.querySelector(".feedback-hover-preview"),n=Mt.get(a)??{width:a.offsetWidth,height:a.offsetHeight,content:c,contentWidth:c?.style.width??""},m={width:`${(Number(a.dataset.pinWidth)||40)-8}px`,height:"32px",opacity:0,transform:`translate(${Number(a.dataset.pinX)-a.offsetLeft}px, ${Number(a.dataset.pinY)-a.offsetTop}px)`,borderRadius:"16px 16px 16px 0px"},L={width:`${n.width}px`,height:`${n.height}px`,opacity:1,transform:"translate(0px, 0px)",borderRadius:d.borderRadius},y=l?{width:d.width,height:d.height,opacity:d.opacity,transform:d.transform,borderRadius:d.borderRadius}:t?L:m;c&&(c.style.width=`${n.width-(parseFloat(d.borderLeftWidth)||0)-(parseFloat(d.borderRightWidth)||0)}px`),r?.cancel();let B=a.animate([{...y,overflow:"hidden"},{...t?m:L,overflow:"hidden"}],{duration:t?120:140,easing:"cubic-bezier(.4,0,.2,1)",fill:t?"forwards":"none"});n.animation=B,Mt.set(a,n);let V=()=>{Mt.get(a)?.animation===B&&(n.content&&(n.content.style.width=n.contentWidth),Mt.delete(a))};return B.finished.then(()=>{t||V()},V),B}var dr=`:is(.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box,.chisel-project-directory) :focus{outline:none}.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{color-scheme:light;--chisel-ui-panel-shadow:0 4px 20px rgba(0,0,0,.08);--chisel-ui-canvas:#f7f7f7;--chisel-ui-surface:#ffffff;--chisel-ui-raised:#f5f5f5;--chisel-ui-inset:#eeeeee;--chisel-ui-hover:#f0f0f0;--chisel-ui-selected:#eaeaea;--chisel-ui-border:#e2e2e2;--chisel-ui-border-strong:#c4c4c4;--chisel-ui-text:#242424;--chisel-ui-secondary:#626262;--chisel-ui-muted:#686868;--chisel-ui-focus:#2468d3;--chisel-ui-accent-text:#2468d3;--chisel-ui-accent-surface:#edf4ff;--chisel-ui-action:#242424;--chisel-ui-action-text:#ffffff;--chisel-ui-danger:#b33737;--chisel-ui-avatar:#ededed;--chisel-ui-avatar-text:#565656;--chisel-ui-scrollbar:#c2c2c2;--chisel-ui-checker-light:#e5e5e5;--chisel-ui-checker-dark:#c7c7c7}@media(prefers-color-scheme:dark){.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{color-scheme:dark;--chisel-ui-panel-shadow:0 4px 20px #0003;--chisel-ui-canvas:#171717;--chisel-ui-surface:#222222;--chisel-ui-raised:#2a2a2a;--chisel-ui-inset:#191919;--chisel-ui-hover:#303030;--chisel-ui-selected:#383838;--chisel-ui-border:#3c3c3c;--chisel-ui-border-strong:#555555;--chisel-ui-text:#ededed;--chisel-ui-secondary:#b7b7b7;--chisel-ui-muted:#a5a5a5;--chisel-ui-focus:#8bb9ff;--chisel-ui-accent-text:#8bb9ff;--chisel-ui-accent-surface:#253447;--chisel-ui-action:#ededed;--chisel-ui-action-text:#111111;--chisel-ui-danger:#ffa5a5;--chisel-ui-avatar:#383838;--chisel-ui-avatar-text:#cccccc;--chisel-ui-scrollbar:#50504d;--chisel-ui-checker-light:#555555;--chisel-ui-checker-dark:#333333}}.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{--chisel-ui-font:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;--chisel-ui-space:4px;--chisel-ui-control:40px;--chisel-ui-radius:8px;--chisel-ui-text-size:13px;--chisel-ui-small:12px;--chisel-ui-motion:.12s cubic-bezier(.2,0,0,1);--chisel-ui-popover-shadow:0 2px 6px #0000000f,0 12px 36px #0000001f}@media(prefers-color-scheme:dark){.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{--chisel-ui-popover-shadow:0 0 0 1px #ffffff0d,0 4px 12px #0003,0 16px 40px #0004}}
2
- `;import{jsx as Sl}from"react/jsx-runtime";var wl=`.feedback-confirmation{width:360px;max-width:calc(100vw - 32px);padding:24px;border:0;border-radius:16px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);box-shadow:var(--chisel-ui-popover-shadow);font:14px var(--chisel-ui-font)}.feedback-confirmation::backdrop{background:#0005}.feedback-confirmation h2{margin:0 0 8px;font-size:16px;font-weight:600}.feedback-confirmation p{margin:0;color:var(--chisel-ui-secondary);line-height:1.6;text-wrap:pretty}.feedback-confirmation>div{display:flex;justify-content:flex-end;gap:8px;margin-top:24px}.feedback-confirmation button{min-height:40px;padding:0 16px;border:0;border-radius:8px;background:var(--chisel-ui-raised);color:var(--chisel-ui-text)}.feedback-confirmation button[data-danger=true]{background:var(--chisel-ui-danger);color:var(--chisel-ui-surface)}
3
- `+dr+`.feedback-shell,.feedback-shell *{box-sizing:border-box}.feedback-shell{font-synthesis:none;-webkit-font-smoothing:antialiased;position:fixed;inset:0;background:var(--chisel-ui-canvas);color:var(--chisel-ui-text);z-index:999999;font-family:var(--chisel-ui-font);font-size:13px;letter-spacing:0}.feedback-avatar{overflow:hidden}.feedback-account{position:relative}.feedback-account summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:40px;min-height:40px}.feedback-account summary::-webkit-details-marker{display:none}.feedback-account>div{position:absolute;right:0;top:44px;z-index:20;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);border:0;box-shadow:var(--chisel-ui-popover-shadow);border-radius:12px;padding:16px;min-width:220px;max-width:calc(100vw - 32px);display:flex;flex-direction:column;gap:8px;overflow-wrap:anywhere}.feedback-account[open]>div{transform-origin:top right;animation:chisel-account-in .16s cubic-bezier(.2,0,0,1)}@keyframes chisel-account-in{0%{opacity:0;transform:translateY(-4px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.feedback-account[open]>div{animation:none}}.feedback-account>div>span{color:var(--chisel-ui-muted);font-size:12px;line-height:1.5}.feedback-account button:hover{background:var(--chisel-ui-hover)}.feedback-account button{display:flex;align-items:center;gap:8px;color:var(--chisel-ui-text);background:transparent;border:0;min-height:40px;padding:8px;border-radius:8px}.chisel-sign-in{min-height:100dvh;display:grid;place-items:center;padding:24px;background:var(--chisel-ui-canvas);color:var(--chisel-ui-text);font-family:var(--chisel-ui-font)}.chisel-sign-in section{width:100%;max-width:360px;text-align:left}.chisel-sign-in-brand{font-size:24px;letter-spacing:-.8px}.chisel-sign-in h1{font-size:24px;font-weight:500;letter-spacing:-.4px;line-height:1.25;margin:32px 0 8px}.chisel-sign-in p{font-size:14px;line-height:1.6;color:var(--chisel-ui-secondary);margin:12px 0 24px}.chisel-sign-in button{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:44px;padding:12px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text);border:0;border-radius:8px;cursor:pointer}.chisel-sign-in button:disabled{opacity:.5;cursor:not-allowed}.chisel-sign-in a{display:inline-flex;align-items:center;min-height:40px;margin-top:16px;font-size:13px;color:var(--chisel-ui-secondary)}.chisel-sign-in [role=alert]{color:var(--chisel-ui-danger)}.chisel-spin{animation:chisel-spin 1s linear infinite}@keyframes chisel-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.chisel-spin{animation:none}}.feedback-sidebar[hidden],.feedback-comment-layer[hidden]{display:none}.feedback-shell.comments-hidden .feedback-canvas,.feedback-shell.is-editing .feedback-canvas{height:100%;flex:1}.feedback-comment-area{position:absolute;pointer-events:none;z-index:1;border:2px solid var(--chisel-ui-focus);background:color-mix(in srgb,var(--chisel-ui-focus) 8%,transparent);border-radius:4px}.feedback-element-box{position:absolute;pointer-events:none;z-index:1;border:1px solid var(--chisel-ui-focus);background:color-mix(in srgb,var(--chisel-ui-focus) 4%,transparent);box-sizing:border-box}.feedback-element-box.is-selected{border-width:2px;background:color-mix(in srgb,var(--chisel-ui-focus) 6%,transparent)}.feedback-thread-popup{max-height:calc(100% - 16px);overflow:auto}.feedback-thread-popup[hidden]{display:none}.feedback-thread-message,.feedback-thread-replies{overflow-wrap:anywhere;line-height:1.6;margin:0}.feedback-thread-replies{max-height:140px;overflow:auto}.feedback-thread-actions{display:flex;justify-content:space-between;align-items:center;margin-top:8px;gap:8px}.feedback-thread-actions .feedback-resolve{margin:0;font-size:11px;padding:8px}.feedback-composer-heading>button{display:grid;place-items:center;width:24px;height:24px;border-radius:4px}.feedback-composer-heading>button:hover{background:var(--chisel-ui-raised)}.feedback-shell button,.feedback-shell input,.feedback-shell textarea{font:inherit}.feedback-shell button{cursor:pointer}.feedback-shell button:disabled{cursor:not-allowed}.feedback-shell :where(button,summary){-webkit-tap-highlight-color:transparent}.feedback-workspace{display:flex;height:100%}.feedback-canvas{position:relative;flex:1;min-width:0;padding:0;container-type:inline-size}.feedback-preview-scroll{height:100%;overflow:auto;padding:0 12px}.feedback-preview-frame{position:relative;height:100%;margin-inline:auto}.feedback-viewport{position:relative;width:100%;height:100%;overflow:hidden;background:#fff;border:0;border-radius:0}.feedback-viewport iframe{width:100%;height:100%;border:0;display:block}.feedback-preview-resize{position:absolute;top:0;bottom:0;width:12px;cursor:ew-resize;touch-action:none;user-select:none}.feedback-preview-resize[data-edge=left]{left:-12px}.feedback-preview-resize[data-edge=right]{right:-12px}.feedback-preview-resize:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;height:32px;border-radius:999px;background:var(--chisel-ui-muted);opacity:.35}.feedback-preview-resize:hover:after,.feedback-preview-resize:active:after{opacity:1}.feedback-pin{position:absolute;transform:translate(-4px,-4px);width:40px;height:40px;display:grid;place-items:center;padding:8px;border-radius:50% 50% 50% 0;background:transparent;color:var(--chisel-ui-text);border:0;box-sizing:border-box;z-index:2}.feedback-comment-layer[data-hover-preview=true] .feedback-pin:not(.selected){z-index:5}.feedback-pin:before{content:"";position:absolute;inset:4px;border:1px solid var(--chisel-ui-border);border-radius:inherit;background:var(--chisel-ui-surface);box-shadow:0 2px 7px #0002;z-index:-1}.feedback-pin .feedback-avatar{width:24px;height:24px;font-size:12px}.feedback-pin-group{display:flex;width:auto;border-radius:20px 20px 20px 0}.feedback-pin-group .feedback-avatar+.feedback-avatar{margin-left:-4px}.feedback-pin .feedback-avatar img{width:100%;height:100%;object-fit:cover}.feedback-pin .feedback-pin-more{font-size:9px;font-variant-numeric:tabular-nums}.feedback-toolbar{position:absolute;z-index:2;bottom:17px;left:24px;display:flex;padding:4px;gap:4px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);border:0;border-radius:999px;box-shadow:var(--chisel-ui-popover-shadow)}.feedback-toolbar button{border:1px solid transparent;background:transparent;color:var(--chisel-ui-muted);height:var(--chisel-ui-control);padding:0 16px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:999px;white-space:nowrap;transition:background-color var(--chisel-ui-motion),color var(--chisel-ui-motion),border-color var(--chisel-ui-motion)}.feedback-toolbar button:hover{background:var(--chisel-ui-raised);color:var(--chisel-ui-text)}.feedback-toolbar button[aria-pressed=true]{background:var(--chisel-ui-raised);color:var(--chisel-ui-text);border-color:transparent}.feedback-breakpoints{left:auto;right:24px}.feedback-breakpoints button{width:40px;padding:0}.feedback-breakpoints button{position:relative}.feedback-breakpoints sup{position:absolute;right:-2px;top:-3px;min-width:18px;padding:2px 4px;border-radius:999px;background:var(--chisel-ui-text);color:var(--chisel-ui-surface);font-size:11px;line-height:1.2;font-variant-numeric:tabular-nums}.feedback-thread-status{position:relative;display:inline-flex;align-items:center;min-width:0;min-height:40px;margin-right:auto}.feedback-status-value{display:inline-flex;align-items:center;gap:4px;max-width:100%;height:28px;padding:0 8px;border-radius:999px;background:var(--chisel-ui-raised);color:var(--chisel-ui-secondary);font-size:12px;line-height:1;white-space:nowrap;transition:background-color var(--chisel-ui-motion),color var(--chisel-ui-motion)}.feedback-status-value>span{min-width:0;overflow:hidden;text-overflow:ellipsis}.feedback-status-value svg{width:14px;height:14px;flex-shrink:0;stroke-width:1.75}.feedback-status-value>svg:last-child{width:12px}.feedback-thread-status[data-state=ready] .feedback-status-value{background:var(--chisel-ui-accent-surface);color:var(--chisel-ui-accent-text)}.feedback-thread-status select{position:absolute;inset:0;width:100%;height:100%;min-height:40px;opacity:0;cursor:pointer;font:inherit}.feedback-thread-status select:disabled{cursor:default}.feedback-thread-status:has(select:enabled):hover .feedback-status-value{background:var(--chisel-ui-hover)}.feedback-guide,.feedback-notice{padding:10px;margin:0 0 8px;background:var(--chisel-ui-raised);border-radius:12px;font-size:12px;line-height:1.5}.feedback-guide{padding:12px}.feedback-guide strong{font-size:13px;font-weight:600}.feedback-guide ul{list-style:none;padding:0;margin:10px 0;display:grid;gap:8px}.feedback-guide li{display:flex;align-items:center;gap:8px}.feedback-guide li svg{width:16px;height:16px;flex-shrink:0;color:var(--chisel-ui-muted);stroke-width:1.75}.feedback-guide p{margin:8px 0;color:var(--chisel-ui-muted);text-wrap:pretty}.feedback-guide button,.feedback-notice button,.feedback-export button{min-height:40px;background:none;border:0;color:var(--chisel-ui-text)}.feedback-guide button{width:100%;border-radius:8px;background:var(--chisel-ui-surface);font-weight:500;transition:background-color var(--chisel-ui-motion)}.feedback-guide button:hover{background:var(--chisel-ui-hover)}.feedback-notice{position:relative;padding-right:34px}.feedback-notice>button[aria-label]{position:absolute;right:0;top:0;width:32px}.feedback-export{flex-shrink:0;border-top:1px solid var(--chisel-ui-border);font-size:12px}.feedback-export>summary{display:flex;align-items:center;gap:8px;min-height:40px;padding:8px;cursor:pointer;list-style:none;color:var(--chisel-ui-secondary)}.feedback-export>summary::-webkit-details-marker{display:none}.feedback-export>summary:hover{color:var(--chisel-ui-text)}.feedback-export>summary>svg:last-child{margin-left:auto;transition:transform var(--chisel-ui-motion)}.feedback-export[open]>summary>svg:last-child{transform:rotate(90deg)}.feedback-export>div{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 8px 8px;color:var(--chisel-ui-muted);font-variant-numeric:tabular-nums}.feedback-export button{display:flex;align-items:center;gap:6px;padding:0 10px;border-radius:8px;background:var(--chisel-ui-raised)}.feedback-export button:disabled{opacity:.5}.feedback-shell .feedback-comment:has(.feedback-comment-select){position:relative;padding-left:40px}.feedback-shell .feedback-comment-select{position:absolute;left:0;top:8px;width:40px;height:40px;display:grid;place-items:center;cursor:pointer}.feedback-comment-select input{width:16px;height:16px;margin:0;accent-color:var(--chisel-ui-text)}@media(prefers-reduced-motion:reduce){.feedback-export>summary>svg:last-child{transition:none}}.feedback-account a{color:var(--chisel-ui-text);min-height:40px;display:inline-flex;align-items:center}.feedback-page-routes small{margin-left:auto;color:var(--chisel-ui-muted);font-size:12px}.chisel-project-directory{background:var(--chisel-ui-canvas);color:var(--chisel-ui-text);font:14px var(--chisel-ui-font);min-height:100dvh;padding:32px max(24px,calc((100vw - 840px)/2))}.chisel-project-directory header{display:flex;justify-content:space-between;gap:16px;align-items:center}.chisel-project-directory header>strong{flex-shrink:0}.chisel-project-directory header>span{min-width:0;overflow-wrap:anywhere;text-align:right}.chisel-project-directory h2{overflow-wrap:anywhere}.chisel-project-directory section{background:var(--chisel-ui-surface);border-radius:16px;padding:20px;margin-top:16px}.chisel-project-directory form,.chisel-project-directory label{display:flex;flex-direction:column;gap:8px;margin-top:12px}.chisel-project-directory input,.chisel-project-directory button{min-height:40px;padding:8px 12px;border:1px solid var(--chisel-ui-border);border-radius:8px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);font:inherit}.chisel-project-directory a{display:inline-flex;align-items:center;min-height:40px;color:var(--chisel-ui-accent-text)}.chisel-project-directory a:hover{text-decoration:underline;text-underline-offset:3px}.feedback-preview-width{display:flex;align-items:center;padding-right:8px;font-size:12px;font-variant-numeric:tabular-nums;color:var(--chisel-ui-muted);border-right:1px solid var(--chisel-ui-border)}.feedback-shell .feedback-preview-width input{width:52px;min-height:40px;padding:0 4px 0 8px;border:0;border-radius:999px;background:transparent;text-align:right;font-size:12px;font-variant-numeric:tabular-nums}@container (max-width:520px){.feedback-toolbar{left:16px;bottom:10px}.feedback-breakpoints{left:auto;right:16px}.feedback-toolbar button{width:40px;padding:0}.feedback-toolbar button span{display:none}}@container (max-width:400px){.feedback-toolbar:not(.feedback-breakpoints){bottom:66px}}@media(pointer:coarse){.feedback-shell .feedback-preview-width input,.feedback-guide button{min-height:44px}}.feedback-collaboration{display:flex;align-items:center;gap:8px;min-height:32px;margin-bottom:8px;color:var(--chisel-ui-muted);font-size:12px}.feedback-reviewers{display:flex;flex:1;min-width:0;overflow:hidden}.feedback-reviewers .feedback-avatar{width:24px;height:24px}.feedback-reviewers .feedback-avatar+.feedback-avatar{margin-left:-4px}.feedback-reviewers img{width:100%;height:100%;object-fit:cover}.feedback-unread-count,.feedback-unread-label{color:var(--chisel-ui-accent-text);font-size:12px;font-variant-numeric:tabular-nums}.feedback-unread-label{display:inline}@media(prefers-reduced-motion:reduce){.feedback-toolbar button,.feedback-comment{transition:none}}.feedback-shell button svg,.feedback-shell summary svg{width:16px;height:16px;stroke-width:1.75;flex-shrink:0}.feedback-primary,.feedback-resolve,.feedback-thread form button{display:inline-flex;align-items:center;justify-content:center;gap:6px}.feedback-sidebar{--feedback-panel-divider:var(--chisel-ui-border);--feedback-panel-shadow:var(--chisel-ui-panel-shadow);width:400px;flex-shrink:0;padding:0;background:transparent;color:var(--chisel-ui-text);border:0;display:flex;flex-direction:column;min-height:0;font-family:var(--chisel-ui-font);font-size:13px;letter-spacing:0;-webkit-font-smoothing:antialiased;color-scheme:inherit}.feedback-sidebar-panel{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden auto;overscroll-behavior:contain;padding:16px 20px 0;border:0;border-radius:0;background:var(--chisel-ui-surface)}.feedback-search{display:flex;align-items:center;gap:8px;min-height:40px;margin-bottom:8px;padding:0 8px;border-radius:8px;background:transparent;color:var(--chisel-ui-muted)}.feedback-search svg{flex-shrink:0}.feedback-shell .feedback-search input{min-width:0;min-height:40px;padding:0;border:0;background:transparent;font-size:13px}.feedback-search input::placeholder{color:var(--chisel-ui-muted)}.feedback-search:hover{background:var(--chisel-ui-raised)}.feedback-page-control{position:relative;flex-shrink:0;margin:8px 0}.feedback-page-control:last-child{margin-bottom:16px}.feedback-page-control+.feedback-review-invite{padding-top:0}.feedback-page-control>summary{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 8px;border-radius:8px;list-style:none;color:var(--chisel-ui-secondary);cursor:pointer}.feedback-page-control>summary::-webkit-details-marker{display:none}.feedback-page-control>summary:hover,.feedback-page-control[open]>summary{background:var(--chisel-ui-raised);color:var(--chisel-ui-text)}.feedback-page-control>summary[aria-disabled=true]{opacity:.5;cursor:default}.feedback-page-control>summary>span,.feedback-page-routes button>span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;font:12px/20px ui-monospace,SFMono-Regular,monospace}.feedback-page-chevron{transform:rotate(180deg);transition:transform var(--chisel-ui-motion)}.feedback-page-control[open] .feedback-page-chevron{transform:rotate(0)}.feedback-page-popover{position:absolute;bottom:calc(100% + 4px);left:0;right:0;z-index:30;display:flex;flex-direction:column;gap:6px;max-height:var(--feedback-page-space,320px);overflow:auto;padding:8px;border-radius:12px;background:var(--chisel-ui-surface);box-shadow:var(--chisel-ui-popover-shadow)}.feedback-page-form{display:flex;flex-shrink:0;align-items:center;gap:4px;border-radius:8px;background:var(--chisel-ui-raised)}.feedback-shell .feedback-page-form input{flex:1;min-width:0;min-height:40px;padding:0 10px;border:0;border-radius:8px;background:transparent;font-size:13px}.feedback-page-form button{display:grid;place-items:center;flex-shrink:0;width:40px;min-height:40px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text)}.feedback-page-routes{display:flex;flex-direction:column;gap:2px;min-height:0;max-height:min(240px,30dvh);overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--chisel-ui-scrollbar) transparent}.feedback-page-routes button{display:flex;align-items:center;gap:8px;width:100%;min-height:40px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-secondary)}.feedback-page-routes button[aria-current=page]{background:var(--chisel-ui-selected);color:var(--chisel-ui-text)}.feedback-page-routes mark{background:var(--chisel-ui-selected);color:var(--chisel-ui-text);border-radius:2px;font-weight:700}.feedback-page-empty{margin:0;padding:10px 8px;color:var(--chisel-ui-secondary);font-size:12px}.feedback-page-control button:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-page-control button:disabled{opacity:.5}.feedback-page-control button:active{transform:scale(.96)}.feedback-page-error{margin:0;padding:4px 8px;color:var(--chisel-ui-danger);font-size:12px;line-height:1.5;overflow-wrap:anywhere}@media(pointer:coarse){.feedback-page-control>summary,.feedback-page-control button,.feedback-shell .feedback-page-form input{min-height:44px}.feedback-page-form button{width:44px}}@media(prefers-reduced-motion:reduce){.feedback-page-chevron{transition:none}}.feedback-sidebar-title{min-height:40px;padding:0;margin-bottom:12px;border:0;display:flex;align-items:center;justify-content:space-between;gap:6px}.feedback-sidebar h1{font:600 15px/22px var(--chisel-ui-font);letter-spacing:-.01em;margin:0;color:var(--chisel-ui-text)}.feedback-sidebar h1 span{font:500 12px ui-monospace,SFMono-Regular,Menlo,monospace;font-variant-numeric:tabular-nums;margin-left:6px;color:var(--chisel-ui-muted)}.feedback-avatar{width:27px;height:27px;background:var(--chisel-ui-avatar);color:var(--chisel-ui-avatar-text);border:0;display:inline-flex;justify-content:center;align-items:center;border-radius:50%;font-size:11px;flex-shrink:0}.feedback-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));flex-shrink:0;gap:6px;margin:0 0 8px;padding:4px;border-radius:12px;background:var(--chisel-ui-raised)}.feedback-tabs button{position:relative;min-width:0;min-height:40px;background:transparent;border:0;border-radius:8px;color:var(--chisel-ui-secondary);padding:0 12px;font-size:13px;font-weight:500;transition:background-color var(--chisel-ui-motion),color var(--chisel-ui-motion),box-shadow var(--chisel-ui-motion)}.feedback-tabs button+button:before{content:"";position:absolute;left:-3.5px;top:50%;width:1px;height:16px;transform:translateY(-50%);background:var(--chisel-ui-border);pointer-events:none}.feedback-tabs button:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-tabs button[aria-pressed=true]{color:var(--chisel-ui-text);background:var(--chisel-ui-surface);box-shadow:0 1px 3px #0000000d,0 0 0 1px var(--chisel-ui-border)}@media(prefers-reduced-motion:reduce){.feedback-tabs button{transition:none}}.feedback-comment-list{flex:1;min-height:160px;overflow:auto;overscroll-behavior:contain;padding:0;scrollbar-width:thin;scrollbar-color:var(--chisel-ui-scrollbar) transparent}.feedback-comment{border:0;border-radius:8px;padding:16px 8px;margin-bottom:8px;background:transparent;transition:background-color var(--chisel-ui-motion)}.feedback-comment:hover,.feedback-comment.active{background:var(--chisel-ui-raised)}.feedback-comment-main{display:flex;flex-direction:column;align-items:stretch;gap:8px;border:0;background:none;text-align:left;width:100%;min-height:40px;padding:0;color:inherit}.feedback-comment-heading{display:flex;align-items:center;gap:10px}.feedback-comment-identity{flex:1;min-width:0}.feedback-comment-activity{display:flex;align-items:center;gap:8px;margin-left:38px;margin-top:4px}.feedback-comment-heading>.feedback-avatar{width:28px;height:28px}.feedback-comment-heading img{width:100%;height:100%;object-fit:cover}.feedback-comment-avatars{display:flex;gap:4px}.feedback-comment-avatars .feedback-avatar{width:20px;height:20px;font-size:10px}.feedback-comment-avatars img{width:100%;height:100%;object-fit:cover}.feedback-comment-unread-dot{width:8px;height:8px;flex-shrink:0;border-radius:50%;background:var(--chisel-ui-focus)}.feedback-comment-status{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--chisel-ui-muted);font-size:12px;line-height:1.5}.feedback-comment-meta{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;font-size:13px;line-height:1.5}.feedback-comment-meta strong{font-weight:500;overflow-wrap:anywhere}.feedback-comment-meta time{color:var(--chisel-ui-muted);font-size:12px;font-variant-numeric:tabular-nums}.feedback-comment-body{display:block;margin-left:38px;line-height:1.5;overflow-wrap:anywhere;color:var(--chisel-ui-text);font-size:14px;white-space:pre-wrap}.feedback-comment-reply-count{color:var(--chisel-ui-secondary);font-size:12px;line-height:1.5}.feedback-comment-path{font:inherit;color:inherit}.feedback-empty{padding:24px 8px;color:var(--chisel-ui-muted)}.feedback-empty>span{display:none}.feedback-empty h2{font:500 14px var(--chisel-ui-font);color:var(--chisel-ui-secondary);margin:0 0 6px}.feedback-empty p{font-size:13px;line-height:1.6;color:var(--chisel-ui-muted);margin:0}.feedback-review-invite{border:0;padding:16px 0;color:var(--chisel-ui-secondary)}.feedback-review-invite summary{display:flex;align-items:center;gap:8px;list-style:none;cursor:pointer;font-size:13px;padding:10px 8px;min-height:40px;border-radius:8px}.feedback-review-invite summary::-webkit-details-marker{display:none}.feedback-review-invite[open]>summary svg{transform:rotate(90deg)}.feedback-review-invite summary:hover{background:var(--chisel-ui-hover)}.feedback-review-invite form{display:flex;flex-direction:column;gap:10px;margin-top:10px}.feedback-review-invite .feedback-primary{width:100%;align-self:stretch}.feedback-review-invite input{min-height:40px}.feedback-review-invite button:not(.feedback-primary){min-height:40px;padding:8px 12px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-secondary)}.feedback-review-invite button:not(.feedback-primary):not(:disabled):hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-review-invite button:disabled{opacity:.45}.feedback-review-invite label{display:flex;flex-direction:column;gap:6px;font-size:11px}.feedback-review-invite p{font-size:12px;line-height:1.5;margin:0}.feedback-composer{position:absolute;z-index:3;width:288px;background:var(--chisel-ui-surface);padding:14px;border:0;border-radius:16px;box-shadow:var(--chisel-ui-popover-shadow);display:flex;flex-direction:column;gap:10px}.feedback-composer-heading{display:flex;align-items:center;justify-content:space-between;font-weight:700}.feedback-composer-heading button{border:0;background:none;font-size:21px}.feedback-shell input,.feedback-shell textarea{border:1px solid var(--chisel-ui-border);border-radius:4px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);padding:9px;width:100%;box-sizing:border-box}.feedback-shell textarea{resize:none;min-height:70px}.feedback-primary{min-height:40px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text);border:0;padding:0 12px;border-radius:8px;align-self:flex-end}.feedback-thread{margin-top:16px}.feedback-thread form button,.feedback-resolve{background:var(--chisel-ui-surface);border:1px solid var(--chisel-ui-border);border-radius:4px;padding:7px 10px;margin-top:8px}.feedback-resolve{color:var(--chisel-ui-text)}.feedback-reply{border-left:2px solid var(--chisel-ui-border);padding-left:10px}.feedback-error{color:var(--chisel-ui-danger);padding:0 8px;margin:0 0 16px;line-height:1.5;font-size:13px}.feedback-comment-list>p[role=status]{margin:0;padding:24px 8px;color:var(--chisel-ui-secondary);line-height:1.5;font-size:13px}@media(max-width:760px){.feedback-workspace{flex-direction:column}.feedback-canvas{height:48%;flex:none;padding:0}.feedback-sidebar{width:100%;height:auto;flex:1;padding:0}.feedback-sidebar-panel{border:0}.feedback-sidebar-title{min-height:44px}.feedback-tabs{margin-bottom:8px}.feedback-tabs button{min-height:44px;padding:0 8px}.feedback-empty{padding:12px}.feedback-empty>span{display:none}.feedback-toolbar{bottom:10px}.feedback-comment{padding:14px 8px}}.comment-box{position:absolute;z-index:4;display:flex;flex-direction:column;width:344px;max-width:calc(100% - 16px);height:auto;max-height:calc(100% - 16px);padding:0;overflow:hidden;border:0;border-radius:16px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);box-shadow:var(--chisel-ui-popover-shadow);font:12px var(--chisel-ui-font);color-scheme:inherit}.comment-box[data-settings-open=true]{height:440px}.comment-box-settings{display:flex;flex-direction:column;flex:1;min-height:0}.comment-box-settings[hidden],.comment-box[hidden],.comment-thread form[hidden]{display:none}.comment-box-draft-pin{pointer-events:none}.comment-box-prompt{display:flex;align-items:center;gap:9px;min-height:44px;padding:8px 12px;flex-shrink:0}.comment-box-symbol{position:relative;border:0;padding:0;display:grid;place-items:center;background:transparent;border-radius:8px;width:40px;height:40px;flex-shrink:0}.comment-box-symbol[aria-expanded=true]{background:var(--chisel-ui-selected)}.comment-box-symbol:hover{background:var(--chisel-ui-hover)}.comment-box-symbol svg{width:14px;height:14px;color:var(--chisel-ui-text)}.comment-box .comment-box-prompt input{border:0;border-radius:0;background:none;box-shadow:none;padding:0;color:var(--chisel-ui-text);font:13px var(--chisel-ui-font);outline:none;width:100%;min-width:0}.comment-box-prompt input::placeholder{color:var(--chisel-ui-muted)}.comment-box-element{display:flex;align-items:center;justify-content:space-between;background:var(--chisel-ui-raised);color:var(--chisel-ui-muted);min-height:28px;padding:0 15px;flex-shrink:0}.comment-box-element code{font:12px monospace}.comment-box-element svg{color:var(--chisel-ui-muted)}.comment-box,.comment-thread{translate:var(--comment-drag-x,0px) var(--comment-drag-y,0px)}.feedback-shell .comment-window-drag{display:grid;place-items:center;flex-shrink:0;width:40px;height:40px;padding:0;border:0;border-radius:var(--chisel-ui-radius);background:transparent;color:var(--chisel-ui-muted);cursor:grab;touch-action:none;user-select:none}.feedback-shell .comment-window-drag:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-shell .comment-window-drag[data-dragging=true]{cursor:grabbing}.comment-box-element .comment-window-drag{margin-left:auto;margin-right:-8px}.feedback-thread-header>.comment-window-drag{margin-right:0}.comment-box-preview-status{margin-left:auto;margin-right:8px;font:12px var(--chisel-ui-font);color:var(--chisel-ui-accent-text)}.comment-box-properties{flex:1;min-height:0;min-width:0;border:0;margin:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--chisel-ui-scrollbar) transparent;padding:4px 15px 9px;position:relative}.comment-box-row{min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:var(--chisel-ui-secondary)}.comment-box-row>span{white-space:nowrap}.comment-box .comment-box-row input,.comment-box select{border:0;background:var(--chisel-ui-raised);color:var(--chisel-ui-secondary);border-radius:8px;min-width:0;width:128px;height:var(--chisel-ui-control);font:12px var(--chisel-ui-font);padding:4px 8px;text-overflow:ellipsis}.comment-box input:disabled{opacity:.35}.comment-box-number{display:flex;align-items:center;border:0;background:var(--chisel-ui-raised);border-radius:8px;width:128px;flex-shrink:0;height:var(--chisel-ui-control);padding-right:8px;color:var(--chisel-ui-muted)}.comment-box .comment-box-number input{border:0;width:100%;height:40px;background:transparent;box-shadow:none}.comment-box-number input::-webkit-inner-spin-button,.comment-box-spacing input::-webkit-inner-spin-button{-webkit-appearance:none}.comment-box-number>span{font:11px monospace}.comment-box select{appearance:auto}.comment-box-color{display:flex;align-items:center;gap:8px;border:0;width:142px;height:var(--chisel-ui-control);border-radius:7px;padding:3px 4px;min-width:0}.comment-color-trigger{position:relative;display:grid;place-items:center;width:24px;height:24px;flex-shrink:0;padding:0;border:0;border-radius:4px;background:repeating-conic-gradient(var(--chisel-ui-checker-light) 0% 25%,var(--chisel-ui-checker-dark) 0% 50%) 50%/8px 8px}.comment-color-trigger:after{content:"";position:absolute;inset:-8px;border-radius:inherit}.comment-color-trigger>span{display:block;width:100%;height:100%;border-radius:inherit;box-shadow:inset 0 0 0 1px var(--chisel-ui-border)}@media(pointer:coarse){.comment-color-trigger:after{inset:-10px}}.comment-color-value{font:12px monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--chisel-ui-secondary)}.chisel-color-picker,.chisel-color-picker *{box-sizing:border-box}.chisel-color-picker{position:fixed;z-index:1000001;width:256px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow:auto;padding:16px;border:0;border-radius:16px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);font:12px var(--chisel-ui-font);box-shadow:var(--chisel-ui-popover-shadow);color-scheme:inherit}.chisel-color-plane{position:relative;height:160px;margin:0 0 14px;border-radius:10px;touch-action:none;cursor:crosshair;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent)}.chisel-color-thumb{position:absolute;width:19px;height:19px;border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;box-shadow:0 1px 5px #0004}.chisel-color-tools{display:flex;gap:12px;align-items:center;margin-bottom:14px}.chisel-color-hue{appearance:none;-webkit-appearance:none;flex:1;min-width:0;height:40px;border:12px solid transparent;background-clip:padding-box;border-radius:20px;margin:0;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.chisel-color-hue::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:20px;height:20px;border:2px solid #fff;border-radius:50%;background:var(--hue);box-shadow:0 1px 4px #0004}.chisel-color-hue::-moz-range-thumb{width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:var(--hue);box-shadow:0 1px 4px #0004}.chisel-color-tools button{display:grid;place-items:center;flex-shrink:0;width:44px;height:40px;padding:0;background:var(--chisel-ui-raised);border:0;border-radius:8px;color:var(--chisel-ui-text);cursor:pointer}.chisel-color-tools button:disabled{opacity:.35;cursor:not-allowed}.chisel-color-hex{display:flex;flex-direction:column;gap:8px;color:var(--chisel-ui-secondary);font-size:11px}.chisel-color-hex input{width:100%;height:40px;border:0;border-radius:8px;padding:7px 9px;background:var(--chisel-ui-raised);color:var(--chisel-ui-text);font:13px monospace}.chisel-color-hex input[aria-invalid=true]{outline:2px solid var(--chisel-ui-danger)}.chisel-color-error{display:block;color:var(--chisel-ui-danger);font-size:11px;margin-top:6px}.chisel-color-accessible{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);border:0}.comment-box-control-group{margin-top:20px}.comment-box-control-group h3{font:500 12px/18px var(--chisel-ui-font);margin:0 0 8px;color:var(--chisel-ui-text)}.comment-box-group{border:0;margin-top:20px;padding-top:0}.comment-box-group summary{list-style:none;display:flex;align-items:center;gap:6px;min-height:40px;color:var(--chisel-ui-secondary);cursor:pointer}.comment-box-group summary::-webkit-details-marker{display:none}.comment-box-group[open] summary svg{transform:rotate(90deg)}.comment-box-pair{position:relative;padding:2px 0}.comment-box-pair .comment-box-row{min-height:44px}.comment-box-link{position:absolute;left:42%;top:50%;transform:translate(-50%,-50%);border:0;background:var(--chisel-ui-surface);color:var(--chisel-ui-muted);border-radius:50%;width:40px;height:40px;display:grid;place-items:center;z-index:1}.comment-box-link:before{content:none}.comment-box-link svg{padding:0}.comment-box-link:hover{background:var(--chisel-ui-hover)}.comment-box-link[aria-pressed=true]{color:var(--chisel-ui-accent-text);background:var(--chisel-ui-accent-surface)}.comment-box-link[aria-pressed=true]:before{border-color:var(--chisel-ui-focus)}.comment-box-number{font-variant-numeric:tabular-nums}.comment-box .comment-box-number input::-webkit-inner-spin-button{-webkit-appearance:none}.comment-box-footer{height:56px;min-height:56px;display:flex;align-items:center;gap:8px;padding:8px;border:0}.comment-box-footer>span{flex:1}.comment-box-footer button{display:grid;place-items:center;border:0;background:none;color:var(--chisel-ui-text);height:40px;width:40px}.comment-box-footer .comment-box-cancel:hover{background:var(--chisel-ui-hover)}.comment-box-footer .comment-box-cancel{width:auto;padding:0 9px;font:13px var(--chisel-ui-font);border:0;border-radius:8px;background:transparent}.comment-box-footer .comment-box-submit{width:40px;border-radius:8px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.comment-box-footer .comment-box-submit:disabled{opacity:.4;cursor:not-allowed}.comment-box-error{margin:0;padding:0 12px 8px;flex-shrink:0;font-size:11px;line-height:1.5;color:var(--chisel-ui-danger)}.comment-box-saving{width:12px;height:12px;border:1px solid var(--chisel-ui-border-strong);border-top-color:transparent;border-radius:50%;animation:chisel-spin 1s linear infinite}.feedback-composer.comment-thread{width:400px;max-width:calc(100% - 16px);gap:0;border-radius:16px;background:var(--chisel-ui-surface);border-color:var(--chisel-ui-border);color:var(--chisel-ui-text);padding:0;box-shadow:var(--chisel-ui-popover-shadow);color-scheme:inherit;overflow:hidden auto;scrollbar-width:thin}.feedback-thread-header{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:56px;padding:8px 12px 4px 20px;border:0;flex-shrink:0}.comment-thread .feedback-thread-summary{width:100%;padding:16px}.comment-thread .feedback-thread-summary:empty{display:none}.comment-thread .feedback-thread-replies{width:100%;padding:0 16px}.comment-thread form{width:100%;padding:16px}.feedback-composer.comment-thread[data-expanded=false]{width:240px;max-width:calc(100% - 16px);border-radius:16px 16px 16px 0;overflow:hidden}.feedback-thread-content{display:flex;flex-direction:column;flex-shrink:0;width:100%}.feedback-thread-content[hidden]{display:none}.feedback-hover-preview{display:flex;align-items:flex-start;gap:10px;flex-shrink:0;width:100%;padding:12px;border:0;border-radius:inherit;background:transparent;color:var(--chisel-ui-text);text-align:left;font:12px/16px var(--chisel-ui-font)}.feedback-hover-preview>.feedback-avatar{width:24px;height:24px;font-size:12px}.feedback-hover-preview img{width:100%;height:100%;object-fit:cover}.feedback-hover-copy{flex:1;min-width:0}.feedback-hover-byline{display:flex;align-items:baseline;gap:4px;white-space:nowrap;overflow:hidden}.feedback-hover-byline strong{font-weight:500;overflow:hidden;text-overflow:ellipsis}.feedback-hover-byline time{color:var(--chisel-ui-muted);font-size:11px;flex-shrink:0}.feedback-hover-message{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.feedback-pin.selected:before{border-color:var(--chisel-ui-focus)}.comment-thread .feedback-thread-summary,.comment-thread .feedback-thread-replies,.comment-thread form{width:100%;flex-shrink:0}.comment-thread .feedback-preview{white-space:nowrap}.feedback-thread-summary{display:flex;align-items:flex-start;gap:8px;flex-shrink:0}.feedback-thread-summary,.feedback-thread-reply{position:relative}.feedback-message-edit{display:grid;place-items:center;width:40px;height:40px;flex-shrink:0;padding:0;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-secondary);opacity:0;transition:opacity .12s,background .12s}.feedback-thread-summary:hover .feedback-message-edit,.feedback-thread-reply:hover .feedback-message-edit,.feedback-message-edit:focus-visible{opacity:1}.feedback-message-edit:hover{background:var(--chisel-ui-hover)}@media(hover:none){.feedback-message-edit{opacity:1}}.feedback-thread-summary-button{display:flex;align-items:flex-start;gap:10px;flex:1;min-width:0;border:0;padding:0;text-align:left;background:transparent;color:inherit}.feedback-thread-summary-button>.feedback-avatar{width:26px;height:26px;flex-shrink:0;margin-top:1px;font-size:10px}.feedback-thread-summary-copy{display:flex;flex-direction:column;gap:4px;min-width:0;flex:1}.feedback-thread-byline{display:flex;align-items:baseline;gap:7px;min-width:0;flex-wrap:wrap}.feedback-thread-byline strong{font-size:13px;font-weight:600;line-height:1.4;overflow-wrap:anywhere}.feedback-thread-byline time{font-size:12px;color:var(--chisel-ui-muted);white-space:nowrap}.feedback-thread-summary .feedback-thread-message{font-size:14px;line-height:1.5;color:var(--chisel-ui-text);overflow-wrap:anywhere}.comment-thread[data-expanded=false] .feedback-thread-message{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.feedback-thread-reply-count{font-size:12px;line-height:1.4;color:var(--chisel-ui-muted)}.feedback-thread-close{display:grid;place-items:center;flex-shrink:0;width:24px;height:24px;border:0;border-radius:6px;background:none;color:var(--chisel-ui-muted);padding:4px}.feedback-thread-header-actions{display:flex;gap:4px;flex-shrink:0}.feedback-thread-header-actions .feedback-thread-close{position:relative;width:40px;height:40px}.feedback-thread-header-actions .feedback-thread-delete:hover{color:var(--chisel-ui-danger)}@container (max-width:400px){.feedback-thread-header{gap:4px;padding-inline:8px}.feedback-thread-header-actions{gap:0}}.feedback-thread-close:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-thread-reply{display:flex;align-items:flex-start;gap:10px;padding:16px 0;border:0}.feedback-thread-reply>.feedback-avatar{width:24px;height:24px;font-size:10px}.feedback-thread-reply>div{flex:1;min-width:0}.feedback-thread-reply strong{font-size:13px;font-weight:600}.feedback-thread-reply p{font-size:14px;line-height:1.5;margin:4px 0 0;color:var(--chisel-ui-secondary)}.comment-thread form{padding-top:16px;border:0}.feedback-shell .comment-thread textarea{background:var(--chisel-ui-raised);color:var(--chisel-ui-text);border:1px solid var(--chisel-ui-border);border-radius:9px;min-height:40px;max-height:min(240px,40dvh);padding:10px 12px;font-size:14px;line-height:1.5;resize:none;overflow-y:auto}.comment-thread .feedback-thread-actions{margin-top:6px}.comment-thread .feedback-primary{border-radius:50%;width:40px;height:40px;padding:0;font-size:0;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text);margin:0;transition:opacity .15s,transform .15s}.comment-thread .feedback-primary:disabled{opacity:.35;cursor:not-allowed}.comment-thread .feedback-primary:not(:disabled):active{transform:scale(.96)}.comment-thread .feedback-resolve{background:transparent;color:var(--chisel-ui-secondary);border:0;border-radius:6px;padding:6px;font-size:12px;min-height:40px}.comment-thread .feedback-resolve:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}@media(prefers-reduced-motion:reduce){.comment-thread .feedback-primary{transition:none}}@media(prefers-reduced-motion:reduce){.comment-box-saving{animation:none}}.comment-thread .feedback-preview{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;min-height:40px;margin-left:36px;padding:5px 9px;border:1px solid var(--chisel-ui-border);border-radius:6px;background:var(--chisel-ui-raised);color:var(--chisel-ui-secondary);font-size:11px}.comment-thread .feedback-preview[aria-pressed=true]{border-color:var(--chisel-ui-focus);background:var(--chisel-ui-accent-surface)}.comment-thread .feedback-preview:disabled{opacity:.5;cursor:not-allowed}.feedback-proposal-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px;padding:0 12px 8px}.comment-thread .feedback-proposal-actions .feedback-preview{margin:0;padding:0 8px;border:0;border-radius:8px;background:transparent;font-size:12px;min-height:40px}.comment-thread .feedback-proposal-actions .feedback-preview:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.comment-thread .feedback-proposal-actions .feedback-preview[aria-pressed=true]{background:var(--chisel-ui-accent-surface);color:var(--chisel-ui-accent-text)}@media(pointer:coarse){.feedback-toolbar button{height:44px}.feedback-tabs button,.feedback-account summary{min-width:44px}.feedback-review-invite summary{min-height:44px}.feedback-pin:after{content:"";position:absolute;inset:-2px;border-radius:inherit}.feedback-account summary,.feedback-review-invite button,.feedback-shell .feedback-primary,.feedback-thread-status,.feedback-thread-status select{min-height:44px}.feedback-shell .comment-window-drag,.feedback-thread-header-actions .feedback-thread-close{width:44px;height:44px}.comment-box-footer{height:60px;min-height:60px}.comment-box-footer button{height:44px;width:44px}.comment-box-footer .comment-box-submit{width:44px}}@media(forced-colors:active){.feedback-sidebar-panel,.comment-box,.feedback-composer.comment-thread,.feedback-confirmation,.feedback-account>div{border:1px solid CanvasText;box-shadow:none;background:Canvas;color:CanvasText}.feedback-shell button[aria-pressed=true]{outline:1px solid Highlight;outline-offset:-2px}.feedback-shell input,.feedback-shell textarea,.comment-box-number,.feedback-avatar{border:1px solid CanvasText}}
4
- `;function lo(){return Sl("style",{children:wl})}function sr(a){try{let t=new URL(a),r=/^\d+(?:\.\d+){3}$/.test(t.hostname)&&/^(0\.|10\.|127\.|169\.254\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(t.hostname);if(t.protocol!=="https:"||t.username||t.password||!t.hostname.includes(".")||r||/\.(localhost|local|internal)$/.test(t.hostname)||t.hostname.includes(":"))return null;let l=t.pathname.replace(/\/+$/,"");return t.pathname=l.endsWith("/chisel")?l:`${l}/chisel`,t.search="",t.hash="",t.toString()}catch{return null}}function so(a,t){let r=new URL(a);r.search="",r.hash="",r.searchParams.set("mode","comment"),r.searchParams.set("path",t.path),r.searchParams.set("thread",t.id),r.searchParams.set("breakpoint",t.breakpoint??"desktop");let l=t.context?.width??{desktop:1440,tablet:768,mobile:390}[t.breakpoint??"desktop"];return r.searchParams.set("width",String(l)),r.toString()}function ur(a,t){return["# Website feedback for Codex","Apply the requested changes in the source code. Preserve unrelated behavior. Verify each affected page and viewport.",...a.map((r,l)=>[`## ${l+1}. ${r.path} \xB7 ${r.breakpoint??"desktop"}`,`Thread: ${so(t,r)}`,`Status: ${r.status??(r.resolved?"resolved":"open")}`,r.context?`Viewport: ${r.context.width} \xD7 ${r.context.height}px
1
+ "use client";import{useEffect as le,useLayoutEffect as rt,useRef as O,useState as y}from"react";import{forwardRef as Nr,createElement as Wr}from"react";var Uo=a=>a?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Ho(a,t,r=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Uo(a),size:24,node:t,...r.length>0?{aliases:r}:{}}}var Eo=a=>{let t="",r=!1;for(let l of a){if(l==="-"||l==="_"||l<=" "){r=t.length>0;continue}t.length===0?t+=l.toLowerCase():t+=r?l.toUpperCase():l,r=!1}return t};var Oo=a=>{let t=Eo(a);return t.charAt(0).toUpperCase()+t.slice(1)};import{forwardRef as zr,createElement as Vo}from"react";var Wa=(...a)=>a.filter((t,r,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===r).join(" ").trim();var ta={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function ao(a){return a!=null}function zo(a,t={}){let r=t.attributeNames??{},l=S=>r[S]??S,d=a.size??a.width??ta.width,p=a.size??a.height??ta.height,n=a.aliases?.filter(S=>typeof S=="string"&&S.trim()!=="").map(S=>`lucide-${S}`)??[],m=[...a.name?[`lucide-${a.name}`]:[],...n],L=t.className?.split(" ").filter(Boolean)??[],v=t.includeDefaultClasses===!1?Wa(...L):Wa("lucide",...m,...L),M=t.absoluteStrokeWidth?Number(t.strokeWidth??ta["stroke-width"])*Number(a.size??a.width??ta.width)/Number(t.size??t.width??ta.width):t.strokeWidth??ta["stroke-width"];return["svg",{...Object.entries(ta).reduce((S,[z,B])=>(S[l(z)]=B,S),{}),..."color"in t&&t.color&&{[l("stroke")]:t.color},..."size"in t&&ao(t.size)&&{[l("width")]:t.size,[l("height")]:t.size},..."width"in t&&ao(t.width)&&{[l("width")]:t.width},..."height"in t&&ao(t.height)&&{[l("height")]:t.height},[l("stroke-width")]:M,...v&&{[l("class")]:v},[l("viewBox")]:`0 0 ${d} ${p}`,...t.hasA11yProp===!1?{[l("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},a.node.map(S=>{let[z,B,_]=S,w=t.nonScalingStroke?{[l("vector-effect")]:"non-scaling-stroke",...B}:B;return _?[z,w,_]:[z,w]})]}function No(a,t={}){return zo(a,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Wo=a=>{for(let t in a)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};import{createContext as Hr,useContext as Er,useMemo as _l,createElement as Jl}from"react";var Or=Hr({});var Go=()=>Er(Or);var Xo=zr(({color:a,size:t,width:r,height:l,strokeWidth:d,absoluteStrokeWidth:p,nonScalingStroke:n,className:m="",children:L,iconNode:v=[],icon:M={node:v,aliases:[],size:24},...G},S)=>{let{size:z=24,strokeWidth:B=2,absoluteStrokeWidth:_=!1,nonScalingStroke:w=!1,color:C="currentColor",className:V=""}=Go()??{},J=!!L||Wo(G),[ae,h,b=[]]=No(M,{color:a??C,width:r??t??z,height:l??t??z,strokeWidth:d??B,absoluteStrokeWidth:p??_,nonScalingStroke:n??w,className:Wa(V,m),hasA11yProp:J,attributes:G});return Vo(ae,{ref:S,...h},[...b.map(([X,ne])=>Vo(X,ne)),...Array.isArray(L)?L:[L]])});function g(a,t=[],r=[]){let l=typeof a=="string"?Ho(a,t,r):a,d=Nr(({className:p,...n},m)=>Wr(Xo,{ref:m,icon:l,className:p,...n}));return l.name&&(d.displayName=Oo(l.name)),d}var Gr={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]},Ga=g(Gr);var Vr={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]},Va=g(Vr);var Xr={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]},ha=g(Xr);var $r={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},xa=g($r);var Kr={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]},oa=g(Kr);var Zr={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]},ra=g(Zr);var jr={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]},Xa=g(jr);var _r={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]},va=g(_r);var Jr={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]},Pa=g(Jr);var Yr={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]},$a=g(Yr);var Qr={name:"grip-horizontal",size:24,node:[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]},Ka=g(Qr);var el={name:"link-2",size:24,node:[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]},ga=g(el);var al={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]},la=g(al);var tl={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]},Za=g(tl);var ol={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]},La=g(ol);var rl={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]},ja=g(rl);var ll={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]},Da=g(ll);var dl={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]},Aa=g(dl);var sl={name:"pipette",size:24,node:[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]]},_a=g(sl);var ul={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]},Ja=g(ul);var il={name:"sliders-horizontal",size:24,node:[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]},Ia=g(il);var nl={name:"smartphone",size:24,node:[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]},Ya=g(nl);var fl={name:"square-dashed",size:24,node:[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]],aliases:["box-select"]},da=g(fl);var cl={name:"tablet",size:24,node:[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]},Qa=g(cl);var pl={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]},sa=g(pl);var ml={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]},Ma=g(ml);import{useEffect as Yo,useId as Ll,useState as je}from"react";import{useEffect as hl,useRef as Ko,useState as Ba}from"react";import{createPortal as xl}from"react-dom";function $o(a,t,r,l=1){a/=255,t/=255,r/=255;let d=Math.max(a,t,r),p=Math.min(a,t,r),n=d-p;return{h:(n?d===a?((t-r)/n+6)%6:d===t?(r-a)/n+2:(a-t)/n+4:0)*60,s:d?n/d:0,v:d,a:l}}function At({h:a,s:t,v:r,a:l}){let d=p=>{let n=(p+a/60)%6;return Math.round(255*r*(1-t*Math.max(0,Math.min(n,4-n,1)))).toString(16).padStart(2,"0")};return`#${d(5)}${d(3)}${d(1)}${l<1?Math.round(l*255).toString(16).padStart(2,"0"):""}`}function Mt(a){if(typeof document<"u"){let t=document.createElement("canvas");t.width=t.height=1;let r=t.getContext("2d");if(r){r.fillStyle=a,r.fillRect(0,0,1,1);let[l,d,p,n]=r.getImageData(0,0,1,1).data;return $o(l,d,p,n/255)}}return $o(0,0,0)}import{jsx as Me,jsxs as et}from"react/jsx-runtime";function to({label:a,value:t,onChange:r,disabled:l}){let d=Ko(null),p=Ko(null),[n,m]=Ba(null),[L,v]=Ba({h:0,s:0,v:0,a:1}),[M,G]=Ba(""),[S,z]=Ba(!1),[B,_]=Ba(!1),[w,C]=Ba(!1);function V(){m(null)}hl(()=>{if(!n)return;let h=U=>{!p.current?.contains(U.target)&&!d.current?.contains(U.target)&&V()},b=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),V(),d.current?.focus())},X=d.current?.getBoundingClientRect(),ne=U=>{if(p.current?.contains(U.target))return;let xe=d.current?.getBoundingClientRect();(xe?.top!==X?.top||xe?.left!==X?.left)&&V()};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",b,!0),window.addEventListener("resize",V),document.addEventListener("scroll",ne,!0),p.current?.querySelector("input")?.focus({preventScroll:!0}),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",b,!0),window.removeEventListener("resize",V),document.removeEventListener("scroll",ne,!0)}},[n]);function J(h){h.a===0&&(h={...h,a:1}),v(h);let b=At(h);G(b.slice(1).toUpperCase()),z(!1),r(b)}function ae(h){let b=h.currentTarget.getBoundingClientRect();J({...L,s:Math.max(0,Math.min(1,(h.clientX-b.left)/b.width)),v:1-Math.max(0,Math.min(1,(h.clientY-b.top)/b.height))})}return et("div",{className:"comment-box-color",children:[Me("button",{ref:d,className:"comment-color-trigger",type:"button","aria-label":`${a} picker`,"aria-haspopup":"dialog","aria-expanded":!!n,disabled:l,onClick:()=>{if(n){V();return}let h=Mt(t);v(h),G(At(h).slice(1).toUpperCase()),z(!1),_("EyeDropper"in window);let b=d.current.getBoundingClientRect();m({left:Math.max(8,Math.min(b.right-256,window.innerWidth-264)),top:Math.max(8,Math.min(b.bottom+8,window.innerHeight-330))})},children:Me("span",{style:{background:t}})}),Me("span",{className:"comment-color-value",title:t,children:t}),n&&xl(et("div",{ref:p,className:"chisel-color-picker",role:"dialog","aria-label":`${a} color picker`,style:n,onKeyDown:h=>{if(h.key!=="Tab")return;let b=Array.from(p.current.querySelectorAll("button:not(:disabled), input:not(:disabled)"));h.shiftKey&&document.activeElement===b[0]?(h.preventDefault(),b[b.length-1]?.focus()):!h.shiftKey&&document.activeElement===b[b.length-1]&&(h.preventDefault(),b[0]?.focus())},children:[et("div",{className:"chisel-color-plane",style:{backgroundColor:`hsl(${L.h} 100% 50%)`},onPointerDown:h=>{h.currentTarget.setPointerCapture(h.pointerId),ae(h)},onPointerMove:h=>{h.currentTarget.hasPointerCapture(h.pointerId)&&ae(h)},children:[Me("span",{className:"chisel-color-thumb",style:{left:`${L.s*100}%`,top:`${(1-L.v)*100}%`,background:At({...L,a:1})}}),Me("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} saturation`,min:0,max:100,value:Math.round(L.s*100),onChange:h=>J({...L,s:Number(h.target.value)/100})}),Me("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} brightness`,min:0,max:100,value:Math.round(L.v*100),onChange:h=>J({...L,v:Number(h.target.value)/100})})]}),et("div",{className:"chisel-color-tools",children:[Me("input",{className:"chisel-color-hue",type:"range","aria-label":`${a} hue`,min:0,max:360,value:Math.round(L.h),style:{"--hue":`hsl(${L.h} 100% 50%)`},onChange:h=>J({...L,h:Number(h.target.value)})}),Me("button",{type:"button","aria-label":`Pick ${a.toLowerCase()} from screen`,title:B?"Pick a color from the screen":"Screen color picker is not supported in this browser",disabled:!B||w,onClick:async()=>{let h=window.EyeDropper;if(h){C(!0);try{let b=await new h().open();p.current&&J(Mt(b.sRGBHex))}catch{}finally{C(!1)}}},children:Me(_a,{size:18})})]}),et("label",{className:"chisel-color-hex",children:["HEX",Me("input",{"aria-label":`${a} hex`,value:M,maxLength:9,spellCheck:!1,"aria-invalid":S,onChange:h=>{let b=h.target.value.replace(/^#/,"");G(b);let X=/^(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(b);if(z(!X),X){let ne=Mt(`#${b}`);v(ne),r(`#${b}`)}}})]}),S&&Me("span",{className:"chisel-color-error",role:"status",children:"Enter a valid hex color."})]}),document.body)]})}import{useRef as gl}from"react";import{jsx as Zo}from"react/jsx-runtime";function at({onMoveStart:a}){let t=gl(null);function r(l,d,p){let n=l.closest(".comment-box,.comment-thread"),m=n?.closest(".feedback-viewport");if(!n||!m)return;let L=m.getBoundingClientRect(),v=m.closest(".feedback-preview-scroll"),M=v?.getBoundingClientRect(),G=Math.max(L.left,M?.left??L.left),S=Math.min(L.right,M?M.left+v.clientWidth:L.right),z=Math.min(L.bottom,M?M.top+v.clientHeight:L.bottom),B=n.getBoundingClientRect();for(let[_,w]of[["x",Math.max(G+8-B.left,Math.min(d,S-8-B.right))],["y",Math.max(L.top+8-B.top,Math.min(p,z-8-B.bottom))]]){let C=`--comment-drag-${_}`;n.style.setProperty(C,`${(parseFloat(n.style.getPropertyValue(C))||0)+w}px`)}}return Zo("button",{type:"button",className:"comment-window-drag","aria-label":"Move comment window",title:"Drag to move \xB7 Arrow keys to nudge",onPointerDown:l=>{!l.isPrimary||l.button!==0||(l.preventDefault(),a?.(),l.currentTarget.closest(".comment-box,.comment-thread")?.getAnimations().forEach(d=>d.cancel()),l.currentTarget.setPointerCapture(l.pointerId),t.current={id:l.pointerId,x:l.clientX,y:l.clientY},l.currentTarget.dataset.dragging="true")},onPointerMove:l=>{let d=t.current;!d||d.id!==l.pointerId||(r(l.currentTarget,l.clientX-d.x,l.clientY-d.y),d.x=l.clientX,d.y=l.clientY)},onPointerUp:l=>{l.currentTarget.hasPointerCapture(l.pointerId)&&l.currentTarget.releasePointerCapture(l.pointerId)},onLostPointerCapture:l=>{t.current=null,delete l.currentTarget.dataset.dragging},onKeyDown:l=>{let d={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]}[l.key];if(!d)return;l.preventDefault(),l.stopPropagation(),a?.();let p=l.shiftKey?40:10;r(l.currentTarget,d[0]*p,d[1]*p)},children:Zo(Ka,{size:16,"aria-hidden":"true"})})}function jo(a,t,r,l){let d={[a]:t},p=r.find(n=>n!==a);if(!p||!r.includes(a))return d;if(r.includes("width")){let n=parseFloat(l.width)/parseFloat(l.height),m=parseFloat(t);if(!Number.isFinite(n)||n<=0||!Number.isFinite(m))return d;d[p]=`${a==="width"?m/n:m*n}px`}else d[p]=t;return d}var _o=new Set(["color","background-color","opacity","font-family","font-size","font-weight","border-color","border-width","width","height",...["padding","margin"].flatMap(a=>["top","right","bottom","left"].map(t=>`${a}-${t}`))]);function Jo(a,t){let r={...a},l={...a};for(let d of Array.isArray(t)?t:[])!d||!Object.prototype.hasOwnProperty.call(a,d.property)||typeof d.before!="string"||typeof d.after!="string"||d.property!=="text"&&(!_o.has(d.property)||!CSS.supports(d.property,d.after))||(r[d.property]=d.before,l[d.property]=d.after);return{initial:r,values:l}}function Bt(a,t){if(!Array.isArray(t))return()=>{};let r=a.style,l=a.getAttribute("style"),d=a.textContent,p=!1;for(let m of t)!m||typeof m.after!="string"||(m.property==="text"&&!a.children.length?(a.textContent=m.after,p=!0):r&&_o.has(m.property)&&CSS.supports(m.property,m.after)&&r.setProperty(m.property,m.after,"important"));let n=!1;return()=>{n||(n=!0,l===null?a.removeAttribute("style"):a.setAttribute("style",l),p&&!a.children.length&&(a.textContent=d))}}import{Fragment as Cl,jsx as E,jsxs as ie}from"react/jsx-runtime";var er=[["Text color","color","color"],["Background","background-color","color"],["Opacity","opacity","number"],["Font","font-family","font"],["Font size","font-size","number"],["Font weight","font-weight","weight"],["Border color","border-color","color"],["Border width","border-width","number"]],Il=["top","bottom","left","right"],Qo=[{label:"Size",pairs:[["width","height"]]},...["padding","margin"].map(a=>({label:a[0].toUpperCase()+a.slice(1),pairs:[[`${a}-top`,`${a}-bottom`],[`${a}-left`,`${a}-right`]]}))];function bl(a){let t=a.ownerDocument.defaultView.getComputedStyle(a);return Object.fromEntries([["text",a.children.length?"":a.textContent??""],...["width","height"].map(r=>[r,t.getPropertyValue(r)]),...er.map(([,r])=>[r,t.getPropertyValue(r)]),...["padding","margin"].flatMap(r=>Il.map(l=>[`${r}-${l}`,t.getPropertyValue(`${r}-${l}`)]))])}function oo({target:a,text:t,onText:r,onCancel:l,onPost:d,style:p,changes:n=[],editing:m=!1,commentId:L,renderComposer:v,hasExistingAttachments:M=!1,onDraftChange:G,hidden:S=!1,draftKey:z,onDiscard:B}){let[_]=je(()=>Jo(a?bl(a):{},n)),w=_.initial,[C,V]=je(_.values),[J]=je(()=>({style:a?.getAttribute("style")??null,text:a?.textContent??null})),[ae,h]=je({}),[b,X]=je(!1),[ne]=je(t),[I,U]=je(!1),[xe,ge]=je(""),[Pe,Fa]=je(!1),Ta=Ll();function dt(){a&&(J.style===null?a.removeAttribute("style"):a.setAttribute("style",J.style),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(J.text??"")))}async function ka(A=!0){A&&B&&!await B()||(dt(),l())}Yo(()=>(a&&Bt(a,n),dt),[a,J]);function ke(A,Le){if(!a)return;if(A==="text"){V(T=>({...T,text:Le})),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(Le));return}let de=Qo.flatMap(T=>T.pairs).find(T=>T.includes(A)&&ae[T.join(":")]),De=de?jo(A,Le,de,w):{[A]:Le};V(T=>({...T,...De}));for(let[T,H]of Object.entries(De))CSS.supports(T,H)&&a.style.setProperty(T,H,"important")}let j=Object.entries(C).some(([A,Le])=>Le!==w[A]),qa=!!(t.trim()||j||I||m&&t!==ne);Yo(()=>(G?.(qa),()=>G?.(!1)),[qa,G]);async function st(A=t,Le,de,De){if(b||!A.trim()&&!de?.length&&!M)return!1;let T=Object.entries(C).filter(([H,N])=>N!==w[H]).map(([H,N])=>({property:H,before:w[H],after:N}));if(T.some(H=>H.property!=="text"&&!CSS.supports(H.property,H.after)))return ge("Check the style values before posting."),!1;X(!0),ge("");try{let H=await d(T,A.trimEnd(),Le,de,De);return H?await ka(!1):ge("Could not post. Your changes are still here; please try again."),H}catch{return ge("Could not post. Please try again."),!1}finally{X(!1)}}let ut=(A,Le=!1,de=!1,De)=>ie(Cl,{children:[ie("div",{className:"comment-box-prompt",children:[a&&E("button",{type:"button",className:"comment-box-symbol","aria-label":"Comment settings",title:"Comment settings","aria-expanded":Pe,"aria-controls":Ta,disabled:b,onClick:()=>Fa(T=>!T),children:E(Ia,{})}),A]}),a&&ie("div",{className:"comment-box-settings",id:Ta,hidden:!Pe,children:[ie("div",{className:"comment-box-element",children:[ie("code",{children:["<",a.tagName.toLowerCase(),">"]}),j&&E("span",{className:"comment-box-preview-status",role:"status",children:"Unsaved preview"}),E(at,{})]}),ie("fieldset",{className:"comment-box-properties",disabled:b||!Pe,children:[ie("label",{className:"comment-box-row",children:[E("span",{children:"Text"}),E("input",{"aria-label":"Element text",value:C.text,disabled:!!a.children.length,title:a.children.length?"Select a text-only element to change its text":void 0,onChange:T=>ke("text",T.target.value)})]}),["Typography","Appearance"].map(T=>ie("div",{className:"comment-box-control-group",children:[E("h3",{children:T}),er.filter(([,H])=>T==="Typography"===["color","font-family","font-size","font-weight"].includes(H)).map(([H,N,we])=>ie("div",{className:"comment-box-row",children:[E("span",{children:H}),we==="color"?Pe&&E(to,{label:H,value:C[N],disabled:b,onChange:q=>ke(N,q)}):we==="font"?E("select",{"aria-label":H,value:C[N],onChange:q=>ke(N,q.target.value),children:Array.from(new Set([w[N],"Arial, sans-serif","Georgia, serif","system-ui","monospace"])).map(q=>E("option",{value:q,children:q},q))}):we==="weight"?E("select",{"aria-label":H,value:C[N],onChange:q=>ke(N,q.target.value),children:Array.from(new Set([w[N],...[100,200,300,400,500,600,700,800,900].map(String)])).map(q=>E("option",{children:q},q))}):ie("div",{className:"comment-box-number",children:[E("input",{type:"number","aria-label":H,value:Number.isFinite(parseFloat(C[N]))?parseFloat(C[N]):"",min:0,max:N==="opacity"?1:void 0,step:"any",onChange:q=>ke(N,q.target.value+(N==="opacity"?"":"px"))}),N!=="opacity"&&E("span",{children:"px"})]})]},N))]},T)),Qo.map(T=>ie("details",{className:"comment-box-group",open:!0,children:[ie("summary",{children:[T.label,E(oa,{size:12,"aria-hidden":"true"})]}),T.pairs.map(H=>{let N=H.join(":"),we=T.label==="Size"?"Lock aspect ratio":`Link ${T.label.toLowerCase()} ${H[0].split("-")[1]} and ${H[1].split("-")[1]}`;return ie("div",{className:"comment-box-pair",children:[E("button",{className:"comment-box-link",type:"button","aria-label":we,title:we,"aria-pressed":!!ae[N],onClick:()=>h(q=>({...q,[N]:!q[N]})),children:E(ga,{size:12})}),H.map(q=>{let Ne=q.includes("-")?q.split("-")[1]:q;return ie("label",{className:"comment-box-row",children:[E("span",{children:Ne[0].toUpperCase()+Ne.slice(1)}),ie("span",{className:"comment-box-number",children:[E("input",{type:"number",step:"any",min:q.startsWith("margin-")?void 0:0,"aria-label":q.replace("-"," ").replace(/^width$/,"Width").replace(/^height$/,"Height"),value:Number.isFinite(parseFloat(C[q]))?parseFloat(C[q]):"",onChange:Wt=>ke(q,`${Wt.target.value}px`)}),E("span",{children:"px"})]})]},q)})]},N)})]},T.label))]})]}),xe&&E("p",{className:"comment-box-error",role:"alert",children:xe}),ie("footer",{className:"comment-box-footer",children:[E("button",{type:"button",className:"comment-box-cancel",onClick:()=>{ka()},disabled:b,children:"Cancel"}),E("span",{}),De,E("button",{type:"submit",className:"comment-box-submit","aria-label":m?"Save comment":"Post comment",title:m?"Save comment":"Post comment",disabled:b||de||!t.trim()&&!Le&&!M,children:b?E("span",{className:"comment-box-saving"}):E(ha,{})})]})]}),it=`comment-box${v?" comment-box-native":""}`,nt=A=>{A.key==="Escape"&&!b&&(A.preventDefault(),A.stopPropagation(),ka())};return v?E("div",{className:it,hidden:S,"data-settings-open":Pe,style:p,onKeyDown:nt,children:v({draftKey:z,text:t,onText:r,disabled:b,commentId:L,onAttachmentDraftChange:U,onSubmit:st,renderContent:ut})}):E("form",{className:it,hidden:S,"data-settings-open":Pe,style:p,"aria-label":m?"Edit comment":"New comment",onKeyDown:nt,onSubmit:A=>{A.preventDefault(),st()},children:ut(E("input",{"aria-label":"Comment",placeholder:"Leave a comment\u2026",value:t,onChange:A=>r(A.target.value),autoFocus:!0,maxLength:4e3,required:!0,disabled:b}))})}import{useEffect as kl,useLayoutEffect as wl,useRef as Ft,useState as Tt}from"react";function ba(a,t,r="/"){if(!a.trim())return null;try{let l=new URL(a.trim(),new URL(r,t)),d=decodeURIComponent(l.pathname);return!/^https?:$/.test(l.protocol)||l.origin!==t||l.username||l.password||/^\/(chisel|feedback)(\/|$)/.test(d)?null:l.pathname+l.search+l.hash}catch{return null}}function Rt(a){return a.split(/[?#]/,1)[0]}function ro(a){try{let{pathname:t,search:r,hash:l}=a.location;return t.startsWith("/")?t+r+l:null}catch{return null}}function ar(a,t){let r;try{r=a.history}catch{return()=>{}}let l=r.pushState,d=r.replaceState,p=!0,n=()=>{let v=ro(a);p&&v!==null&&t(v)},m=function(...v){l.apply(this,v),n()},L=function(...v){d.apply(this,v),n()};return r.pushState=m,r.replaceState=L,a.addEventListener("popstate",n),a.addEventListener("hashchange",n),n(),()=>{p=!1,r.pushState===m&&(r.pushState=l),r.replaceState===L&&(r.replaceState=d),a.removeEventListener("popstate",n),a.removeEventListener("hashchange",n)}}import{Fragment as Sl,jsx as Be,jsxs as ua}from"react/jsx-runtime";function lo({path:a,routes:t,disabled:r,onNavigate:l,onOpen:d,counts:p}){let n=Ft(null),m=Ft(null),L=Ft(null),v=Ft(!1),[M,G]=Tt(!1),[S,z]=Tt(""),[B,_]=Tt(!1),[w,C]=Tt(""),V=Rt(a),J=[...new Set([a,...t].map(Rt))],ae=S.trim();if(/^https?:\/\//i.test(ae))try{let I=new URL(ae);I.origin===window.location.origin&&(ae=I.pathname)}catch{}else ae=Rt(ae);let h=ae.toLocaleLowerCase(),b=J.filter(I=>I.toLocaleLowerCase().includes(h));function X(I=!1){n.current&&(n.current.open=!1),G(!1),I&&m.current?.focus({preventScroll:!0})}wl(()=>{if(!M)return;let I=()=>{let U=n.current,xe=U?.closest(".feedback-sidebar-panel");U&&xe&&U.style.setProperty("--feedback-page-space",`${Math.max(0,U.getBoundingClientRect().top-xe.getBoundingClientRect().top-12)}px`)};return I(),L.current?.focus(),L.current?.select(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[M]),kl(()=>{if(!M)return;let I=ge=>{!v.current&&!n.current?.contains(ge.target)&&X()},U=ge=>{ge.key!=="Escape"||v.current||(ge.preventDefault(),ge.stopPropagation(),X(!0))},xe=()=>{v.current||X()};return document.addEventListener("pointerdown",I),document.addEventListener("keydown",U,!0),window.addEventListener("blur",xe),()=>{document.removeEventListener("pointerdown",I),document.removeEventListener("keydown",U,!0),window.removeEventListener("blur",xe)}},[M]);async function ne(I){if(!(r||v.current)){v.current=!0,_(!0),C("");try{await l(I)&&X(!0)}catch(U){C(U instanceof Error&&U.message?U.message:"This page could not be opened. Try again.")}finally{v.current=!1,_(!1)}}}return ua("details",{ref:n,className:"feedback-page-control",onToggle:I=>G(I.currentTarget.open),children:[ua("summary",{ref:m,"aria-label":`Current page: ${a}`,"aria-disabled":r||B,tabIndex:r||B?-1:0,onClick:I=>{I.preventDefault(),!(r||B||!n.current)&&(n.current.open?X():(z(""),C(""),d?.(),n.current.open=!0,G(!0)))},children:[Be($a,{"aria-hidden":"true"}),Be("span",{title:a,children:a}),Be(xa,{className:"feedback-page-chevron","aria-hidden":"true"})]}),ua("div",{className:"feedback-page-popover",children:[ua("form",{className:"feedback-page-form",onSubmit:I=>{I.preventDefault(),ne(S)},children:[Be("input",{ref:L,"aria-label":"Page URL or path",value:S,placeholder:"Enter a URL or path",autoComplete:"off",autoCapitalize:"off",spellCheck:!1,disabled:r||B,onChange:I=>{z(I.target.value),C("")}}),Be("button",{type:"submit","aria-label":"Go to page",title:"Go to page","aria-busy":B,disabled:r||B||!S.trim(),children:Be(Ga,{"aria-hidden":"true"})})]}),w&&Be("p",{className:"feedback-page-error",role:"alert",children:w}),ua("nav",{className:"feedback-page-routes","aria-label":"Known pages",children:[b.map(I=>ua("button",{type:"button",title:I,"aria-current":I===V?"page":void 0,disabled:r||B,onClick:()=>{I===V?X(!0):ne(I)},children:[Be("span",{children:h?ua(Sl,{children:[I.slice(0,I.toLocaleLowerCase().indexOf(h)),Be("mark",{children:I.slice(I.toLocaleLowerCase().indexOf(h),I.toLocaleLowerCase().indexOf(h)+ae.length)}),I.slice(I.toLocaleLowerCase().indexOf(h)+ae.length)]}):I}),p?.[I]&&ua("small",{"aria-hidden":"true",children:[p[I].open," open",p[I].unread?` \xB7 ${p[I].unread} unread`:""]}),I===V&&Be(ha,{"aria-hidden":"true"})]},I)),!b.length&&Be("p",{className:"feedback-page-empty",children:"No matching pages"})]})]})]})}import{useEffect as or,useRef as so,useState as yl}from"react";import{jsx as tt,jsxs as tr}from"react/jsx-runtime";function vl({request:a,finish:t,returnFocus:r}){let l=so(null);return or(()=>(l.current?.showModal(),()=>r?.focus({preventScroll:!0})),[]),tr("dialog",{ref:l,className:"feedback-confirmation","aria-labelledby":"feedback-confirmation-title","aria-describedby":"feedback-confirmation-description",onCancel:d=>{d.preventDefault(),t(!1)},children:[tt("h2",{id:"feedback-confirmation-title",children:a.title}),tt("p",{id:"feedback-confirmation-description",children:a.description}),tr("div",{children:[tt("button",{type:"button",autoFocus:!0,onClick:()=>t(!1),children:"Cancel"}),tt("button",{type:"button","data-danger":a.danger,onClick:()=>t(!0),children:a.action})]})]})}function rr(){let[a,t]=yl(null),r=so(null),l=so(null);or(()=>()=>l.current?.(!1),[]);function d(n){l.current?.(n),l.current=null,t(null)}function p(n){return l.current?Promise.resolve(!1):(r.current=document.activeElement,t(n),new Promise(m=>{l.current=m}))}return{confirm:p,dialog:a&&tt(vl,{request:a,finish:d,returnFocus:r.current})}}function lr(a){if(!(a.defaultPrevented||a.repeat||a.isComposing||a.ctrlKey||a.metaKey||a.altKey||a.composedPath().some(r=>{let l=r;return l.nodeType===1&&(l.isContentEditable||l.closest('input,textarea,select,[role="textbox"],[role="combobox"],[contenteditable]:not([contenteditable="false"])'))})))switch(a.key.toLowerCase()){case"c":return a.shiftKey?"toggle-comments":"comment";case"e":return"edit";case"v":return"view";case"d":return"desktop";case"t":return"tablet";case"m":return"mobile"}}function uo(a){return a<768?"mobile":a<1024?"tablet":"desktop"}var dr={desktop:0,tablet:1,mobile:2};function ot(a,t){return dr[a??"desktop"]<=dr[t]}function sr(a){let t,r=()=>clearTimeout(t);return{cancel:r,schedule(){r(),t=setTimeout(a,70)}}}function ur(a,t,r){let m=(w,C)=>Math.max(8,Math.min(w,C)),L=a.x+36+8,v=a.x+-4-8-t.width,M=r.width-t.width-8,G=Math.max(0,r.height-16);if(L<=M||v>=8)return{left:m(L<=M?L:v,M),top:m(a.y,r.height-Math.min(t.height,G)-8),maxHeight:G};let S=m(a.y+36+8,r.height-8),z=m(a.y+-4-8,r.height-8),B=r.height-S-8,_=z-8;return B>=_?{left:m(a.x+-4,M),top:S,maxHeight:B}:{left:m(a.x+-4,M),top:z-Math.min(t.height,_),maxHeight:_}}function io(a,t,r){let l=null;try{l=a.selector?t?.querySelector(a.selector)??null:null}catch{}let d=l?.getBoundingClientRect(),p=a.relative;return d&&p&&d.width&&d.height?{left:d.left+d.width*p.x,top:d.top+d.height*p.y,width:d.width*p.width,height:d.height*p.height}:{left:a.x-r.x,top:a.y-r.y,width:a.width,height:a.height}}var qt=new WeakMap;function Ut(a,t=!1,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches||!a.animate)return r?.cancel(),null;let l=r?.playState==="running",d=window.getComputedStyle(a);if(a.dataset.expanded==="true"){let S={opacity:0,transform:"translateY(4px)"},z={opacity:1,transform:"translateY(0px)"},B=l?{opacity:d.opacity,transform:d.transform}:t?z:S;return r?.cancel(),a.animate([B,t?S:z],{duration:t?100:140,easing:"cubic-bezier(.4,0,.2,1)"})}let p=a.querySelector(".feedback-hover-preview"),n=qt.get(a)??{width:a.offsetWidth,height:a.offsetHeight,content:p,contentWidth:p?.style.width??""},m={width:`${(Number(a.dataset.pinWidth)||40)-8}px`,height:"32px",opacity:0,transform:`translate(${Number(a.dataset.pinX)-a.offsetLeft}px, ${Number(a.dataset.pinY)-a.offsetTop}px)`,borderRadius:"16px 16px 16px 0px"},L={width:`${n.width}px`,height:`${n.height}px`,opacity:1,transform:"translate(0px, 0px)",borderRadius:d.borderRadius},v=l?{width:d.width,height:d.height,opacity:d.opacity,transform:d.transform,borderRadius:d.borderRadius}:t?L:m;p&&(p.style.width=`${n.width-(parseFloat(d.borderLeftWidth)||0)-(parseFloat(d.borderRightWidth)||0)}px`),r?.cancel();let M=a.animate([{...v,overflow:"hidden"},{...t?m:L,overflow:"hidden"}],{duration:t?120:140,easing:"cubic-bezier(.4,0,.2,1)",fill:t?"forwards":"none"});n.animation=M,qt.set(a,n);let G=()=>{qt.get(a)?.animation===M&&(n.content&&(n.content.style.width=n.contentWidth),qt.delete(a))};return M.finished.then(()=>{t||G()},G),M}var ir=`:is(.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box,.chisel-project-directory) :focus{outline:none}.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{color-scheme:light;--chisel-ui-panel-shadow:0 4px 20px rgba(0,0,0,.08);--chisel-ui-canvas:#f7f7f7;--chisel-ui-surface:#ffffff;--chisel-ui-raised:#f5f5f5;--chisel-ui-inset:#eeeeee;--chisel-ui-hover:#f0f0f0;--chisel-ui-selected:#eaeaea;--chisel-ui-border:#e2e2e2;--chisel-ui-border-strong:#c4c4c4;--chisel-ui-text:#242424;--chisel-ui-secondary:#626262;--chisel-ui-muted:#686868;--chisel-ui-focus:#2468d3;--chisel-ui-accent-text:#2468d3;--chisel-ui-accent-surface:#edf4ff;--chisel-ui-action:#242424;--chisel-ui-action-text:#ffffff;--chisel-ui-danger:#b33737;--chisel-ui-avatar:#ededed;--chisel-ui-avatar-text:#565656;--chisel-ui-scrollbar:#c2c2c2;--chisel-ui-checker-light:#e5e5e5;--chisel-ui-checker-dark:#c7c7c7}@media(prefers-color-scheme:dark){.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{color-scheme:dark;--chisel-ui-panel-shadow:0 4px 20px #0003;--chisel-ui-canvas:#171717;--chisel-ui-surface:#222222;--chisel-ui-raised:#2a2a2a;--chisel-ui-inset:#191919;--chisel-ui-hover:#303030;--chisel-ui-selected:#383838;--chisel-ui-border:#3c3c3c;--chisel-ui-border-strong:#555555;--chisel-ui-text:#ededed;--chisel-ui-secondary:#b7b7b7;--chisel-ui-muted:#a5a5a5;--chisel-ui-focus:#8bb9ff;--chisel-ui-accent-text:#8bb9ff;--chisel-ui-accent-surface:#253447;--chisel-ui-action:#ededed;--chisel-ui-action-text:#111111;--chisel-ui-danger:#ffa5a5;--chisel-ui-avatar:#383838;--chisel-ui-avatar-text:#cccccc;--chisel-ui-scrollbar:#50504d;--chisel-ui-checker-light:#555555;--chisel-ui-checker-dark:#333333}}.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{--chisel-ui-font:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;--chisel-ui-space:4px;--chisel-ui-control:40px;--chisel-ui-radius:8px;--chisel-ui-text-size:13px;--chisel-ui-small:12px;--chisel-ui-motion:.12s cubic-bezier(.2,0,0,1);--chisel-ui-popover-shadow:0 2px 6px #0000000f,0 12px 36px #0000001f}@media(prefers-color-scheme:dark){.chisel-project-directory,.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box{--chisel-ui-popover-shadow:0 0 0 1px #ffffff0d,0 4px 12px #0003,0 16px 40px #0004}}
2
+ `;import{jsx as Dl}from"react/jsx-runtime";var Pl=`.feedback-confirmation{width:360px;max-width:calc(100vw - 32px);padding:24px;border:0;border-radius:16px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);box-shadow:var(--chisel-ui-popover-shadow);font:14px var(--chisel-ui-font)}.feedback-confirmation::backdrop{background:#0005}.feedback-confirmation h2{margin:0 0 8px;font-size:16px;font-weight:600}.feedback-confirmation p{margin:0;color:var(--chisel-ui-secondary);line-height:1.6;text-wrap:pretty}.feedback-confirmation>div{display:flex;justify-content:flex-end;gap:8px;margin-top:24px}.feedback-confirmation button{min-height:40px;padding:0 16px;border:0;border-radius:8px;background:var(--chisel-ui-raised);color:var(--chisel-ui-text)}.feedback-confirmation button[data-danger=true]{background:var(--chisel-ui-danger);color:var(--chisel-ui-surface)}
3
+ `+ir+`.feedback-shell,.feedback-shell *{box-sizing:border-box}.feedback-shell{font-synthesis:none;-webkit-font-smoothing:antialiased;position:fixed;inset:0;background:var(--chisel-ui-canvas);color:var(--chisel-ui-text);z-index:999999;font-family:var(--chisel-ui-font);font-size:13px;letter-spacing:0}.feedback-avatar{overflow:hidden}.feedback-account{position:relative}.feedback-account summary{list-style:none;cursor:pointer;display:flex;align-items:center;justify-content:center;min-width:40px;min-height:40px}.feedback-account summary::-webkit-details-marker{display:none}.feedback-account>div{position:absolute;right:0;top:44px;z-index:20;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);border:0;box-shadow:var(--chisel-ui-popover-shadow);border-radius:12px;padding:16px;min-width:220px;max-width:calc(100vw - 32px);display:flex;flex-direction:column;gap:8px;overflow-wrap:anywhere}.feedback-account[open]>div{transform-origin:top right;animation:chisel-account-in .16s cubic-bezier(.2,0,0,1)}@keyframes chisel-account-in{0%{opacity:0;transform:translateY(-4px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.feedback-account[open]>div{animation:none}}.feedback-account>div>span{color:var(--chisel-ui-muted);font-size:12px;line-height:1.5}.feedback-account button:hover{background:var(--chisel-ui-hover)}.feedback-account button{display:flex;align-items:center;gap:8px;color:var(--chisel-ui-text);background:transparent;border:0;min-height:40px;padding:8px;border-radius:8px}.chisel-sign-in{min-height:100dvh;display:grid;place-items:center;padding:24px;background:var(--chisel-ui-canvas);color:var(--chisel-ui-text);font-family:var(--chisel-ui-font)}.chisel-sign-in section{width:100%;max-width:360px;text-align:left}.chisel-sign-in-brand{font-size:24px;letter-spacing:-.8px}.chisel-sign-in h1{font-size:24px;font-weight:500;letter-spacing:-.4px;line-height:1.25;margin:32px 0 8px}.chisel-sign-in p{font-size:14px;line-height:1.6;color:var(--chisel-ui-secondary);margin:12px 0 24px}.chisel-sign-in button{display:flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:44px;padding:12px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text);border:0;border-radius:8px;cursor:pointer}.chisel-sign-in button:disabled{opacity:.5;cursor:not-allowed}.chisel-sign-in a{display:inline-flex;align-items:center;min-height:40px;margin-top:16px;font-size:13px;color:var(--chisel-ui-secondary)}.chisel-sign-in [role=alert]{color:var(--chisel-ui-danger)}.chisel-spin{animation:chisel-spin 1s linear infinite}@keyframes chisel-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.chisel-spin{animation:none}}.feedback-sidebar[hidden],.feedback-comment-layer[hidden]{display:none}.feedback-shell.comments-hidden .feedback-canvas,.feedback-shell.is-editing .feedback-canvas{height:100%;flex:1}.feedback-comment-area{position:absolute;pointer-events:none;z-index:1;border:2px solid var(--chisel-ui-focus);background:color-mix(in srgb,var(--chisel-ui-focus) 8%,transparent);border-radius:4px}.feedback-element-box{position:absolute;pointer-events:none;z-index:1;border:1px solid var(--chisel-ui-focus);background:color-mix(in srgb,var(--chisel-ui-focus) 4%,transparent);box-sizing:border-box}.feedback-element-box.is-selected{border-width:2px;background:color-mix(in srgb,var(--chisel-ui-focus) 6%,transparent)}.feedback-thread-popup{max-height:calc(100% - 16px);overflow:auto}.feedback-thread-popup[hidden]{display:none}.feedback-thread-message,.feedback-thread-replies{overflow-wrap:anywhere;line-height:1.6;margin:0}.feedback-thread-replies{max-height:140px;overflow:auto}.feedback-thread-actions{display:flex;justify-content:space-between;align-items:center;margin-top:8px;gap:8px}.feedback-thread-actions .feedback-resolve{margin:0;font-size:11px;padding:8px}.feedback-composer-heading>button{display:grid;place-items:center;width:24px;height:24px;border-radius:4px}.feedback-composer-heading>button:hover{background:var(--chisel-ui-raised)}.feedback-shell button,.feedback-shell input,.feedback-shell textarea{font:inherit}.feedback-shell button{cursor:pointer}.feedback-shell button:disabled{cursor:not-allowed}.feedback-shell :where(button,summary){-webkit-tap-highlight-color:transparent}.feedback-workspace{display:flex;height:100%}.feedback-canvas{position:relative;flex:1;min-width:0;padding:0;container-type:inline-size}.feedback-preview-scroll{height:100%;overflow:auto;padding:0 12px}.feedback-preview-frame{position:relative;height:100%;margin-inline:auto}.feedback-viewport{position:relative;width:100%;height:100%;overflow:hidden;background:#fff;border:0;border-radius:0}.feedback-viewport iframe{width:100%;height:100%;border:0;display:block}.feedback-preview-resize{position:absolute;top:0;bottom:0;width:12px;cursor:ew-resize;touch-action:none;user-select:none}.feedback-preview-resize[data-edge=left]{left:-12px}.feedback-preview-resize[data-edge=right]{right:-12px}.feedback-preview-resize:after{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:3px;height:32px;border-radius:999px;background:var(--chisel-ui-muted);opacity:.35}.feedback-preview-resize:hover:after,.feedback-preview-resize:active:after{opacity:1}.feedback-pin{position:absolute;transform:translate(-4px,-4px);width:40px;height:40px;display:grid;place-items:center;padding:8px;border-radius:50% 50% 50% 0;background:transparent;color:var(--chisel-ui-text);border:0;box-sizing:border-box;z-index:2}.feedback-comment-layer[data-hover-preview=true] .feedback-pin:not(.selected){z-index:5}.feedback-pin:before{content:"";position:absolute;inset:4px;border:1px solid var(--chisel-ui-border);border-radius:inherit;background:var(--chisel-ui-surface);box-shadow:0 2px 7px #0002;z-index:-1}.feedback-pin .feedback-avatar{width:24px;height:24px;font-size:12px}.feedback-pin-group{display:flex;width:auto;border-radius:20px 20px 20px 0}.feedback-pin-group .feedback-avatar+.feedback-avatar{margin-left:-4px}.feedback-pin .feedback-avatar img{width:100%;height:100%;object-fit:cover}.feedback-pin .feedback-pin-more{font-size:9px;font-variant-numeric:tabular-nums}.feedback-toolbar{position:absolute;z-index:2;bottom:17px;left:24px;display:flex;padding:4px;gap:4px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);border:0;border-radius:999px;box-shadow:var(--chisel-ui-popover-shadow)}.feedback-toolbar button{border:1px solid transparent;background:transparent;color:var(--chisel-ui-muted);height:var(--chisel-ui-control);padding:0 16px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:999px;white-space:nowrap;transition:background-color var(--chisel-ui-motion),color var(--chisel-ui-motion),border-color var(--chisel-ui-motion)}.feedback-toolbar button:hover{background:var(--chisel-ui-raised);color:var(--chisel-ui-text)}.feedback-toolbar button[aria-pressed=true]{background:var(--chisel-ui-raised);color:var(--chisel-ui-text);border-color:transparent}.feedback-breakpoints{left:auto;right:24px}.feedback-breakpoints button{width:40px;padding:0}.feedback-breakpoints button{position:relative}.feedback-breakpoints sup{position:absolute;right:-2px;top:-3px;min-width:18px;padding:2px 4px;border-radius:999px;background:var(--chisel-ui-text);color:var(--chisel-ui-surface);font-size:11px;line-height:1.2;font-variant-numeric:tabular-nums}.feedback-thread-status{position:relative;display:inline-flex;align-items:center;min-width:0;min-height:40px;margin-right:auto}.feedback-status-value{display:inline-flex;align-items:center;gap:4px;max-width:100%;height:28px;padding:0 8px;border-radius:999px;background:var(--chisel-ui-raised);color:var(--chisel-ui-secondary);font-size:12px;line-height:1;white-space:nowrap;transition:background-color var(--chisel-ui-motion),color var(--chisel-ui-motion)}.feedback-status-value>span{min-width:0;overflow:hidden;text-overflow:ellipsis}.feedback-status-value svg{width:14px;height:14px;flex-shrink:0;stroke-width:1.75}.feedback-status-value>svg:last-child{width:12px}.feedback-thread-status[data-state=ready] .feedback-status-value{background:var(--chisel-ui-accent-surface);color:var(--chisel-ui-accent-text)}.feedback-thread-status select{position:absolute;inset:0;width:100%;height:100%;min-height:40px;opacity:0;cursor:pointer;font:inherit}.feedback-thread-status select:disabled{cursor:default}.feedback-thread-status:has(select:enabled):hover .feedback-status-value{background:var(--chisel-ui-hover)}.feedback-guide,.feedback-notice{padding:10px;margin:0 0 8px;background:var(--chisel-ui-raised);border-radius:12px;font-size:12px;line-height:1.5}.feedback-guide{padding:12px}.feedback-guide strong{font-size:13px;font-weight:600}.feedback-guide ul{list-style:none;padding:0;margin:10px 0;display:grid;gap:8px}.feedback-guide li{display:flex;align-items:center;gap:8px}.feedback-guide li svg{width:16px;height:16px;flex-shrink:0;color:var(--chisel-ui-muted);stroke-width:1.75}.feedback-guide p{margin:8px 0;color:var(--chisel-ui-muted);text-wrap:pretty}.feedback-guide button,.feedback-notice button,.feedback-export button{min-height:40px;background:none;border:0;color:var(--chisel-ui-text)}.feedback-guide button{width:100%;border-radius:8px;background:var(--chisel-ui-surface);font-weight:500;transition:background-color var(--chisel-ui-motion)}.feedback-guide button:hover{background:var(--chisel-ui-hover)}.feedback-notice{position:relative;padding-right:34px}.feedback-notice>button[aria-label]{position:absolute;right:0;top:0;width:32px}.feedback-export{flex-shrink:0;border-top:1px solid var(--chisel-ui-border);font-size:12px}.feedback-export>summary{display:flex;align-items:center;gap:8px;min-height:40px;padding:8px;cursor:pointer;list-style:none;color:var(--chisel-ui-secondary)}.feedback-export>summary::-webkit-details-marker{display:none}.feedback-export>summary:hover{color:var(--chisel-ui-text)}.feedback-export>summary>svg:last-child{margin-left:auto;transition:transform var(--chisel-ui-motion)}.feedback-export[open]>summary>svg:last-child{transform:rotate(90deg)}.feedback-export>div{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 8px 8px;color:var(--chisel-ui-muted);font-variant-numeric:tabular-nums}.feedback-export button{display:flex;align-items:center;gap:6px;padding:0 10px;border-radius:8px;background:var(--chisel-ui-raised)}.feedback-export button:disabled{opacity:.5}.feedback-shell .feedback-comment:has(.feedback-comment-select){position:relative;padding-left:40px}.feedback-shell .feedback-comment-select{position:absolute;left:0;top:8px;width:40px;height:40px;display:grid;place-items:center;cursor:pointer}.feedback-comment-select input{width:16px;height:16px;margin:0;accent-color:var(--chisel-ui-text)}@media(prefers-reduced-motion:reduce){.feedback-export>summary>svg:last-child{transition:none}}.feedback-account a{color:var(--chisel-ui-text);min-height:40px;display:inline-flex;align-items:center}.feedback-page-routes small{margin-left:auto;color:var(--chisel-ui-muted);font-size:12px}.chisel-project-directory{background:var(--chisel-ui-canvas);color:var(--chisel-ui-text);font:14px var(--chisel-ui-font);min-height:100dvh;padding:32px max(24px,calc((100vw - 840px)/2))}.chisel-project-directory header{display:flex;justify-content:space-between;gap:16px;align-items:center}.chisel-project-directory header>strong{flex-shrink:0}.chisel-project-directory header>span{min-width:0;overflow-wrap:anywhere;text-align:right}.chisel-project-directory h2{overflow-wrap:anywhere}.chisel-project-directory section{background:var(--chisel-ui-surface);border-radius:16px;padding:20px;margin-top:16px}.chisel-project-directory form,.chisel-project-directory label{display:flex;flex-direction:column;gap:8px;margin-top:12px}.chisel-project-directory input,.chisel-project-directory button{min-height:40px;padding:8px 12px;border:1px solid var(--chisel-ui-border);border-radius:8px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);font:inherit}.chisel-project-directory a{display:inline-flex;align-items:center;min-height:40px;color:var(--chisel-ui-accent-text)}.chisel-project-directory a:hover{text-decoration:underline;text-underline-offset:3px}.feedback-preview-width{display:flex;align-items:center;padding-right:8px;font-size:12px;font-variant-numeric:tabular-nums;color:var(--chisel-ui-muted);border-right:1px solid var(--chisel-ui-border)}.feedback-shell .feedback-preview-width input{width:52px;min-height:40px;padding:0 4px 0 8px;border:0;border-radius:999px;background:transparent;text-align:right;font-size:12px;font-variant-numeric:tabular-nums}@container (max-width:520px){.feedback-toolbar{left:16px;bottom:10px}.feedback-breakpoints{left:auto;right:16px}.feedback-toolbar button{width:40px;padding:0}.feedback-toolbar button span{display:none}}@container (max-width:400px){.feedback-toolbar:not(.feedback-breakpoints){bottom:66px}}@media(pointer:coarse){.feedback-shell .feedback-preview-width input,.feedback-guide button{min-height:44px}}.feedback-collaboration{display:flex;align-items:center;gap:8px;min-height:32px;margin-bottom:8px;color:var(--chisel-ui-muted);font-size:12px}.feedback-reviewers{display:flex;flex:1;min-width:0;overflow:hidden}.feedback-reviewers .feedback-avatar{width:24px;height:24px}.feedback-reviewers .feedback-avatar+.feedback-avatar{margin-left:-4px}.feedback-reviewers img{width:100%;height:100%;object-fit:cover}.feedback-unread-count,.feedback-unread-label{color:var(--chisel-ui-accent-text);font-size:12px;font-variant-numeric:tabular-nums}.feedback-unread-label{display:inline}@media(prefers-reduced-motion:reduce){.feedback-toolbar button,.feedback-comment{transition:none}}.feedback-shell button svg,.feedback-shell summary svg{width:16px;height:16px;stroke-width:1.75;flex-shrink:0}.feedback-primary,.feedback-resolve,.feedback-thread form button{display:inline-flex;align-items:center;justify-content:center;gap:6px}.feedback-sidebar{--feedback-panel-divider:var(--chisel-ui-border);--feedback-panel-shadow:var(--chisel-ui-panel-shadow);width:400px;flex-shrink:0;padding:0;background:transparent;color:var(--chisel-ui-text);border:0;display:flex;flex-direction:column;min-height:0;font-family:var(--chisel-ui-font);font-size:13px;letter-spacing:0;-webkit-font-smoothing:antialiased;color-scheme:inherit}.feedback-sidebar-panel{display:flex;flex-direction:column;flex:1;min-height:0;overflow:hidden auto;overscroll-behavior:contain;padding:16px 20px 0;border:0;border-radius:0;background:var(--chisel-ui-surface)}.feedback-search{display:flex;align-items:center;gap:8px;min-height:40px;margin-bottom:8px;padding:0 8px;border-radius:8px;background:transparent;color:var(--chisel-ui-muted)}.feedback-search svg{flex-shrink:0}.feedback-shell .feedback-search input{min-width:0;min-height:40px;padding:0;border:0;background:transparent;font-size:13px}.feedback-search input::placeholder{color:var(--chisel-ui-muted)}.feedback-search:hover{background:var(--chisel-ui-raised)}.feedback-page-control{position:relative;flex-shrink:0;margin:8px 0}.feedback-page-control:last-child{margin-bottom:16px}.feedback-page-control+.feedback-review-invite{padding-top:0}.feedback-page-control>summary{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 8px;border-radius:8px;list-style:none;color:var(--chisel-ui-secondary);cursor:pointer}.feedback-page-control>summary::-webkit-details-marker{display:none}.feedback-page-control>summary:hover,.feedback-page-control[open]>summary{background:var(--chisel-ui-raised);color:var(--chisel-ui-text)}.feedback-page-control>summary[aria-disabled=true]{opacity:.5;cursor:default}.feedback-page-control>summary>span,.feedback-page-routes button>span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;font:12px/20px ui-monospace,SFMono-Regular,monospace}.feedback-page-chevron{transform:rotate(180deg);transition:transform var(--chisel-ui-motion)}.feedback-page-control[open] .feedback-page-chevron{transform:rotate(0)}.feedback-page-popover{position:absolute;bottom:calc(100% + 4px);left:0;right:0;z-index:30;display:flex;flex-direction:column;gap:6px;max-height:min(var(--feedback-page-space,320px),calc(min(240px,30dvh) + 64px));overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--chisel-ui-scrollbar) transparent;padding:8px;border-radius:12px;background:var(--chisel-ui-surface);box-shadow:var(--chisel-ui-popover-shadow)}.feedback-page-form{position:sticky;top:0;z-index:1;display:flex;flex-shrink:0;align-items:center;gap:4px;border-radius:8px;background:var(--chisel-ui-raised)}.feedback-shell .feedback-page-form input{flex:1;min-width:0;min-height:40px;padding:0 10px;border:0;border-radius:8px;background:transparent;font-size:13px}.feedback-page-form button{display:grid;place-items:center;flex-shrink:0;width:40px;min-height:40px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text)}.feedback-page-routes{display:flex;flex-direction:column;flex-shrink:0;gap:2px;min-height:0}.feedback-page-routes button{display:flex;align-items:center;gap:8px;width:100%;min-height:40px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-secondary)}.feedback-page-routes button[aria-current=page]{background:var(--chisel-ui-selected);color:var(--chisel-ui-text)}.feedback-page-routes mark{background:var(--chisel-ui-selected);color:var(--chisel-ui-text);border-radius:2px;font-weight:700}.feedback-page-empty{margin:0;padding:10px 8px;color:var(--chisel-ui-secondary);font-size:12px}.feedback-page-control button:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-page-control button:disabled{opacity:.5}.feedback-page-control button:active{transform:scale(.96)}.feedback-page-error{margin:0;padding:4px 8px;color:var(--chisel-ui-danger);font-size:12px;line-height:1.5;overflow-wrap:anywhere}@media(pointer:coarse){.feedback-page-control>summary,.feedback-page-control button,.feedback-shell .feedback-page-form input{min-height:44px}.feedback-page-form button{width:44px}}@media(prefers-reduced-motion:reduce){.feedback-page-chevron{transition:none}}.feedback-sidebar-title{min-height:40px;padding:0;margin-bottom:12px;border:0;display:flex;align-items:center;justify-content:space-between;gap:6px}.feedback-sidebar h1{font:600 15px/22px var(--chisel-ui-font);letter-spacing:-.01em;margin:0;color:var(--chisel-ui-text)}.feedback-sidebar h1 span{font:500 12px ui-monospace,SFMono-Regular,Menlo,monospace;font-variant-numeric:tabular-nums;margin-left:6px;color:var(--chisel-ui-muted)}.feedback-avatar{width:27px;height:27px;background:var(--chisel-ui-avatar);color:var(--chisel-ui-avatar-text);border:0;display:inline-flex;justify-content:center;align-items:center;border-radius:50%;font-size:11px;flex-shrink:0}.feedback-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));flex-shrink:0;gap:6px;margin:0 0 8px;padding:4px;border-radius:12px;background:var(--chisel-ui-raised)}.feedback-tabs button{position:relative;min-width:0;min-height:40px;background:transparent;border:0;border-radius:8px;color:var(--chisel-ui-secondary);padding:0 12px;font-size:13px;font-weight:500;transition:background-color var(--chisel-ui-motion),color var(--chisel-ui-motion),box-shadow var(--chisel-ui-motion)}.feedback-tabs button+button:before{content:"";position:absolute;left:-3.5px;top:50%;width:1px;height:16px;transform:translateY(-50%);background:var(--chisel-ui-border);pointer-events:none}.feedback-tabs button:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-tabs button[aria-pressed=true]{color:var(--chisel-ui-text);background:var(--chisel-ui-surface);box-shadow:0 1px 3px #0000000d,0 0 0 1px var(--chisel-ui-border)}@media(prefers-reduced-motion:reduce){.feedback-tabs button{transition:none}}.feedback-comment-list{flex:1;min-height:160px;overflow:auto;overscroll-behavior:contain;padding:0;scrollbar-width:thin;scrollbar-color:var(--chisel-ui-scrollbar) transparent}.feedback-comment{border:0;border-radius:8px;padding:16px 8px;margin-bottom:8px;background:transparent;transition:background-color var(--chisel-ui-motion)}.feedback-comment:hover,.feedback-comment.active{background:var(--chisel-ui-raised)}.feedback-comment-main{display:flex;flex-direction:column;align-items:stretch;gap:8px;border:0;background:none;text-align:left;width:100%;min-height:40px;padding:0;color:inherit}.feedback-comment-heading{display:flex;align-items:center;gap:10px}.feedback-comment-identity{flex:1;min-width:0}.feedback-comment-activity{display:flex;align-items:center;gap:8px;margin-left:38px;margin-top:4px}.feedback-comment-heading>.feedback-avatar{width:28px;height:28px}.feedback-comment-heading img{width:100%;height:100%;object-fit:cover}.feedback-comment-avatars{display:flex;gap:4px}.feedback-comment-avatars .feedback-avatar{width:20px;height:20px;font-size:10px}.feedback-comment-avatars img{width:100%;height:100%;object-fit:cover}.feedback-comment-unread-dot{width:8px;height:8px;flex-shrink:0;border-radius:50%;background:var(--chisel-ui-focus)}.feedback-comment-status{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--chisel-ui-muted);font-size:12px;line-height:1.5}.feedback-comment-meta{display:flex;align-items:baseline;gap:6px;flex-wrap:wrap;font-size:13px;line-height:1.5}.feedback-comment-meta strong{font-weight:500;overflow-wrap:anywhere}.feedback-comment-meta time{color:var(--chisel-ui-muted);font-size:12px;font-variant-numeric:tabular-nums}.feedback-comment-body{display:block;margin-left:38px;line-height:1.5;overflow-wrap:anywhere;color:var(--chisel-ui-text);font-size:14px;white-space:pre-wrap}.feedback-comment-reply-count{color:var(--chisel-ui-secondary);font-size:12px;line-height:1.5}.feedback-comment-path{font:inherit;color:inherit}.feedback-empty{padding:24px 8px;color:var(--chisel-ui-muted)}.feedback-empty>span{display:none}.feedback-empty h2{font:500 14px var(--chisel-ui-font);color:var(--chisel-ui-secondary);margin:0 0 6px}.feedback-empty p{font-size:13px;line-height:1.6;color:var(--chisel-ui-muted);margin:0}.feedback-review-invite{border:0;padding:16px 0;color:var(--chisel-ui-secondary)}.feedback-review-invite summary{display:flex;align-items:center;gap:8px;list-style:none;cursor:pointer;font-size:13px;padding:10px 8px;min-height:40px;border-radius:8px}.feedback-review-invite summary::-webkit-details-marker{display:none}.feedback-review-invite[open]>summary svg{transform:rotate(90deg)}.feedback-review-invite summary:hover{background:var(--chisel-ui-hover)}.feedback-review-invite form{display:flex;flex-direction:column;gap:10px;margin-top:10px}.feedback-review-invite .feedback-primary{width:100%;align-self:stretch}.feedback-review-invite input{min-height:40px}.feedback-review-invite button:not(.feedback-primary){min-height:40px;padding:8px 12px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-secondary)}.feedback-review-invite button:not(.feedback-primary):not(:disabled):hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-review-invite button:disabled{opacity:.45}.feedback-review-invite label{display:flex;flex-direction:column;gap:6px;font-size:11px}.feedback-review-invite p{font-size:12px;line-height:1.5;margin:0}.feedback-composer{position:absolute;z-index:3;width:288px;background:var(--chisel-ui-surface);padding:14px;border:0;border-radius:16px;box-shadow:var(--chisel-ui-popover-shadow);display:flex;flex-direction:column;gap:10px}.feedback-composer-heading{display:flex;align-items:center;justify-content:space-between;font-weight:700}.feedback-composer-heading button{border:0;background:none;font-size:21px}.feedback-shell input,.feedback-shell textarea{border:1px solid var(--chisel-ui-border);border-radius:4px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);padding:9px;width:100%;box-sizing:border-box}.feedback-shell textarea{resize:none;min-height:70px}.feedback-primary{min-height:40px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text);border:0;padding:0 12px;border-radius:8px;align-self:flex-end}.feedback-thread{margin-top:16px}.feedback-thread form button,.feedback-resolve{background:var(--chisel-ui-surface);border:1px solid var(--chisel-ui-border);border-radius:4px;padding:7px 10px;margin-top:8px}.feedback-resolve{color:var(--chisel-ui-text)}.feedback-reply{border-left:2px solid var(--chisel-ui-border);padding-left:10px}.feedback-error{color:var(--chisel-ui-danger);padding:0 8px;margin:0 0 16px;line-height:1.5;font-size:13px}.feedback-comment-list>p[role=status]{margin:0;padding:24px 8px;color:var(--chisel-ui-secondary);line-height:1.5;font-size:13px}@media(max-width:760px){.feedback-workspace{flex-direction:column}.feedback-canvas{height:48%;flex:none;padding:0}.feedback-sidebar{width:100%;height:auto;flex:1;padding:0}.feedback-sidebar-panel{border:0}.feedback-sidebar-title{min-height:44px}.feedback-tabs{margin-bottom:8px}.feedback-tabs button{min-height:44px;padding:0 8px}.feedback-empty{padding:12px}.feedback-empty>span{display:none}.feedback-toolbar{bottom:10px}.feedback-comment{padding:14px 8px}}.comment-box{position:absolute;z-index:4;display:flex;flex-direction:column;width:344px;max-width:calc(100% - 16px);height:auto;max-height:calc(100% - 16px);padding:0;overflow:hidden;border:0;border-radius:16px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);box-shadow:var(--chisel-ui-popover-shadow);font:12px var(--chisel-ui-font);color-scheme:inherit}.comment-box[data-settings-open=true]{height:440px}.comment-box-settings{display:flex;flex-direction:column;flex:1;min-height:0}.comment-box-settings[hidden],.comment-box[hidden],.comment-thread form[hidden]{display:none}.comment-box-draft-pin{pointer-events:none}.comment-box-prompt{display:flex;align-items:center;gap:9px;min-height:44px;padding:8px 12px;flex-shrink:0}.comment-box-symbol{position:relative;border:0;padding:0;display:grid;place-items:center;background:transparent;border-radius:8px;width:40px;height:40px;flex-shrink:0}.comment-box-symbol[aria-expanded=true]{background:var(--chisel-ui-selected)}.comment-box-symbol:hover{background:var(--chisel-ui-hover)}.comment-box-symbol svg{width:14px;height:14px;color:var(--chisel-ui-text)}.comment-box .comment-box-prompt input{border:0;border-radius:0;background:none;box-shadow:none;padding:0;color:var(--chisel-ui-text);font:13px var(--chisel-ui-font);outline:none;width:100%;min-width:0}.comment-box-prompt input::placeholder{color:var(--chisel-ui-muted)}.comment-box-element{display:flex;align-items:center;justify-content:space-between;background:var(--chisel-ui-raised);color:var(--chisel-ui-muted);min-height:28px;padding:0 15px;flex-shrink:0}.comment-box-element code{font:12px monospace}.comment-box-element svg{color:var(--chisel-ui-muted)}.comment-box,.comment-thread{translate:var(--comment-drag-x,0px) var(--comment-drag-y,0px)}.feedback-shell .comment-window-drag{display:grid;place-items:center;flex-shrink:0;width:40px;height:40px;padding:0;border:0;border-radius:var(--chisel-ui-radius);background:transparent;color:var(--chisel-ui-muted);cursor:grab;touch-action:none;user-select:none}.feedback-shell .comment-window-drag:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-shell .comment-window-drag[data-dragging=true]{cursor:grabbing}.comment-box-element .comment-window-drag{margin-left:auto;margin-right:-8px}.feedback-thread-header>.comment-window-drag{margin-right:0}.comment-box-preview-status{margin-left:auto;margin-right:8px;font:12px var(--chisel-ui-font);color:var(--chisel-ui-accent-text)}.comment-box-properties{flex:1;min-height:0;min-width:0;border:0;margin:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--chisel-ui-scrollbar) transparent;padding:4px 15px 9px;position:relative}.comment-box-row{min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;color:var(--chisel-ui-secondary)}.comment-box-row>span{white-space:nowrap}.comment-box .comment-box-row input,.comment-box select{border:0;background:var(--chisel-ui-raised);color:var(--chisel-ui-secondary);border-radius:8px;min-width:0;width:128px;height:var(--chisel-ui-control);font:12px var(--chisel-ui-font);padding:4px 8px;text-overflow:ellipsis}.comment-box input:disabled{opacity:.35}.comment-box-number{display:flex;align-items:center;border:0;background:var(--chisel-ui-raised);border-radius:8px;width:128px;flex-shrink:0;height:var(--chisel-ui-control);padding-right:8px;color:var(--chisel-ui-muted)}.comment-box .comment-box-number input{border:0;width:100%;height:40px;background:transparent;box-shadow:none}.comment-box-number input::-webkit-inner-spin-button,.comment-box-spacing input::-webkit-inner-spin-button{-webkit-appearance:none}.comment-box-number>span{font:11px monospace}.comment-box select{appearance:auto}.comment-box-color{display:flex;align-items:center;gap:8px;border:0;width:142px;height:var(--chisel-ui-control);border-radius:7px;padding:3px 4px;min-width:0}.comment-color-trigger{position:relative;display:grid;place-items:center;width:24px;height:24px;flex-shrink:0;padding:0;border:0;border-radius:4px;background:repeating-conic-gradient(var(--chisel-ui-checker-light) 0% 25%,var(--chisel-ui-checker-dark) 0% 50%) 50%/8px 8px}.comment-color-trigger:after{content:"";position:absolute;inset:-8px;border-radius:inherit}.comment-color-trigger>span{display:block;width:100%;height:100%;border-radius:inherit;box-shadow:inset 0 0 0 1px var(--chisel-ui-border)}@media(pointer:coarse){.comment-color-trigger:after{inset:-10px}}.comment-color-value{font:12px monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--chisel-ui-secondary)}.chisel-color-picker,.chisel-color-picker *{box-sizing:border-box}.chisel-color-picker{position:fixed;z-index:1000001;width:256px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow:auto;padding:16px;border:0;border-radius:16px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text);font:12px var(--chisel-ui-font);box-shadow:var(--chisel-ui-popover-shadow);color-scheme:inherit}.chisel-color-plane{position:relative;height:160px;margin:0 0 14px;border-radius:10px;touch-action:none;cursor:crosshair;background-image:linear-gradient(to top,#000,transparent),linear-gradient(to right,#fff,transparent)}.chisel-color-thumb{position:absolute;width:19px;height:19px;border:2px solid #fff;border-radius:50%;transform:translate(-50%,-50%);pointer-events:none;box-shadow:0 1px 5px #0004}.chisel-color-tools{display:flex;gap:12px;align-items:center;margin-bottom:14px}.chisel-color-hue{appearance:none;-webkit-appearance:none;flex:1;min-width:0;height:40px;border:12px solid transparent;background-clip:padding-box;border-radius:20px;margin:0;background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer}.chisel-color-hue::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:20px;height:20px;border:2px solid #fff;border-radius:50%;background:var(--hue);box-shadow:0 1px 4px #0004}.chisel-color-hue::-moz-range-thumb{width:16px;height:16px;border:2px solid #fff;border-radius:50%;background:var(--hue);box-shadow:0 1px 4px #0004}.chisel-color-tools button{display:grid;place-items:center;flex-shrink:0;width:44px;height:40px;padding:0;background:var(--chisel-ui-raised);border:0;border-radius:8px;color:var(--chisel-ui-text);cursor:pointer}.chisel-color-tools button:disabled{opacity:.35;cursor:not-allowed}.chisel-color-hex{display:flex;flex-direction:column;gap:8px;color:var(--chisel-ui-secondary);font-size:11px}.chisel-color-hex input{width:100%;height:40px;border:0;border-radius:8px;padding:7px 9px;background:var(--chisel-ui-raised);color:var(--chisel-ui-text);font:13px monospace}.chisel-color-hex input[aria-invalid=true]{outline:2px solid var(--chisel-ui-danger)}.chisel-color-error{display:block;color:var(--chisel-ui-danger);font-size:11px;margin-top:6px}.chisel-color-accessible{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);border:0}.comment-box-control-group{margin-top:20px}.comment-box-control-group h3{font:500 12px/18px var(--chisel-ui-font);margin:0 0 8px;color:var(--chisel-ui-text)}.comment-box-group{border:0;margin-top:20px;padding-top:0}.comment-box-group summary{list-style:none;display:flex;align-items:center;gap:6px;min-height:40px;color:var(--chisel-ui-secondary);cursor:pointer}.comment-box-group summary::-webkit-details-marker{display:none}.comment-box-group[open] summary svg{transform:rotate(90deg)}.comment-box-pair{position:relative;padding:2px 0}.comment-box-pair .comment-box-row{min-height:44px}.comment-box-link{position:absolute;left:42%;top:50%;transform:translate(-50%,-50%);border:0;background:var(--chisel-ui-surface);color:var(--chisel-ui-muted);border-radius:50%;width:40px;height:40px;display:grid;place-items:center;z-index:1}.comment-box-link:before{content:none}.comment-box-link svg{padding:0}.comment-box-link:hover{background:var(--chisel-ui-hover)}.comment-box-link[aria-pressed=true]{color:var(--chisel-ui-accent-text);background:var(--chisel-ui-accent-surface)}.comment-box-link[aria-pressed=true]:before{border-color:var(--chisel-ui-focus)}.comment-box-number{font-variant-numeric:tabular-nums}.comment-box .comment-box-number input::-webkit-inner-spin-button{-webkit-appearance:none}.comment-box-footer{height:56px;min-height:56px;display:flex;align-items:center;gap:8px;padding:8px;border:0}.comment-box-footer>span{flex:1}.comment-box-footer button{display:grid;place-items:center;border:0;background:none;color:var(--chisel-ui-text);height:40px;width:40px}.comment-box-footer .comment-box-cancel:hover{background:var(--chisel-ui-hover)}.comment-box-footer .comment-box-cancel{width:auto;padding:0 9px;font:13px var(--chisel-ui-font);border:0;border-radius:8px;background:transparent}.comment-box-footer .comment-box-submit{width:40px;border-radius:8px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.comment-box-footer .comment-box-submit:disabled{opacity:.4;cursor:not-allowed}.comment-box-error{margin:0;padding:0 12px 8px;flex-shrink:0;font-size:11px;line-height:1.5;color:var(--chisel-ui-danger)}.comment-box-saving{width:12px;height:12px;border:1px solid var(--chisel-ui-border-strong);border-top-color:transparent;border-radius:50%;animation:chisel-spin 1s linear infinite}.feedback-composer.comment-thread{width:400px;max-width:calc(100% - 16px);gap:0;border-radius:16px;background:var(--chisel-ui-surface);border-color:var(--chisel-ui-border);color:var(--chisel-ui-text);padding:0;box-shadow:var(--chisel-ui-popover-shadow);color-scheme:inherit;overflow:hidden auto;scrollbar-width:thin}.feedback-thread-header{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:56px;padding:8px 12px 4px 20px;border:0;flex-shrink:0}.comment-thread .feedback-thread-summary{width:100%;padding:16px}.comment-thread .feedback-thread-summary:empty{display:none}.comment-thread .feedback-thread-replies{width:100%;padding:0 16px}.comment-thread form{width:100%;padding:16px}.feedback-composer.comment-thread[data-expanded=false]{width:240px;max-width:calc(100% - 16px);border-radius:16px 16px 16px 0;overflow:hidden}.feedback-thread-content{display:flex;flex-direction:column;flex-shrink:0;width:100%}.feedback-thread-content[hidden]{display:none}.feedback-hover-preview{display:flex;align-items:flex-start;gap:10px;flex-shrink:0;width:100%;padding:12px;border:0;border-radius:inherit;background:transparent;color:var(--chisel-ui-text);text-align:left;font:12px/16px var(--chisel-ui-font)}.feedback-hover-preview>.feedback-avatar{width:24px;height:24px;font-size:12px}.feedback-hover-preview img{width:100%;height:100%;object-fit:cover}.feedback-hover-copy{flex:1;min-width:0}.feedback-hover-byline{display:flex;align-items:baseline;gap:4px;white-space:nowrap;overflow:hidden}.feedback-hover-byline strong{font-weight:500;overflow:hidden;text-overflow:ellipsis}.feedback-hover-byline time{color:var(--chisel-ui-muted);font-size:11px;flex-shrink:0}.feedback-hover-message{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}.feedback-pin.selected:before{border-color:var(--chisel-ui-focus)}.comment-thread .feedback-thread-summary,.comment-thread .feedback-thread-replies,.comment-thread form{width:100%;flex-shrink:0}.comment-thread .feedback-preview{white-space:nowrap}.feedback-thread-summary{display:flex;align-items:flex-start;gap:8px;flex-shrink:0}.feedback-thread-summary,.feedback-thread-reply{position:relative}.feedback-message-edit{display:grid;place-items:center;width:40px;height:40px;flex-shrink:0;padding:0;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-secondary);opacity:0;transition:opacity .12s,background .12s}.feedback-thread-summary:hover .feedback-message-edit,.feedback-thread-reply:hover .feedback-message-edit,.feedback-message-edit:focus-visible{opacity:1}.feedback-message-edit:hover{background:var(--chisel-ui-hover)}@media(hover:none){.feedback-message-edit{opacity:1}}.feedback-thread-summary-button{display:flex;align-items:flex-start;gap:10px;flex:1;min-width:0;border:0;padding:0;text-align:left;background:transparent;color:inherit}.feedback-thread-summary-button>.feedback-avatar{width:26px;height:26px;flex-shrink:0;margin-top:1px;font-size:10px}.feedback-thread-summary-copy{display:flex;flex-direction:column;gap:4px;min-width:0;flex:1}.feedback-thread-byline{display:flex;align-items:baseline;gap:7px;min-width:0;flex-wrap:wrap}.feedback-thread-byline strong{font-size:13px;font-weight:600;line-height:1.4;overflow-wrap:anywhere}.feedback-thread-byline time{font-size:12px;color:var(--chisel-ui-muted);white-space:nowrap}.feedback-thread-summary .feedback-thread-message{font-size:14px;line-height:1.5;color:var(--chisel-ui-text);overflow-wrap:anywhere}.comment-thread[data-expanded=false] .feedback-thread-message{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.feedback-thread-reply-count{font-size:12px;line-height:1.4;color:var(--chisel-ui-muted)}.feedback-thread-close{display:grid;place-items:center;flex-shrink:0;width:24px;height:24px;border:0;border-radius:6px;background:none;color:var(--chisel-ui-muted);padding:4px}.feedback-thread-header-actions{display:flex;gap:4px;flex-shrink:0}.feedback-thread-header-actions .feedback-thread-close{position:relative;width:40px;height:40px}.feedback-thread-header-actions .feedback-thread-delete:hover{color:var(--chisel-ui-danger)}@container (max-width:400px){.feedback-thread-header{gap:4px;padding-inline:8px}.feedback-thread-header-actions{gap:0}}.feedback-thread-close:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.feedback-thread-reply{display:flex;align-items:flex-start;gap:10px;padding:16px 0;border:0}.feedback-thread-reply>.feedback-avatar{width:24px;height:24px;font-size:10px}.feedback-thread-reply>div{flex:1;min-width:0}.feedback-thread-reply strong{font-size:13px;font-weight:600}.feedback-thread-reply p{font-size:14px;line-height:1.5;margin:4px 0 0;color:var(--chisel-ui-secondary)}.comment-thread form{padding-top:16px;border:0}.feedback-shell .comment-thread textarea{background:var(--chisel-ui-raised);color:var(--chisel-ui-text);border:1px solid var(--chisel-ui-border);border-radius:9px;min-height:40px;max-height:min(240px,40dvh);padding:10px 12px;font-size:14px;line-height:1.5;resize:none;overflow-y:auto}.comment-thread .feedback-thread-actions{margin-top:6px}.comment-thread .feedback-primary{border-radius:50%;width:40px;height:40px;padding:0;font-size:0;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text);margin:0;transition:opacity .15s,transform .15s}.comment-thread .feedback-primary:disabled{opacity:.35;cursor:not-allowed}.comment-thread .feedback-primary:not(:disabled):active{transform:scale(.96)}.comment-thread .feedback-resolve{background:transparent;color:var(--chisel-ui-secondary);border:0;border-radius:6px;padding:6px;font-size:12px;min-height:40px}.comment-thread .feedback-resolve:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}@media(prefers-reduced-motion:reduce){.comment-thread .feedback-primary{transition:none}}@media(prefers-reduced-motion:reduce){.comment-box-saving{animation:none}}.comment-thread .feedback-preview{display:inline-flex;align-items:center;gap:6px;align-self:flex-start;min-height:40px;margin-left:36px;padding:5px 9px;border:1px solid var(--chisel-ui-border);border-radius:6px;background:var(--chisel-ui-raised);color:var(--chisel-ui-secondary);font-size:11px}.comment-thread .feedback-preview[aria-pressed=true]{border-color:var(--chisel-ui-focus);background:var(--chisel-ui-accent-surface)}.comment-thread .feedback-preview:disabled{opacity:.5;cursor:not-allowed}.feedback-proposal-actions{display:flex;align-items:center;flex-wrap:wrap;gap:4px;padding:0 12px 8px}.comment-thread .feedback-proposal-actions .feedback-preview{margin:0;padding:0 8px;border:0;border-radius:8px;background:transparent;font-size:12px;min-height:40px}.comment-thread .feedback-proposal-actions .feedback-preview:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.comment-thread .feedback-proposal-actions .feedback-preview[aria-pressed=true]{background:var(--chisel-ui-accent-surface);color:var(--chisel-ui-accent-text)}@media(pointer:coarse){.feedback-toolbar button{height:44px}.feedback-tabs button,.feedback-account summary{min-width:44px}.feedback-review-invite summary{min-height:44px}.feedback-pin:after{content:"";position:absolute;inset:-2px;border-radius:inherit}.feedback-account summary,.feedback-review-invite button,.feedback-shell .feedback-primary,.feedback-thread-status,.feedback-thread-status select{min-height:44px}.feedback-shell .comment-window-drag,.feedback-thread-header-actions .feedback-thread-close{width:44px;height:44px}.comment-box-footer{height:60px;min-height:60px}.comment-box-footer button{height:44px;width:44px}.comment-box-footer .comment-box-submit{width:44px}}@media(forced-colors:active){.feedback-sidebar-panel,.comment-box,.feedback-composer.comment-thread,.feedback-confirmation,.feedback-account>div{border:1px solid CanvasText;box-shadow:none;background:Canvas;color:CanvasText}.feedback-shell button[aria-pressed=true]{outline:1px solid Highlight;outline-offset:-2px}.feedback-shell input,.feedback-shell textarea,.comment-box-number,.feedback-avatar{border:1px solid CanvasText}}
4
+ `;function no(){return Dl("style",{children:Pl})}function nr(a){try{let t=new URL(a),r=/^\d+(?:\.\d+){3}$/.test(t.hostname)&&/^(0\.|10\.|127\.|169\.254\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(t.hostname);if(t.protocol!=="https:"||t.username||t.password||!t.hostname.includes(".")||r||/\.(localhost|local|internal)$/.test(t.hostname)||t.hostname.includes(":"))return null;let l=t.pathname.replace(/\/+$/,"");return t.pathname=l.endsWith("/chisel")?l:`${l}/chisel`,t.search="",t.hash="",t.toString()}catch{return null}}function fo(a,t){let r=new URL(a);r.search="",r.hash="",r.searchParams.set("mode","comment"),r.searchParams.set("path",t.path),r.searchParams.set("thread",t.id),r.searchParams.set("breakpoint",t.breakpoint??"desktop");let l=t.context?.width??{desktop:1440,tablet:768,mobile:390}[t.breakpoint??"desktop"];return r.searchParams.set("width",String(l)),r.toString()}function fr(a,t){return["# Website feedback for agents","Apply the requested changes in the source code. Preserve unrelated behavior. Verify each affected page and viewport.",...a.map((r,l)=>[`## ${l+1}. ${r.path} \xB7 ${r.breakpoint??"desktop"}`,`Thread: ${fo(t,r)}`,`Status: ${r.status??(r.resolved?"resolved":"open")}`,r.context?`Viewport: ${r.context.width} \xD7 ${r.context.height}px
5
5
  Captured: ${r.context.capturedAt}${r.context.deployment?`
6
6
  Deployment: ${r.context.deployment}`:""}`:"",r.selector?`Element: ${r.selector}`:"Page/area comment",r.area?`Area: ${JSON.stringify(r.area)}`:"",`${r.author}: ${r.text}`,...(r.replies??[]).map(d=>typeof d=="string"?d:`${d.author}: ${d.text}`),...(r.attachments??[]).map(d=>d.previewUrl?`![${d.name.replace(/[\[\]]/g,"")}](${d.previewUrl})`:`Attachment: ${d.name} (open the thread to view)`),...(r.changes??[]).map(d=>`${d.property}: ${JSON.stringify(d.before)} \u2192 ${JSON.stringify(d.after)}`)].filter(Boolean).join(`
7
7
 
8
8
  `))].join(`
9
9
 
10
- `)}function uo(a){try{let t=JSON.parse(localStorage.getItem(a)??"null");return t?.version===1&&Date.now()-t.time<7*864e5?t.value:null}catch{return null}}function va(a,t){try{return t===null?localStorage.removeItem(a):localStorage.setItem(a,JSON.stringify({version:1,time:Date.now(),value:t})),!0}catch{return!1}}async function ir(a){let t=a.defaultView;if(!t||a.documentElement.hasAttribute("data-chisel-private")||a.body?.hasAttribute("data-chisel-private"))return null;let r=t.innerWidth,l=t.innerHeight,d=t.scrollX,c=t.scrollY,{toBlob:n}=await import("html-to-image"),m=await n(a.documentElement,{width:r,height:l,pixelRatio:1,style:{transform:`translate(${-d}px, ${-c}px)`,transformOrigin:"top left"},filter:L=>!(L instanceof t.Element&&(L.matches('[data-chisel-root],script,input[type="password"],input[autocomplete^="cc-"],input[autocomplete="one-time-code"]')||L.closest("[data-chisel-root],[data-chisel-private]"))),imagePlaceholder:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1' height='1'/%3E"});return m&&m.size<=5*1024*1024?new File([m],`Page at ${r}px.png`,{type:"image/png"}):null}function Rt(a,t){if(t.type==="create")return t.comment;let r=a.find(l=>l.id===t.id);if(!r)throw new Error("This comment no longer exists. Reload and try again.");switch(t.type){case"edit":return{...r,text:t.text,changes:t.changes,...t.body===void 0?{}:{body:t.body}};case"edit_reply":return{...r,replies:r.replies.map(l=>typeof l!="string"&&l.id===t.replyId?{...l,text:t.text,body:t.body}:l)};case"resolve":return{...r,resolved:t.resolved,status:t.resolved?"resolved":"open"};case"status":return{...r,status:t.status,resolved:t.status==="resolved"};case"snapshot":return r;case"reply":return{...r,replies:[...r.replies,t.reply]}}}function Pa(a,t){return a.some(r=>r.id===t.id)?a.map(r=>r.id===t.id?t:r):[...a,t]}function Ft(a,t){return a.filter(r=>r.id!==t)}function Tt(a){let t=new Map;for(let r of[a,...a.replies]){if(typeof r=="string")continue;let l=r.authorId?`id:${r.authorId}`:`name:${r.author}`;t.has(l)||t.set(l,{author:r.author,authorImage:r.authorImage})}return[...t.values()]}function nr(a,t,r){let l=r.trim().toLocaleLowerCase();return a.filter(d=>(t==="all"||d.resolved===(t==="resolved"))&&(!l||[d.text,d.author,d.path,...(d.attachments??[]).map(c=>c.name),...d.replies.map(c=>typeof c=="string"?c:`${c.author} ${c.text}`)].some(c=>c.toLocaleLowerCase().includes(l))))}function fr(a,t=Date.now()){let r=Math.max(0,t-Date.parse(a));if(!Number.isFinite(r))return"";if(r<6e4)return"Just now";let[l,d]=r<36e5?["minute",6e4]:r<864e5?["hour",36e5]:["day",864e5];return new Intl.RelativeTimeFormat(void 0,{numeric:"always"}).format(-Math.floor(r/d),l)}import{Fragment as at,jsx as s,jsxs as f}from"react/jsx-runtime";var io="chisel-feedback-v1",qt=process.env.NODE_ENV!=="production",Ut=[{key:"desktop",label:"Desktop",width:1440,shortcut:"D",Icon:Xa},{key:"tablet",label:"Tablet",width:768,shortcut:"T",Icon:ja},{key:"mobile",label:"Mobile",width:390,shortcut:"M",Icon:Za}];function cr(a){let t=a.getBoundingClientRect(),r=a.closest(".feedback-preview-scroll"),l=r.getBoundingClientRect(),d=Math.max(0,l.left-t.left);return{left:d,width:Math.min(t.right,l.left+r.clientWidth)-t.left-d,height:Math.min(t.bottom,l.top+r.clientHeight)-t.top}}function pr(a,t){let r=`<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 40 40"><defs><filter id="shadow" x="-25%" y="-25%" width="150%" height="150%"><feDropShadow dx="0" dy="2" stdDeviation="2" flood-opacity=".16"/></filter></defs><path d="M4 20a16 16 0 1 1 16 16H4Z" fill="${a}" stroke="${t}" filter="url(#shadow)"/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(r)}") 3 3, crosshair`}function no(a){for(let r of["data-chisel-id","data-ai-edit","data-component","id"]){let l=a.getAttribute(r);if(l){let d=`[${r}="${CSS.escape(l)}"]`,c=a.ownerDocument.querySelectorAll(d);if(c.length===1&&c[0]===a)return d}}let t=a.parentElement;return t?`${no(t)} > :nth-child(${Array.from(t.children).indexOf(a)+1})`:a.tagName.toLowerCase()}function mr({user:a,validateSession:t,signOut:r,commentStore:l,canManageComments:d=!1,getReviewLink:c,collaboration:n,commentUI:m,projectId:L="local",manageReview:y,accountURL:B,agentURL:V,saveSnapshot:w,getAttachmentURL:N}){let{confirm:R,dialog:_}=ar(),C=z(null),[k,K]=S([]),[J,ae]=S(null),[h,b]=S(!1),[X,ne]=S(new Set),[I,H]=S(""),[pe,me]=S([]),Se=z(null),Da=z(null),Aa=z(!1),[tt,ga]=S(!1),Ie=`chisel:draft:${L}:${a.id}`,[Z,Ma]=S("/"),[ot,rt]=S(["/"]),[lt,dt]=S([]),[A,he]=S(qt?"edit":"comment"),[de,ye]=S(1440),[T,E]=S(!1),[W,be]=S(null),q=z(!1),[Ee,Ht]=S(3840),[La,fo]=S("desktop"),da=`${Ie}:${Z}:${La}`,Et=z(da);Et.current=da;let Ba=z(La),Ke=z(null),fe=z(A),Oe=z(null),co=z(null),Me=z(null),Be=z(!1),Ze=z(null),st=z(""),sa=z(!1),se=z(!1),xe=z(null),te=z(null),Ot=z(null),[Ra,zt]=S(null),[ge,po]=S(!1),[Ce,mo]=S(!1),ua=z(Ce);ua.current=Ce;let[Re,ia]=S(null),[ze,Ne]=S(null),ut=z(ze);ut.current=ze;let[U,Fe]=S(null),Nt=z(U),it=z(!1);Nt.current=U;let[xr,ke]=S(null),[ho,nt]=S(void 0),[G,gr]=S(null),[Lr,je]=S(null),[Fa,_e]=S(""),[Je,ce]=S(""),[oe,We]=S(null);le(()=>{We(null),se.current=!1},[ze]);let[Ta,Ir]=S("open"),[ft,br]=S(""),[ct,j]=S(""),[pt,mt]=S(!!l),[Te,ht]=S(!1),[Ge,xo]=S(null),[Wt,go]=S(null),[Lo,Cr]=S(""),[xt,Io]=S(!1),[bo,gt]=S(""),ve=z(!1),na=z(0),Ve=z(null),Co=z(!1),Gt=z(null),[qa,Vt]=S({x:0,y:0});st.current=Je,te.current||(te.current=rr(()=>{let e=document.activeElement,o=Oe.current?.contains(e)&&e?.matches('input,textarea,[contenteditable="true"]');!Ze.current||st.current.trim()||sa.current||se.current||o||yo()}));let i=k.find(e=>e.id===ze),qe=i?.resolved?"resolved":i?.status??"open",kr=qe==="ready"?"Ready":qe==="resolved"?"Resolved":"Open",ko=!l||d||i?.authorId===a.id,Xt=(Ge?.type==="status"||Ge?.type==="resolve")&&Ge.id===i?.id;function $t(){if(va(`${Et.current}:anchor`,null),va(`${Et.current}:body`,null),ut.current){let e=`${Ie}:reply:${ut.current}`;va(e,null);try{for(let o=localStorage.length-1;o>=0;o--){let u=localStorage.key(o);u?.startsWith(`${e}:edit:`)&&localStorage.removeItem(u)}}catch{}}}le(()=>{if(!G||Nt.current||fe.current!=="comment")return;let e=uo(`${da}:anchor`);e&&typeof e.text=="string"&&e.text.length<=4e3&&Number.isFinite(e.anchor?.x)&&Number.isFinite(e.anchor?.y)&&(_e(e.text),Fe(e.anchor),Ne(null),Ve.current=crypto.randomUUID(),H("Your unsent comment was restored."))},[da,G,A]),le(()=>{U&&!Re&&!va(`${da}:anchor`,Fa.trim()?{anchor:U,text:Fa}:null)&&Fa.trim()&&H("Your comment is still here, but this browser could not autosave it.")},[U,Fa,da,Re]),le(()=>{if(!U||Re||!w||!G||Se.current?.id===Ve.current)return;let e=G.defaultView;Se.current={id:Ve.current,context:{width:e.innerWidth,height:e.innerHeight,url:e.location.origin+e.location.pathname,capturedAt:new Date().toISOString(),...J?.round?{deployment:J.round.deployment}:{}},file:ir(G).catch(()=>null)}},[U,Re,w,G,J?.round]),le(()=>{try{ga(localStorage.getItem(`chisel:guide:${a.id}`)!=="1")}catch{}},[a.id]),le(()=>{if(!y)return;let e=!0;return y("get").then(o=>{e&&ae(o)}).catch(()=>{}),()=>{e=!1}},[y,k]);async function wr(e){let o=J?.reviewURL??sr(window.location.origin);if(!o){j("Open the deployed website\u2019s HTTPS /chisel page to share this comment. Localhost links cannot be shared with clients.");return}try{await navigator.clipboard.writeText(so(o,e)),H("Comment link copied. Recipients must have access to this review.")}catch{j("Could not copy the link. Check clipboard permission and try again.")}}async function Sr(){let e=k.filter(o=>X.has(o.id));if(e.length)try{let o=await Promise.all(e.map(async u=>({...u,attachments:await Promise.all((u.attachments??[]).map(async p=>({...p,previewUrl:N?await N(p.id).catch(()=>{}):p.previewUrl})))})));await navigator.clipboard.writeText(ur(o,J?.reviewURL??new URL("/chisel",window.location.origin).toString())),H(`Copied ${e.length} comment${e.length===1?"":"s"} for Codex. Private media links expire; the thread links remain available.`),b(!1),ne(new Set)}catch{j("Feedback could not be copied. Check clipboard permission and try again.")}}function wo(e){ne(o=>{let u=new Set(o);return u.has(e)?u.delete(e):u.add(e),u})}async function So(e=!1){if(!(!c||xt)){Io(!0),gt("");try{let o=await c(e);Cr(o);try{await navigator.clipboard.writeText(o),gt(e?"New link copied. The previous link no longer accepts new reviewers.":"Link copied. Your client can sign in with any Google account.")}catch{gt("Select and copy the review link below.")}}catch(o){gt(o instanceof Error?o.message:"The review link could not be created. Please try again.")}finally{Io(!1)}}}async function yo(){if((st.current.trim()||sa.current||se.current)&&!await ue()||(te.current?.cancel(),Ze.current=null,Be.current))return;Be.current=!0;let e=Oe.current?Bt(Oe.current,!0,Me.current):null;Me.current=e;let o=()=>{if(!Be.current||Me.current!==e)return;Be.current=!1,Ue(),Ne(null),ce("");let u=new URL(window.location.href);u.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",u)};e?e.finished.then(o,()=>{}):o()}function Kt(){te.current?.cancel(),Be.current&&(Be.current=!1,Me.current=Oe.current?Bt(Oe.current,!1,Me.current):null)}function Lt(){Me.current?.cancel(),Me.current=null,Be.current=!1,po(!0)}async function vo(e){if(!await ue()||ve.current)return;let o=null;try{o=e.selector?G?.querySelector(e.selector)??null:null}catch{}if(!o){j("This element is no longer on the page. Its changes cannot be edited.");return}Ue(),te.current?.cancel(),ce(""),xe.current=null,ia(e.id),_e(e.text),Fe(e)}function Po(e){te.current?.cancel(),!(U||e.path!==Z||(Je.trim()||sa.current||se.current)&&ze!==e.id)&&(i&&ge||(Ze.current=e.id,Ua(e,!0)))}function Ue(){Ot.current?.(),Ot.current=null,zt(null)}async function ue(){return ve.current?!1:!(Nt.current&&it.current)&&!st.current.trim()&&!sa.current&&!se.current?!0:await R({title:"Discard this draft?",description:"Your comment and unsaved preview changes will be discarded.",action:"Discard draft",danger:!0})?($t(),!0):!1}function It(){let e=C.current?.closest(".feedback-preview-scroll");return Math.max(320,Math.min(3840,e?e.clientWidth-24:3840))}async function Xe(e,o=!1){o&&(e=Math.max(320,Math.min(It(),e)));let u=oo(e),p=Ba.current;if(u!==p){if(!await ue())return!1;te.current?.cancel(),Ze.current=null,Ue(),Fe(null),ia(null),Ne(null),ke(null),je(null),_e(""),ce(""),Ve.current=null,xe.current=null,it.current=!1,sa.current=!1,C.current?.contentDocument&&delete C.current.contentDocument.documentElement.dataset.chiselSelection,Ba.current=u,fo(u)}if(o&&e>It())return Xe(e,!0);E(o),ye(e);let P=new URL(window.location.href);return P.searchParams.set("width",String(e)),P.searchParams.set("breakpoint",u),u!==p&&P.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",P),!0}async function yr(e){if(q.current)return;let o=Number(e);if(!e.trim()||!Number.isFinite(o)||Math.round(o)===de){be(null);return}q.current=!0;try{await Xe(Math.round(o),!0)}finally{q.current=!1,be(null)}}function vr(e,o){if(!e.isPrimary||e.button!==0||ve.current||Ke.current)return;e.preventDefault(),e.currentTarget.focus({preventScroll:!0});let u=e.currentTarget.parentElement,p=u.offsetWidth,P=u.parentElement.clientWidth-24;Ke.current={id:e.pointerId,x:e.clientX,width:p,next:p,direction:o,factor:p<=P?2:1,raf:null},e.currentTarget.setPointerCapture(e.pointerId)}function Pr(e){let o=Ke.current;!o||o.id!==e.pointerId||(o.next=Math.max(320,Math.min(Ee,Math.round(o.width+(e.clientX-o.x)*o.direction*o.factor))),o.raf===null&&(o.raf=requestAnimationFrame(()=>{o.raf=null,ye(o.next)})))}async function bt(e=!1){let o=Ke.current;o&&(Ke.current=null,o.raf!==null&&cancelAnimationFrame(o.raf),(e||!await Xe(o.next,!0))&&ye(o.width))}le(()=>()=>{Ke.current?.raf!=null&&cancelAnimationFrame(Ke.current.raf)},[]),et(()=>{let e=C.current?.closest(".feedback-preview-scroll");if(!e)return;let o=new URLSearchParams(window.location.search),u=Number(o.get("width")),p=Number.isInteger(u)&&u>=320&&u<=3840,P=Ut.find(Y=>Y.key===o.get("breakpoint")),D=p?u:P?.width??Math.min(1440,It());ye(D),E(!p&&!P);let M=oo(D);fo(M),Ba.current=M;let $=()=>Ht(It());$();let we=new ResizeObserver($);return we.observe(e),()=>we.disconnect()},[]),le(()=>{T&&de>Ee&&!Ke.current&&Xe(Ee,!0)},[T,de,Ee]);async function Ct(e){if(e===fe.current||!await ue())return;te.current?.cancel(),Ze.current=null,Ue(),he(e),fe.current=e,Fe(null),ia(null),ke(null),e==="comment"&&mo(!1);let o=C.current?.contentDocument;o?.documentElement&&(o.documentElement.dataset.chiselMode=e,C.current?.contentWindow?.dispatchEvent(new Event("chisel:mode")));let u=new URL(window.location.href);u.searchParams.set("mode",e),window.history.replaceState(window.history.state,"",u)}function Dr(){let e=C.current?.contentDocument;if(!e)return;let o=Array.from(e.querySelectorAll("a[href]:not([download])"),u=>xa(u.href,window.location.origin));dt([...new Set(o.filter(u=>u!==null))])}async function Ar(e){let o=xa(e,window.location.origin,Z);if(!o)throw new Error("Enter a page path or URL from this site.");if(o===Z)return!0;if(!await ue())return!1;let u=C.current?.contentWindow;return u?(te.current?.cancel(),Ze.current=null,Ue(),Fe(null),ia(null),Ne(null),ke(null),je(null),_e(""),ce(""),Ve.current=null,xe.current=null,it.current=!1,sa.current=!1,u.location.assign(o),!0):!1}function Le(e){if(e.area){let p=ro(e.area,G,qa);return{rect:void 0,x:p.left,y:p.top}}let o=null;try{o=e.selector?G?.querySelector(e.selector)??null:null}catch{}let u=o?.getBoundingClientRect();return{rect:u,x:u?u.left+u.width*(e.offsetX??0):e.x-qa.x,y:u?u.top+u.height*(e.offsetY??0):e.y-qa.y}}async function Ua(e,o=!1){let u=xa(e.path,window.location.origin);if(!u){j("This comment's page cannot be opened in the preview.");return}if(!o&&!await ue())return;let p=e.breakpoint??"desktop",P=p!==Ba.current&&Qa(p,Ba.current);if(!o&&e.context&&!P&&await Xe(e.context.width),!o){let $=new URL(window.location.href);$.searchParams.set("thread",e.id),window.history.replaceState(window.history.state,"",$)}if(Kt(),o||n?.markRead(e.id),o||(Lt(),Ze.current=null,ce(uo(`${Ie}:reply:${e.id}`)?.text??"")),ze===e.id&&Z===e.path)return;po(!o),Ue(),Ne(e.id),Fe(null),ke(null),je(e),o&&ce(""),xe.current=null;let D=C.current?.contentDocument;if(D?.documentElement&&e.selector&&(D.documentElement.dataset.chiselSelection=e.selector),Z!==u){C.current?.contentWindow?.location.assign(u);return}let M=Le(e);if(!o){let $=C.current?.closest(".feedback-preview-scroll");$?.scrollTo({left:Math.max(0,M.x+12-$.clientWidth/2)}),C.current?.contentWindow?.scrollTo({top:Math.max(0,M.y+qa.y-180),behavior:"smooth"})}}async function He(e,o=[]){if(ve.current)return!1;ve.current=!0,ht(!0),xo(e),++na.current;let u=e.type==="create"?e.comment.id:e.id,p=k.find(D=>D.id===u),P=!1;try{if((e.type==="status"||e.type==="resolve")&&(K(M=>Pa(M,Rt(M,e))),j(""),P=!0),e.type==="create"||e.type==="reply"){let M=e.type==="create"?{...e.comment,body:e.body,attachments:o,pending:!0}:Rt(k,{...e,reply:{...e.reply,body:e.body,attachments:o,date:new Date().toISOString(),pending:!0}});K($=>Pa($,M)),mt(!1),j(""),P=!0}if(!await t())throw new Error("Your session has expired. Reload this page to sign in again.");let D=l?await l.mutate(e):Rt(k,e);if(++na.current,l||localStorage.setItem(io,JSON.stringify(Pa(k,D))),K(M=>Pa(M,D)),mt(!1),j(""),e.type==="create"){$t();let M=Se.current;w&&M?.id===e.comment.id&&M.file.then(async $=>{if(!$){H("Comment saved. This page could not be captured; you can attach an image manually.");return}try{await w(D.id,$)}catch{me(we=>[...we.filter(Y=>Y.id!==D.id),{id:D.id,file:$}])}})}return e.type==="reply"&&va(`${Ie}:reply:${e.id}`,null),!0}catch(D){return P&&K(M=>p?Pa(M,p):Ft(M,u)),j(D instanceof Error?D.message:"Your comment could not be saved. Your draft is still here; please try again."),!1}finally{ve.current=!1,ht(!1),xo(null)}}async function Mr(e){if(!(ve.current||!await R({title:"Delete this comment?",description:"The comment and all its replies will be permanently deleted.",action:"Delete comment",danger:!0}))){ve.current=!0,ht(!0),go(e.id),j(""),++na.current;try{if(!await t()){j("Your session has expired. Reload this page to sign in again.");return}if(l){if(!l.delete)throw new Error("Comment deletion is unavailable");await l.delete(e.id)}else localStorage.setItem(io,JSON.stringify(Ft(k,e.id)));++na.current,ut.current===e.id&&(Ue(),Ne(null),ce(""),je(null)),K(o=>Ft(o,e.id)),j("")}catch{j("The comment could not be deleted. Please try again.")}finally{ve.current=!1,ht(!1),go(null)}}}function Zt(){let e=C.current?.contentDocument,o=C.current?.contentWindow;if(!e?.documentElement||!o)return;let u=eo(o);if(u===null||e===Gt.current)return;if(Gt.current=null,!Co.current){Co.current=!0;let x=new URLSearchParams(window.location.search);if(Da.current=x.get("thread"),!l)try{let re=JSON.parse(localStorage.getItem(io)||"[]");if(!Array.isArray(re)||re.some(Q=>typeof Q.id!="string"||typeof Q.text!="string"||!Array.isArray(Q.replies)))throw Error();K(re)}catch{j("Saved comments could not be loaded.")}let v=new URLSearchParams(window.location.search).get("mode"),F=v==="browse"?"view":v;F&&["edit","comment","view"].includes(F)&&(F!=="edit"||qt)&&(he(F),fe.current=F);let ee=new URLSearchParams(window.location.search).get("path");if(ee){let re=xa(ee,window.location.origin);if(!re)j("That preview page is invalid. Enter a URL from this site.");else if(re!==u){if(re.split("#")[0]!==u.split("#")[0]){Gt.current=e,o.location.replace(re);return}o.location.replace(re),u=re}}}if(Ma(u),gr(e),!o.chiselReady){e.addEventListener("chisel:ready",Zt,{once:!0});return}let p=e.documentElement;if(p.dataset.feedbackBound)return;p.dataset.feedbackBound="true";let P=e.createElement("style");P.textContent=`
11
- html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${pr("#ffffff","#e2e2e2")};cursor:var(--chisel-comment-cursor) !important; }
10
+ `)}function co(a){try{let t=JSON.parse(localStorage.getItem(a)??"null");return t?.version===1&&Date.now()-t.time<7*864e5?t.value:null}catch{return null}}function Ra(a,t){try{return t===null?localStorage.removeItem(a):localStorage.setItem(a,JSON.stringify({version:1,time:Date.now(),value:t})),!0}catch{return!1}}async function cr(a){let t=a.defaultView;if(!t||a.documentElement.hasAttribute("data-chisel-private")||a.body?.hasAttribute("data-chisel-private"))return null;let r=t.innerWidth,l=t.innerHeight,d=t.scrollX,p=t.scrollY,{toBlob:n}=await import("html-to-image"),m=await n(a.documentElement,{width:r,height:l,pixelRatio:1,style:{transform:`translate(${-d}px, ${-p}px)`,transformOrigin:"top left"},filter:L=>!(L instanceof t.Element&&(L.matches('[data-chisel-root],script,input[type="password"],input[autocomplete^="cc-"],input[autocomplete="one-time-code"]')||L.closest("[data-chisel-root],[data-chisel-private]"))),imagePlaceholder:"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1' height='1'/%3E"});return m&&m.size<=5*1024*1024?new File([m],`Page at ${r}px.png`,{type:"image/png"}):null}function Ca(a,t){if(t.type==="create")return t.comment;let r=a.find(l=>l.id===t.id);if(!r)throw new Error("This comment no longer exists. Reload and try again.");switch(t.type){case"edit":return{...r,text:t.text,changes:t.changes,...t.body===void 0?{}:{body:t.body}};case"edit_reply":return{...r,replies:r.replies.map(l=>typeof l!="string"&&l.id===t.replyId?{...l,text:t.text,body:t.body}:l)};case"resolve":return{...r,resolved:t.resolved,status:t.resolved?"resolved":"open"};case"status":return{...r,status:t.status,resolved:t.status==="resolved"};case"snapshot":return r;case"reply":return{...r,replies:[...r.replies,t.reply]}}}function _e(a,t){return a.some(r=>r.id===t.id)?a.map(r=>r.id===t.id?t:r):[...a,t]}function Ht(a,t){return a.filter(r=>r.id!==t)}function Et(a){let t=new Map;for(let r of[a,...a.replies]){if(typeof r=="string")continue;let l=r.authorId?`id:${r.authorId}`:`name:${r.author}`;t.has(l)||t.set(l,{author:r.author,authorImage:r.authorImage})}return[...t.values()]}function pr(a,t,r){let l=r.trim().toLocaleLowerCase();return a.filter(d=>(t==="all"||d.resolved===(t==="resolved"))&&(!l||[d.text,d.author,d.path,...(d.attachments??[]).map(p=>p.name),...d.replies.map(p=>typeof p=="string"?p:`${p.author} ${p.text}`)].some(p=>p.toLocaleLowerCase().includes(l))))}function mr(a,t=Date.now()){let r=Math.max(0,t-Date.parse(a));if(!Number.isFinite(r))return"";if(r<6e4)return"Just now";let[l,d]=r<36e5?["minute",6e4]:r<864e5?["hour",36e5]:["day",864e5];return new Intl.RelativeTimeFormat(void 0,{numeric:"always"}).format(-Math.floor(r/d),l)}import{Fragment as lt,jsx as s,jsxs as c}from"react/jsx-runtime";var Ot="chisel-feedback-v1",zt=process.env.NODE_ENV!=="production",Nt=[{key:"desktop",label:"Desktop",width:1440,shortcut:"D",Icon:ja},{key:"tablet",label:"Tablet",width:768,shortcut:"T",Icon:Qa},{key:"mobile",label:"Mobile",width:390,shortcut:"M",Icon:Ya}];function hr(a){let t=a.getBoundingClientRect(),r=a.closest(".feedback-preview-scroll"),l=r.getBoundingClientRect(),d=Math.max(0,l.left-t.left);return{left:d,width:Math.min(t.right,l.left+r.clientWidth)-t.left-d,height:Math.min(t.bottom,l.top+r.clientHeight)-t.top}}function xr(a,t){let r=`<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" viewBox="0 0 40 40"><defs><filter id="shadow" x="-25%" y="-25%" width="150%" height="150%"><feDropShadow dx="0" dy="2" stdDeviation="2" flood-opacity=".16"/></filter></defs><path d="M4 20a16 16 0 1 1 16 16H4Z" fill="${a}" stroke="${t}" filter="url(#shadow)"/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(r)}") 3 3, crosshair`}function po(a){for(let r of["data-chisel-id","data-ai-edit","data-component","id"]){let l=a.getAttribute(r);if(l){let d=`[${r}="${CSS.escape(l)}"]`,p=a.ownerDocument.querySelectorAll(d);if(p.length===1&&p[0]===a)return d}}let t=a.parentElement;return t?`${po(t)} > :nth-child(${Array.from(t.children).indexOf(a)+1})`:a.tagName.toLowerCase()}function gr({user:a,validateSession:t,signOut:r,commentStore:l,canManageComments:d=!1,getReviewLink:p,collaboration:n,commentUI:m,projectId:L="local",manageReview:v,accountURL:M,agentURL:G,saveSnapshot:S,getAttachmentURL:z}){let{confirm:B,dialog:_}=rr(),w=O(null),[C,V]=y([]),[J,ae]=y(null),[h,b]=y(!1),[X,ne]=y(new Set),[I,U]=y(""),[xe,ge]=y([]),Pe=O(null),Fa=O(null),Ta=O(!1),[dt,ka]=y(!1),ke=`chisel:draft:${L}:${a.id}`,[j,qa]=y("/"),[st,ut]=y(["/"]),[it,nt]=y([]),[A,Le]=y(zt?"edit":"comment"),[de,De]=y(1440),[T,H]=y(!1),[N,we]=y(null),q=O(!1),[Ne,Wt]=y(3840),[wa,mo]=y("desktop"),ia=`${ke}:${j}:${wa}`,Gt=O(ia);Gt.current=ia;let Ua=O(wa),Je=O(null),ce=O(A),We=O(null),ho=O(null),Re=O(null),Fe=O(!1),Ge=O(null),ft=O(""),na=O(!1),se=O(!1),Ie=O(null),te=O(null),Vt=O(null),[Ha,Xt]=y(null),[be,xo]=y(!1),[Se,go]=y(!1),fa=O(Se);fa.current=Se;let[ye,ca]=y(null),[Ve,Te]=y(null),ct=O(Ve);ct.current=Ve;let[$,qe]=y(null),$t=O($),pt=O(!1);$t.current=$;let[Ir,ve]=y(null),[Lo,mt]=y(void 0),[W,br]=y(null),[Cr,Ye]=y(null),[Ea,Qe]=y(""),[ea,pe]=y(""),[oe,Xe]=y(null);le(()=>{Xe(null),se.current=!1},[Ve]);let[Oa,kr]=y("open"),[ht,wr]=y(""),[xt,Z]=y(""),[gt,Lt]=y(!!l),[Ue,Sa]=y(!1),[me,It]=y(null),$e=O(null),[Kt,Io]=y(null),[bo,Sr]=y(""),[bt,Co]=y(!1),[ko,Ct]=y(""),fe=O(!1),He=O(0),Ke=O(null),wo=O(!1),Zt=O(null),[za,jt]=y({x:0,y:0});ft.current=ea,te.current||(te.current=sr(()=>{let e=document.activeElement,o=We.current?.contains(e)&&e?.matches('input,textarea,[contenteditable="true"]');!Ge.current||ft.current.trim()||na.current||se.current||o||Do()}));let i=C.find(e=>e.id===Ve),Ee=i?.resolved?"resolved":i?.status??"open",yr=Ee==="ready"?"Ready":Ee==="resolved"?"Resolved":"Open",So=!l||d||i?.authorId===a.id,kt=(me?.type==="status"||me?.type==="resolve")&&me.id===i?.id,yo=me?.type==="create",pa=yo?null:$;function _t(e=ct.current){if(Ra(`${Gt.current}:anchor`,null),Ra(`${Gt.current}:body`,null),e){let o=`${ke}:reply:${e}`;Ra(o,null);try{for(let u=localStorage.length-1;u>=0;u--){let f=localStorage.key(u);f?.startsWith(`${o}:edit:`)&&localStorage.removeItem(f)}}catch{}}}le(()=>{if(!W||$t.current||ce.current!=="comment")return;let e=co(`${ia}:anchor`);e&&typeof e.text=="string"&&e.text.length<=4e3&&Number.isFinite(e.anchor?.x)&&Number.isFinite(e.anchor?.y)&&(Qe(e.text),qe(e.anchor),Te(null),Ke.current=crypto.randomUUID(),U("Your unsent comment was restored."))},[ia,W,A]),le(()=>{$&&!ye&&!Ra(`${ia}:anchor`,Ea.trim()?{anchor:$,text:Ea}:null)&&Ea.trim()&&U("Your comment is still here, but this browser could not autosave it.")},[$,Ea,ia,ye]),le(()=>{if(!$||ye||!S||!W||Pe.current?.id===Ke.current)return;let e=W.defaultView;Pe.current={id:Ke.current,context:{width:e.innerWidth,height:e.innerHeight,url:e.location.origin+e.location.pathname,capturedAt:new Date().toISOString(),...J?.round?{deployment:J.round.deployment}:{}},file:cr(W).catch(()=>null)}},[$,ye,S,W,J?.round]),le(()=>{try{ka(localStorage.getItem(`chisel:guide:${a.id}`)!=="1")}catch{}},[a.id]),le(()=>{if(!v)return;let e=!0;return v("get").then(o=>{e&&ae(o)}).catch(()=>{}),()=>{e=!1}},[v,C]);async function vr(e){let o=J?.reviewURL??nr(window.location.origin);if(!o){Z("Open the deployed website\u2019s HTTPS /chisel page to share this comment. Localhost links cannot be shared with clients.");return}try{await navigator.clipboard.writeText(fo(o,e)),U("Comment link copied. Recipients must have access to this review.")}catch{Z("Could not copy the link. Check clipboard permission and try again.")}}async function Pr(){let e=C.filter(o=>X.has(o.id));if(e.length)try{let o=await Promise.all(e.map(async u=>({...u,attachments:await Promise.all((u.attachments??[]).map(async f=>({...f,previewUrl:z?await z(f.id).catch(()=>{}):f.previewUrl})))})));await navigator.clipboard.writeText(fr(o,J?.reviewURL??new URL("/chisel",window.location.origin).toString())),U(`Copied ${e.length} comment${e.length===1?"":"s"} for agents. Private media links expire; the thread links remain available.`),b(!1),ne(new Set)}catch{Z("Feedback could not be copied. Check clipboard permission and try again.")}}function vo(e){ne(o=>{let u=new Set(o);return u.has(e)?u.delete(e):u.add(e),u})}async function Po(e=!1){if(!(!p||bt)){Co(!0),Ct("");try{let o=await p(e);Sr(o);try{await navigator.clipboard.writeText(o),Ct(e?"New link copied. The previous link no longer accepts new reviewers.":"Link copied. Your client can sign in with any Google account.")}catch{Ct("Select and copy the review link below.")}}catch(o){Ct(o instanceof Error?o.message:"The review link could not be created. Please try again.")}finally{Co(!1)}}}async function Do(){if((ft.current.trim()||na.current||se.current)&&!await ue()||(te.current?.cancel(),Ge.current=null,Fe.current))return;Fe.current=!0;let e=We.current?Ut(We.current,!0,Re.current):null;Re.current=e;let o=()=>{if(!Fe.current||Re.current!==e)return;Fe.current=!1,Oe(),Te(null),pe("");let u=new URL(window.location.href);u.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",u)};e?e.finished.then(o,()=>{}):o()}function Jt(){te.current?.cancel(),Fe.current&&(Fe.current=!1,Re.current=We.current?Ut(We.current,!1,Re.current):null)}function wt(){Re.current?.cancel(),Re.current=null,Fe.current=!1,xo(!0)}async function Ao(e){if(!await ue()||fe.current)return;let o=null;try{o=e.selector?W?.querySelector(e.selector)??null:null}catch{}if(!o){Z("This element is no longer on the page. Its changes cannot be edited.");return}Oe(),te.current?.cancel(),pe(""),Ie.current=null,ca(e.id),Qe(e.text),qe(e)}function Mo(e){te.current?.cancel(),!(pa||e.path!==j||(ea.trim()||na.current||se.current)&&Ve!==e.id)&&(i&&be||(Ge.current=e.id,Na(e,!0)))}function Oe(){Vt.current?.(),Vt.current=null,Xt(null)}async function ue(){return fe.current?!1:!($t.current&&pt.current)&&!ft.current.trim()&&!na.current&&!se.current?!0:await B({title:"Discard this draft?",description:"Your comment and unsaved preview changes will be discarded.",action:"Discard draft",danger:!0})?(_t(),!0):!1}function St(){let e=w.current?.closest(".feedback-preview-scroll");return Math.max(320,Math.min(3840,e?e.clientWidth-24:3840))}async function Ze(e,o=!1){o&&(e=Math.max(320,Math.min(St(),e)));let u=uo(e),f=Ua.current;if(u!==f){if(!await ue())return!1;te.current?.cancel(),Ge.current=null,Oe(),qe(null),ca(null),Te(null),ve(null),Ye(null),Qe(""),pe(""),Ke.current=null,Ie.current=null,pt.current=!1,na.current=!1,w.current?.contentDocument&&delete w.current.contentDocument.documentElement.dataset.chiselSelection,Ua.current=u,mo(u)}if(o&&e>St())return Ze(e,!0);H(o),De(e);let k=new URL(window.location.href);return k.searchParams.set("width",String(e)),k.searchParams.set("breakpoint",u),u!==f&&k.searchParams.delete("thread"),window.history.replaceState(window.history.state,"",k),!0}async function Dr(e){if(q.current)return;let o=Number(e);if(!e.trim()||!Number.isFinite(o)||Math.round(o)===de){we(null);return}q.current=!0;try{await Ze(Math.round(o),!0)}finally{q.current=!1,we(null)}}function Ar(e,o){if(!e.isPrimary||e.button!==0||fe.current||Je.current)return;e.preventDefault(),e.currentTarget.focus({preventScroll:!0});let u=e.currentTarget.parentElement,f=u.offsetWidth,k=u.parentElement.clientWidth-24;Je.current={id:e.pointerId,x:e.clientX,width:f,next:f,direction:o,factor:f<=k?2:1,raf:null},e.currentTarget.setPointerCapture(e.pointerId)}function Mr(e){let o=Je.current;!o||o.id!==e.pointerId||(o.next=Math.max(320,Math.min(Ne,Math.round(o.width+(e.clientX-o.x)*o.direction*o.factor))),o.raf===null&&(o.raf=requestAnimationFrame(()=>{o.raf=null,De(o.next)})))}async function yt(e=!1){let o=Je.current;o&&(Je.current=null,o.raf!==null&&cancelAnimationFrame(o.raf),(e||!await Ze(o.next,!0))&&De(o.width))}le(()=>()=>{Je.current?.raf!=null&&cancelAnimationFrame(Je.current.raf)},[]),rt(()=>{let e=w.current?.closest(".feedback-preview-scroll");if(!e)return;let o=new URLSearchParams(window.location.search),u=Number(o.get("width")),f=Number.isInteger(u)&&u>=320&&u<=3840,k=Nt.find(Y=>Y.key===o.get("breakpoint")),D=f?u:k?.width??Math.min(1440,St());De(D),H(!f&&!k);let F=uo(D);mo(F),Ua.current=F;let K=()=>Wt(St());K();let he=new ResizeObserver(K);return he.observe(e),()=>he.disconnect()},[]),le(()=>{T&&de>Ne&&!Je.current&&Ze(Ne,!0)},[T,de,Ne]);async function vt(e){if(e===ce.current||!await ue())return;te.current?.cancel(),Ge.current=null,Oe(),Le(e),ce.current=e,qe(null),ca(null),ve(null),e==="comment"&&go(!1);let o=w.current?.contentDocument;o?.documentElement&&(o.documentElement.dataset.chiselMode=e,w.current?.contentWindow?.dispatchEvent(new Event("chisel:mode")));let u=new URL(window.location.href);u.searchParams.set("mode",e),window.history.replaceState(window.history.state,"",u)}function Br(){let e=w.current?.contentDocument;if(!e)return;let o=Array.from(e.querySelectorAll("a[href]:not([download])"),u=>ba(u.href,window.location.origin));nt([...new Set(o.filter(u=>u!==null))])}async function Rr(e){let o=ba(e,window.location.origin,j);if(!o)throw new Error("Enter a page path or URL from this site.");if(o===j)return!0;if(!await ue())return!1;let u=w.current?.contentWindow;return u?(te.current?.cancel(),Ge.current=null,Oe(),qe(null),ca(null),Te(null),ve(null),Ye(null),Qe(""),pe(""),Ke.current=null,Ie.current=null,pt.current=!1,na.current=!1,u.location.assign(o),!0):!1}function Ce(e){if(e.area){let f=io(e.area,W,za);return{rect:void 0,x:f.left,y:f.top}}let o=null;try{o=e.selector?W?.querySelector(e.selector)??null:null}catch{}let u=o?.getBoundingClientRect();return{rect:u,x:u?u.left+u.width*(e.offsetX??0):e.x-za.x,y:u?u.top+u.height*(e.offsetY??0):e.y-za.y}}async function Na(e,o=!1){let u=ba(e.path,window.location.origin);if(!u){Z("This comment's page cannot be opened in the preview.");return}if(!o&&!await ue())return;let f=e.breakpoint??"desktop",k=f!==Ua.current&&ot(f,Ua.current);if(!o&&e.context&&!k&&await Ze(e.context.width),!o){let K=new URL(window.location.href);K.searchParams.set("thread",e.id),window.history.replaceState(window.history.state,"",K)}if(Jt(),o||n?.markRead(e.id),o||(wt(),Ge.current=null,pe(co(`${ke}:reply:${e.id}`)?.text??"")),Ve===e.id&&j===e.path)return;xo(!o),Oe(),Te(e.id),(!o||!yo)&&qe(null),ve(null),Ye(e),o&&pe(""),Ie.current=null;let D=w.current?.contentDocument;if(D?.documentElement&&e.selector&&(D.documentElement.dataset.chiselSelection=e.selector),j!==u){w.current?.contentWindow?.location.assign(u);return}let F=Ce(e);if(!o){let K=w.current?.closest(".feedback-preview-scroll");K?.scrollTo({left:Math.max(0,F.x+12-K.clientWidth/2)}),w.current?.contentWindow?.scrollTo({top:Math.max(0,F.y+za.y-180),behavior:"smooth"})}}async function Fr(e){if(fe.current&&$e.current?.id!==e.id)return!1;let o=C.find(f=>f.id===e.id);if(!o)return!1;let u=o;if($e.current=e,V(f=>_e(f,Ca(f,e))),It(e),Z(""),fe.current)return!0;fe.current=!0,Sa(!0),++He.current;try{for(;$e.current;){let f=$e.current;if(!await t())throw new Error("Your session has expired. Reload this page to sign in again.");let k=l?await l.mutate(f):Ca([u],f);++He.current,l||localStorage.setItem(Ot,JSON.stringify(_e(C,k))),u=k,$e.current===f&&($e.current=null);let D=$e.current?Ca([k],$e.current):k;V(F=>_e(F,D))}return!0}catch(f){let k=u;return V(D=>_e(D,k)),Z(f instanceof Error?f.message:"The status could not be saved. Please try again."),!1}finally{++He.current,$e.current=null,fe.current=!1,Sa(!1),It(null)}}async function ze(e,o=[]){if(e.type==="status"||e.type==="resolve")return Fr(e);if(fe.current)return!1;fe.current=!0,Sa(!0),It(e),++He.current;let u=e.type==="create"?e.comment.id:e.id,f=C.find(D=>D.id===u),k=!1;try{let D=e.type==="create"?{...e.comment,body:e.body,attachments:o,pending:!0}:e.type==="reply"?Ca(C,{...e,reply:{...e.reply,body:e.body,attachments:o,date:new Date().toISOString(),pending:!0}}):{...Ca(C,e),...e.type==="edit"&&o.length?{attachments:[...f?.attachments??[],...o]}:{}};if(V(K=>_e(K,D)),Lt(!1),Z(""),k=!0,!await t())throw new Error("Your session has expired. Reload this page to sign in again.");let F=l?await l.mutate(e):Ca(C,e);if(++He.current,l||localStorage.setItem(Ot,JSON.stringify(_e(C,F))),V(K=>_e(K,F)),Lt(!1),Z(""),e.type==="create"){_t(null);let K=Pe.current;S&&K?.id===e.comment.id&&K.file.then(async he=>{if(!he){U("Comment saved. This page could not be captured; you can attach an image manually.");return}try{await S(F.id,he)}catch{ge(Y=>[...Y.filter(ma=>ma.id!==F.id),{id:F.id,file:he}])}})}return e.type==="reply"&&Ra(`${ke}:reply:${e.id}`,null),!0}catch(D){return k&&V(F=>f?_e(F,f):Ht(F,u)),e.type==="create"&&(Ge.current=null,Te(null)),Z(D instanceof Error?D.message:"Your comment could not be saved. Your draft is still here; please try again."),!1}finally{fe.current=!1,Sa(!1),It(null)}}async function Tr(e){if(!(fe.current||!await B({title:"Delete this comment?",description:"The comment and all its replies will be permanently deleted.",action:"Delete comment",danger:!0}))){fe.current=!0,Sa(!0),Io(e.id),Z(""),++He.current;try{if(!await t()){Z("Your session has expired. Reload this page to sign in again.");return}if(l){if(!l.delete)throw new Error("Comment deletion is unavailable");await l.delete(e.id)}else localStorage.setItem(Ot,JSON.stringify(Ht(C,e.id)));++He.current,ct.current===e.id&&(Oe(),Te(null),pe(""),Ye(null)),V(o=>Ht(o,e.id)),Z("")}catch{Z("The comment could not be deleted. Please try again.")}finally{fe.current=!1,Sa(!1),Io(null)}}}function Yt(){let e=w.current?.contentDocument,o=w.current?.contentWindow;if(!e?.documentElement||!o)return;let u=ro(o);if(u===null||e===Zt.current)return;if(Zt.current=null,!wo.current){wo.current=!0;let x=new URLSearchParams(window.location.search);if(Fa.current=x.get("thread"),!l)try{let re=JSON.parse(localStorage.getItem(Ot)||"[]");if(!Array.isArray(re)||re.some(Q=>typeof Q.id!="string"||typeof Q.text!="string"||!Array.isArray(Q.replies)))throw Error();V(re)}catch{Z("Saved comments could not be loaded.")}let P=new URLSearchParams(window.location.search).get("mode"),R=P==="browse"?"view":P;R&&["edit","comment","view"].includes(R)&&(R!=="edit"||zt)&&(Le(R),ce.current=R);let ee=new URLSearchParams(window.location.search).get("path");if(ee){let re=ba(ee,window.location.origin);if(!re)Z("That preview page is invalid. Enter a URL from this site.");else if(re!==u){if(re.split("#")[0]!==u.split("#")[0]){Zt.current=e,o.location.replace(re);return}o.location.replace(re),u=re}}}if(qa(u),br(e),!o.chiselReady){e.addEventListener("chisel:ready",Yt,{once:!0});return}let f=e.documentElement;if(f.dataset.feedbackBound)return;f.dataset.feedbackBound="true";let k=e.createElement("style");k.textContent=`
11
+ html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${xr("#ffffff","#e2e2e2")};cursor:var(--chisel-comment-cursor) !important; }
12
12
  html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) :not([data-chisel-root], [data-chisel-root] *) { cursor:var(--chisel-comment-cursor) !important; }
13
13
  html[data-chisel-mode="comment"] [data-chisel-root] { cursor:auto; }
14
14
  html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) :not([data-chisel-root], [data-chisel-root] *) { user-select:none !important; -webkit-user-select:none !important; }
15
15
  @media(prefers-color-scheme:dark) {
16
- html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${pr("#222222","#3c3c3c")}; }
16
+ html[data-chisel-mode="comment"]:not([data-chisel-comments-hidden="true"]) { --chisel-comment-cursor:${xr("#222222","#3c3c3c")}; }
17
17
  }
18
18
  html[data-chisel-mode="edit"] .chisel-panel-inner { border-radius:0;box-shadow:none; }
19
19
  @media(min-width:761px) {
@@ -24,7 +24,7 @@ Deployment: ${r.context.deployment}`:""}`:"",r.selector?`Element: ${r.selector}`
24
24
  @media(max-width:760px) {
25
25
  html[data-chisel-mode="edit"] .chisel-panel { left:0;right:0;bottom:0; }
26
26
  }
27
- `,e.head.append(P),p.dataset.chiselMode=fe.current,p.dataset.chiselCommentsHidden=String(ua.current),o.dispatchEvent(new Event("chisel:mode")),o.addEventListener("chisel:selection",x=>{let v=x.detail;je(v),v.selector&&(p.dataset.chiselSelection=v.selector)});let D=()=>Vt({x:o.scrollX,y:o.scrollY});D(),o.addEventListener("scroll",D),o.addEventListener("resize",()=>{ke(null),D()}),e.addEventListener("scroll",()=>{ke(null),D()},!0);let M=null,$=null,we=()=>{M!==null&&o.cancelAnimationFrame(M),M=null,$=null,ke(null)};e.addEventListener("mousemove",x=>{$=x.target,M===null&&(M=o.requestAnimationFrame(()=>{M=null;let v=fe.current==="comment"&&!ua.current&&$?.nodeType===1?$.getBoundingClientRect():null;ke(F=>F?.left===v?.left&&F?.top===v?.top&&F?.width===v?.width&&F?.height===v?.height?F:v)}))},!0),e.addEventListener("mouseleave",we),o.addEventListener("pagehide",we);let Y=null,Ha=!1,wt=null;e.addEventListener("keydown",x=>{if(x.key==="Escape"&&Y){wt=Y.pointerId,Y=null,nt(void 0),x.preventDefault(),x.stopPropagation();return}x.key==="Escape"&&!ve.current&&(x.preventDefault(),ue().then(v=>{v&&(Fe(null),Ne(null),ke(null),je(null),delete p.dataset.chiselSelection)}))}),e.addEventListener("dragstart",x=>{fe.current==="comment"&&!ua.current&&!x.target?.closest("[data-chisel-root]")&&x.preventDefault()},!0),e.addEventListener("pointerdown",x=>{let v=x.target;if(!(fe.current!=="comment"||ua.current||x.pointerType!=="mouse"||x.button!==0||!v||v.closest("[data-chisel-root]"))){Y={x:x.clientX+o.scrollX,y:x.clientY+o.scrollY,clientX:x.clientX,clientY:x.clientY,target:v,pointerId:x.pointerId,moved:!1},x.preventDefault(),x.stopPropagation();try{v.setPointerCapture(x.pointerId)}catch{}}},!0);function Bo(x,v){let F=x.clientX+o.scrollX,ee=x.clientY+o.scrollY;return{x:Math.min(v.x,F),y:Math.min(v.y,ee),width:Math.abs(F-v.x),height:Math.abs(ee-v.y)}}e.addEventListener("pointermove",x=>{!Y||x.pointerId!==Y.pointerId||!Y.moved&&Math.hypot(x.clientX-Y.clientX,x.clientY-Y.clientY)<6||(Y.moved=!0,x.preventDefault(),x.stopPropagation(),ke(null),nt(Bo(x,Y)))},!0),e.addEventListener("pointercancel",()=>{Y=null,wt=null,nt(void 0)},!0),e.addEventListener("pointerup",async x=>{if(wt===x.pointerId){wt=null,Ha=!0,setTimeout(()=>{Ha=!1},0),x.preventDefault(),x.stopPropagation();return}let v=Y;if(Y=null,!v||x.pointerId!==v.pointerId||!v.moved)return;Ha=!0,setTimeout(()=>{Ha=!1},0),x.preventDefault(),x.stopPropagation();let F=Bo(x,v);if(nt(void 0),fe.current!=="comment"||ua.current||F.width<1||F.height<1||!await ue())return;let ee=v.target,re=e.elementFromPoint(x.clientX,x.clientY);for(;ee&&(!re||!ee.contains(re));)ee=ee.parentElement;let Q=ee?.getBoundingClientRect(),Ye=F.x-o.scrollX,_t=F.y-o.scrollY,Br=ee&&ee!==e.body&&ee!==p&&Q&&Q.width>0&&Q.height>0&&Ye>=Q.left&&_t>=Q.top&&Ye+F.width<=Q.right&&_t+F.height<=Q.bottom,Rr={...F,...Br&&Q?{selector:no(ee),relative:{x:(Ye-Q.left)/Q.width,y:(_t-Q.top)/Q.height,width:F.width/Q.width,height:F.height/Q.height}}:{}},Ro={x:F.x,y:F.y,area:Rr};Ue(),delete p.dataset.chiselSelection,Ne(null),_e(""),ke(null),je(Ro),ia(null),Ve.current=crypto.randomUUID(),Fe(Ro)},!0),e.addEventListener("click",async x=>{if(Ha){x.preventDefault(),x.stopImmediatePropagation();return}let v=x.target;if(!v||v.nodeType!==1||v.closest("[data-chisel-root]")||fe.current==="view"||fe.current==="comment"&&ua.current)return;let F=v.getBoundingClientRect(),ee=F.width?(x.clientX-F.left)/F.width:-1,re=F.height?(x.clientY-F.top)/F.height:-1,Q=v!==e.body&&v!==p&&ee>=0&&ee<=1&&re>=0&&re<=1,Ye={x:x.clientX+o.scrollX,y:x.clientY+o.scrollY,...Q?{selector:no(v),tag:v.tagName.toLowerCase(),offsetX:ee,offsetY:re}:{}};fe.current==="comment"&&(x.preventDefault(),x.stopImmediatePropagation(),!await ue())||(Ue(),je(Ye),Ye.selector?p.dataset.chiselSelection=Ye.selector:delete p.dataset.chiselSelection,fe.current!=="edit"&&(x.preventDefault(),x.stopImmediatePropagation(),Ne(null),_e(""),ke(null),ia(null),Ve.current=crypto.randomUUID(),Fe(Ye)))},!0)}le(()=>{let e=G?.defaultView;if(e)return Yo(e,o=>{if(!xa(o,window.location.origin))return;Ma(o),rt(p=>p.includes(o)?p:[...p,o]);let u=new URL(window.location.href);o==="/"?u.searchParams.delete("path"):u.searchParams.set("path",o),window.history.replaceState(window.history.state,"",u)})},[G]),le(()=>{G&&(G.documentElement.dataset.chiselCommentsHidden=String(Ce))},[Ce,G]),le(()=>()=>te.current?.cancel(),[]),le(()=>{if(!l)return;let e=!1,o=!1,u=!1,p,P=()=>{clearTimeout(p),p=setTimeout(()=>{p=void 0,D()},1e4)},D=async()=>{if(e||document.visibilityState==="hidden")return;if(ve.current){P();return}if(o){u=!0;return}o=!0,clearTimeout(p),p=void 0;let we=++na.current;try{let Y=await l.list();!e&&we===na.current&&(clearTimeout(p),p=void 0,K(Y),mt(!1),j(""))}catch{!e&&we===na.current&&(mt(!1),j("Shared comments could not be loaded. Check your connection; retrying automatically."),P())}finally{o=!1,u&&(u=!1,D())}};D();let M=l.subscribe?.(()=>{D()}),$=l.subscribe?void 0:window.setInterval(()=>{D()},1e4);return window.addEventListener("focus",D),document.addEventListener("visibilitychange",D),()=>{e=!0,clearTimeout(p),M?.(),window.clearInterval($),window.removeEventListener("focus",D),document.removeEventListener("visibilitychange",D)}},[l]);let Do=n?.setPage;le(()=>{Do?.(Z)},[Z,Do]),et(()=>{let e=co.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[Je,ge,i?.id,Ce,A,Z]),et(()=>{let e=C.current?.parentElement,o=e?.querySelector(".comment-box");if(!U||!e||!o||Ce)return;let u=()=>{let P=cr(e),D=Le(U),M=lr({x:D.x-P.left,y:D.y},{width:o.offsetWidth,height:o.offsetHeight},P);o.style.left=`${M.left+P.left}px`,o.style.top=`${M.top}px`,o.style.maxHeight=`${M.maxHeight}px`};u();let p=new ResizeObserver(u);return p.observe(o),p.observe(e),()=>p.disconnect()}),et(()=>{let e=Oe.current;if(!e||Ce||Me.current?.playState==="running")return;let o=e.parentElement?.parentElement,u=o?cr(o):{left:0,width:416,height:356},p=u.height,P=u.width,D=Number(e.dataset.pinX),M=Number(e.dataset.pinY),$=ge?Math.max(8,Math.min(M-40,p-Math.min(340,p-16)-8)):Math.max(8,Math.min(M+32-e.offsetHeight,p-e.offsetHeight-8)),we=ge?D+44:D;e.style.left=`${Math.max(u.left+8,Math.min(we,u.left+P-e.offsetWidth-8))}px`,e.style.top=`${$}px`,e.style.maxHeight=`${p-$-8}px`}),et(()=>(Be.current=!1,Me.current=Oe.current&&!Ce?Bt(Oe.current):null,()=>{Be.current=!1,Me.current?.cancel()}),[i?.id,!!U,A,Ce,Z]),le(()=>{C.current?.contentDocument?.readyState==="complete"&&Zt()},[]),le(()=>{if(Aa.current||!Da.current||pt||!G)return;let e=k.find(o=>o.id===Da.current);if(!(!e&&ct)){if(Aa.current=!0,!e){j("This comment was deleted or is unavailable to your account.");return}(async()=>{let o=e.context?.width??Ut.find(u=>u.key===(e.breakpoint??"desktop")).width;await Xe(o)&&await Ua(e)})()}},[k,pt,G,ct]),le(()=>{let e=o=>{if(document.querySelector('dialog[open], [aria-modal="true"]'))return;let u=tr(o);if(!u||u===fe.current||u==="edit"&&!qt)return;o.preventDefault(),o.stopPropagation();let p=Ut.find(P=>P.key===u);if(p){Xe(p.width);return}if(u==="toggle-comments"){te.current?.cancel(),Ue(),mo(P=>!P);return}(u==="edit"||u==="comment"||u==="view")&&Ct(u)};return document.addEventListener("keydown",e,!0),G?.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0),G?.removeEventListener("keydown",e,!0)}},[G]),le(()=>{if(!i||Ra!==i.id||U||A==="edit"||i.path!==Z||!i.selector||!G)return;let e;try{e=G.querySelector(i.selector)}catch{e=null}if(!e){zt(null),j("This element is no longer on the page. Its saved changes cannot be previewed.");return}let o=vt(e,i.changes??[]);return Ot.current=o,Vt({x:e.ownerDocument.defaultView.scrollX,y:e.ownerDocument.defaultView.scrollY}),o},[Ra,i,U,A,Z,G]);let kt=k.filter(e=>e.id!==Wt&&Qa(e.breakpoint,La)),Ao=nr(kt,Ta,ft),Ia=new Set(n?.unreadThreadIds),jt=kt.filter(e=>Ia.has(e.id)).length,Pe={desktop:{open:0,unread:0},tablet:{open:0,unread:0},mobile:{open:0,unread:0}},Mo={};for(let e of k){if(e.id===Wt)continue;for(let u of["desktop","tablet","mobile"])Qa(e.breakpoint,u)&&(e.resolved||Pe[u].open++,Ia.has(e.id)&&Pe[u].unread++);if(!Qa(e.breakpoint,La))continue;let o=Mo[e.path.split(/[?#]/)[0]]??={open:0,unread:0};e.resolved||o.open++,Ia.has(e.id)&&o.unread++}return f("main",{"aria-label":"Chisel workspace",className:`feedback-shell ${m?.className??""} ${A==="edit"?"is-editing":""} ${Ce?"comments-hidden":""}`,children:[s(lo,{}),_,f("div",{className:"feedback-workspace",children:[f("section",{className:"feedback-canvas","aria-label":"Website preview",children:[s("div",{className:"feedback-preview-scroll",onScroll:()=>Vt({x:C.current?.contentWindow?.scrollX??0,y:C.current?.contentWindow?.scrollY??0}),children:f("div",{className:"feedback-preview-frame",style:{width:de},children:[f("div",{className:"feedback-viewport",children:[s("iframe",{ref:C,src:"/",title:"Website for feedback",onLoad:Zt}),f("div",{className:"feedback-comment-layer","data-hover-preview":!!(i&&!ge&&!U),hidden:Ce,children:[(ho||U?.area||!U&&i?.area)&&(()=>{let e=ro(ho||U?.area||i?.area,G,qa);return s("div",{className:"feedback-comment-area","data-testid":"comment-area",style:{left:e.left,top:e.top,width:e.width,height:e.height}})})(),U&&Ge?.type!=="create"&&s("span",{className:"feedback-pin comment-box-draft-pin","aria-hidden":"true",style:{left:Le(U).x,top:Le(U).y}}),i&&!U&&A!=="edit"&&i.path===Z&&f("section",{ref:Oe,hidden:Wt===i.id,"data-pin-x":Le(i).x,"data-pin-y":Le(i).y,"data-pin-width":40+(Math.min(Tt(i).length,4)-1)*20,"data-expanded":ge,onPointerEnter:()=>{Be.current||te.current?.cancel()},onPointerMove:Kt,onPointerLeave:()=>te.current?.schedule(),onFocus:Kt,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||te.current?.schedule()},"data-native-ui":!!m,className:"feedback-composer feedback-thread-popup comment-thread",role:"dialog","aria-label":"Comment thread",style:{left:`clamp(8px, ${Le(i).x-4}px, calc(100% - 408px))`,top:`clamp(8px, ${Le(i).y-4}px, calc(100% - ${ge?340:128}px))`},children:[!ge&&f("button",{type:"button",className:"feedback-hover-preview","aria-label":`Expand comment: ${i.text||i.attachments?.map(e=>e.name).join(", ")}`,onClick:()=>{Ua(i)},children:[s("span",{className:"feedback-avatar",children:i.authorImage?s("img",{src:i.authorImage,alt:"",width:24,height:24}):i.author.slice(0,1).toUpperCase()}),f("span",{className:"feedback-hover-copy",children:[f("span",{className:"feedback-hover-byline",children:[s("strong",{children:i.author}),s("time",{dateTime:i.date,children:fr(i.date)})]}),s("span",{className:"feedback-hover-message",children:i.text||i.attachments?.map(e=>e.name).join(", ")})]})]}),f("div",{className:"feedback-thread-content",hidden:!ge,children:[f("header",{className:"feedback-thread-header",children:[s(Ja,{onMoveStart:()=>{Ze.current=null,te.current?.cancel(),Lt()}}),f("label",{className:"feedback-thread-status","data-state":qe,title:Xt?"Saving status\u2026":qe==="ready"?"Ready for review: the fix is ready for the reviewer to check.":qe==="resolved"?"This feedback has been resolved.":"Choose a status for this feedback.",children:[f("span",{className:"feedback-status-value","aria-hidden":"true",children:[Xt?s(ta,{className:"chisel-spin"}):qe==="resolved"?s(aa,{}):qe==="ready"?s(Ca,{}):s(Na,{}),s("span",{children:kr}),ko&&s(ca,{})]}),f("select",{"aria-label":"Comment status","aria-busy":Xt,disabled:Te||!ko,value:qe,onChange:e=>{let o=e.target.value;o===qe||o!=="open"&&o!=="ready"&&o!=="resolved"||He(o==="ready"||o==="open"&&qe==="ready"?{type:"status",id:i.id,status:o}:{type:"resolve",id:i.id,resolved:o==="resolved"})},children:[s("option",{value:"open",children:"Open"}),s("option",{value:"ready",disabled:!d,children:"Ready for review"}),s("option",{value:"resolved",children:"Resolved"})]})]}),f("div",{className:"feedback-thread-header-actions",children:[s("button",{className:"feedback-thread-close",type:"button",title:"Copy comment link","aria-label":"Copy comment link",onClick:()=>{wr(i)},children:s(pa,{size:16})}),(!l||l.delete)&&(!l||i.authorId===a.id||d)&&s("button",{className:"feedback-thread-close feedback-thread-delete",type:"button",title:"Delete comment","aria-label":"Delete comment",disabled:Te,onClick:()=>{Mr(i)},children:s(ra,{size:16})}),s("button",{className:"feedback-thread-close",type:"button",title:"Close thread","aria-label":"Close thread",onClick:yo,children:s(Sa,{size:18})})]})]}),f("div",{className:"feedback-thread-summary",children:[!m&&oe&&oe.id===i.id?f("form",{onSubmit:async e=>{e.preventDefault(),await He({type:"edit",id:i.id,text:oe.text.trimEnd(),changes:i.changes??[]})&&(se.current=!1,We(null))},children:[s("textarea",{"aria-label":"Edit comment",value:oe.text,onChange:e=>{se.current=e.target.value!==oe.original,We({...oe,text:e.target.value})}}),s("button",{type:"button",onClick:async()=>{se.current&&!await ue()||(se.current=!1,We(null))},children:"Cancel"}),i.selector&&s("button",{type:"button",onClick:()=>{vo(i)},children:"Edit styles"}),s("button",{type:"submit",disabled:Te||!oe.text.trim()&&!i.attachments?.length,children:"Save"})]}):!m&&f("button",{type:"button",className:"feedback-thread-summary-button","aria-label":`Expand comment: ${i.text}`,"aria-expanded":ge,onClick:Lt,children:[s("span",{className:"feedback-avatar",children:i.authorImage?s("img",{src:i.authorImage,alt:"",width:27,height:27}):i.author.slice(0,1).toUpperCase()}),f("span",{className:"feedback-thread-summary-copy",children:[f("span",{className:"feedback-thread-byline",children:[s("strong",{children:i.author}),s("time",{dateTime:i.date,children:new Date(i.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),s("span",{className:"feedback-thread-message",children:i.text}),!ge&&s("span",{className:"feedback-thread-reply-count",children:i.replies.length?`${i.replies.length} ${i.replies.length===1?"reply":"replies"}`:"Reply\u2026"})]})]}),!m&&i.authorId===a.id&&oe?.id!==i.id&&s("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:Te,onClick:async()=>{await ue()&&(ce(""),se.current=!1,We({id:i.id,text:i.text,original:i.text}))},children:s(wa,{size:16})})]}),!!i.changes?.length&&s("div",{className:"feedback-proposal-actions",children:f("button",{type:"button",className:"feedback-preview","aria-pressed":Ra===i.id,disabled:!i.selector,onClick:()=>{j(""),zt(Ra===i.id?null:i.id)},children:[s(Ca,{size:16}),Ra===i.id?"Exit preview":"Preview changes"]})}),(ge||m)&&s(at,{children:m?m.renderThread({draftKey:`${Ie}:reply:${i.id}`,comment:i,expanded:ge,reply:Je,saving:Te,submittingReply:Ge?.type==="reply"&&Ge.id===i.id,userId:a.id,onEditDraftChange:e=>{se.current=e},onDiscardEdit:ue,onBeginEdit:async()=>await ue()?(ce(""),xe.current=null,!0):!1,onEditStyles:i.selector?()=>{vo(i)}:void 0,onEdit:(e,o,u)=>He(e?{type:"edit_reply",id:i.id,replyId:e,text:o,body:u}:{type:"edit",id:i.id,text:o,changes:i.changes??[],body:u}),canResolve:!l||d||i.authorId===a.id,replyAuthor:a,onAttachmentDraftChange:e=>{sa.current=e},onReplyText:e=>{ce(e),xe.current=null},onReply:async(e,o,u,p)=>{if(!e.trim()&&!u?.length)return!1;let P=await He({type:"reply",id:i.id,body:o,attachmentTokens:u,reply:{id:xe.current??(xe.current=crypto.randomUUID()),text:e.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}},p);return P&&(ce(""),xe.current=null),P},onResolve:()=>{He({type:"resolve",id:i.id,resolved:!i.resolved})},onExpand:Lt}):f(at,{children:[s("div",{className:"feedback-thread-replies",children:i.replies.map((e,o)=>f("div",{className:"feedback-thread-reply",children:[s("span",{className:"feedback-avatar","aria-hidden":"true",children:(typeof e=="string"?"?":e.author.slice(0,1)).toUpperCase()}),f("div",{children:[typeof e!="string"&&s("strong",{children:e.author}),typeof e!="string"&&oe&&oe.id===e.id?f("form",{onSubmit:async u=>{u.preventDefault(),await He({type:"edit_reply",id:i.id,replyId:oe.id,text:oe.text.trimEnd()})&&(se.current=!1,We(null))},children:[s("textarea",{"aria-label":"Edit comment",value:oe.text,onChange:u=>{se.current=u.target.value!==oe.original,We({...oe,text:u.target.value})}}),s("button",{type:"button",onClick:async()=>{se.current&&!await ue()||(se.current=!1,We(null))},children:"Cancel"}),s("button",{type:"submit",disabled:Te||!oe.text.trim()&&!e.attachments?.length,children:"Save"})]}):s("p",{children:typeof e=="string"?e:e.text})]}),typeof e!="string"&&e.id&&e.authorId===a.id&&oe?.id!==e.id&&s("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:Te,onClick:async()=>{await ue()&&(ce(""),se.current=!1,We({id:e.id,text:e.text,original:e.text}))},children:s(wa,{size:16})})]},o))}),f("form",{hidden:Ge?.type==="reply"&&Ge.id===i.id,onSubmit:async e=>{e.preventDefault(),Je.trim()&&await He({type:"reply",id:i.id,reply:{id:xe.current??(xe.current=crypto.randomUUID()),text:Je.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}})&&(ce(""),xe.current=null)},children:[s("textarea",{ref:co,"aria-label":"Reply",rows:1,placeholder:"Write a reply\u2026",value:Je,maxLength:4e3,onChange:e=>{ce(e.target.value),xe.current=null},disabled:Te,required:!0}),s("div",{className:"feedback-thread-actions",children:f("button",{type:"submit",className:"feedback-primary",disabled:Te||!Je.trim(),"aria-label":"Reply",children:["Reply ",s(za,{})]})})]})]})})]})]},i.id),A==="comment"&&[xr,Le(U??i??Lr??{x:0,y:0}).rect].map((e,o)=>e&&s("div",{"data-testid":o===0?"element-hover":"element-selection",className:`feedback-element-box ${o===1?"is-selected":""}`,style:{left:e.left,top:e.top,width:e.width,height:e.height}},o)),A!=="edit"&&kt.filter(e=>e.path===Z&&!e.resolved).map(e=>{let o=Tt(e);return f("button",{"aria-label":`Open comment: ${e.text}`,title:o.map(u=>u.author).join(", "),className:`feedback-pin ${o.length>1?"feedback-pin-group":""} ${ze===e.id?"selected":""}`,onPointerEnter:u=>{u.pointerType!=="touch"&&Po(e)},onPointerLeave:()=>te.current?.schedule(),style:{left:Le(e).x,top:Le(e).y},onClick:()=>Ua(e),children:[o.slice(0,3).map((u,p)=>s("span",{className:"feedback-avatar","aria-hidden":"true",children:u.authorImage?s("img",{src:u.authorImage,alt:"",width:24,height:24}):u.author.slice(0,1).toUpperCase()},p)),o.length>3&&f("span",{className:"feedback-avatar feedback-pin-more","aria-hidden":"true",children:["+",o.length-3]})]},e.id)}),U&&G&&s(Qt,{target:U.selector?G.querySelector(U.selector):null,text:Fa,onText:_e,onDraftChange:e=>{it.current=e},draftKey:`${da}:body`,onDiscard:ue,hidden:Ge?.type==="create",editing:!!Re,commentId:Re??void 0,renderComposer:m?.renderComposer,changes:k.find(e=>e.id===Re)?.changes,hasExistingAttachments:!!k.find(e=>e.id===Re)?.attachments?.length,onCancel:()=>{$t(),Fe(null),_e(""),ia(null)},onPost:(e,o,u,p,P)=>Re?He({type:"edit",id:Re,text:o,changes:e,body:u,attachmentTokens:p}):He({type:"create",body:u,attachmentTokens:p,comment:{id:Ve.current??(Ve.current=crypto.randomUUID()),path:Z,...U,breakpoint:La,context:Se.current?.context??{width:C.current?.contentWindow?.innerWidth??de,height:C.current?.contentWindow?.innerHeight??900,url:window.location.origin+Z,capturedAt:new Date().toISOString()},text:o,author:a.name,authorId:a.id,authorImage:a.image,date:new Date().toISOString(),resolved:!1,replies:[],changes:e}},P),style:{left:Le(U).x+44,top:Le(U).y}},`${U.selector}:${U.x}:${U.y}`)]})]}),[-1,1].map(e=>s("div",{className:"feedback-preview-resize","data-edge":e===-1?"left":"right",role:"separator","aria-label":`Resize preview from ${e===-1?"left":"right"} edge`,"aria-orientation":"vertical","aria-valuemin":320,"aria-valuemax":Ee,"aria-valuenow":de,tabIndex:0,title:"Drag to resize \xB7 Arrow keys to adjust",onPointerDown:o=>vr(o,e),onPointerMove:Pr,onPointerUp:()=>{bt()},onPointerCancel:()=>{bt(!0)},onLostPointerCapture:()=>{bt(!0)},onKeyDown:o=>{if(o.key==="Escape"){o.preventDefault(),bt(!0);return}o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),o.stopPropagation(),Xe(de+(o.key==="ArrowRight"?1:-1)*e*(o.shiftKey?50:10),!0))}},e))]})}),f("div",{className:"feedback-toolbar",role:"group","aria-label":"Preview mode",children:[qt&&f("button",{title:"Edit styles","aria-keyshortcuts":"E","aria-pressed":A==="edit",onClick:()=>Ct("edit"),children:[s(ha,{}),s("span",{children:"Edit"})]}),f("button",{title:"Add comments","aria-keyshortcuts":"C","aria-pressed":A==="comment",onClick:()=>Ct("comment"),children:[s(ma,{}),s("span",{children:"Comment"})]}),f("button",{title:"View website","aria-keyshortcuts":"V","aria-pressed":A==="view",onClick:()=>Ct("view"),children:[s(ka,{}),s("span",{children:"View"})]})]}),f("div",{className:"feedback-toolbar feedback-breakpoints",role:"group","aria-label":"Preview breakpoint",children:[f("label",{className:"feedback-preview-width",children:[s("input",{"aria-label":"Preview width",title:`Preview width \xB7 320\u2013${Ee}px`,inputMode:"numeric",value:W??String(de),onFocus:e=>{be(e.currentTarget.value),e.currentTarget.select()},onChange:e=>be(e.target.value),onBlur:e=>{W!==null&&yr(e.currentTarget.value)},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),e.currentTarget.blur()),e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),be(null))}}),s("span",{"aria-hidden":"true",children:"px"})]}),Ut.map(({key:e,label:o,width:u,shortcut:p,Icon:P})=>f("button",{type:"button","aria-label":o,title:`${o} \xB7 ${u}px \xB7 ${p} \xB7 ${Pe[e].open} open, ${Pe[e].unread} unread`,"aria-keyshortcuts":p,"aria-description":`${Pe[e].open} open comments, ${Pe[e].unread} unread comments`,"aria-pressed":La===e,onClick:()=>{Xe(u)},children:[s(P,{"aria-hidden":"true"}),(Pe[e].open>0||Pe[e].unread>0)&&f("sup",{"aria-hidden":"true",children:[Pe[e].open,Pe[e].unread>0&&`\xB7${Pe[e].unread}`]})]},e))]})]}),s("aside",{className:"feedback-sidebar",hidden:A==="edit"||Ce,children:f("div",{className:"feedback-sidebar-panel",children:[f("div",{className:"feedback-sidebar-title",children:[f("h1",{children:["Comments ",s("span",{children:kt.length})]}),f("details",{className:"feedback-account",children:[s("summary",{title:`Signed in as ${a.name}`,"aria-label":`Account: ${a.name}`,children:s("span",{className:"feedback-avatar",children:a.image?s("img",{src:a.image,alt:"",width:27,height:27}):a.name.slice(0,1).toUpperCase()})}),f("div",{children:[s("strong",{children:a.name}),s("span",{children:a.email}),V&&s("a",{href:V,target:"_blank",rel:"noopener noreferrer",children:"Connect your agent"}),B&&s("a",{href:B,children:"My projects"}),f("button",{onClick:async()=>{try{await r(),window.location.reload()}catch{j("Sign out failed. Please try again.")}},children:[s(Va,{}),"Sign out"]})]})]})]}),f("label",{className:"feedback-search",children:[s(Ka,{"aria-hidden":"true",size:18}),s("input",{type:"search","aria-label":"Search comments",placeholder:"Search",value:ft,onChange:e=>br(e.target.value)})]}),n&&(n.status!=="connected"||n.participants.length>0||jt>0)&&f("div",{className:"feedback-collaboration","aria-label":"Review activity",children:[n.status!=="connected"&&s("span",{role:"status",children:n.status==="connecting"||n.status==="initial"?"Connecting\u2026":"Reconnecting\u2026"}),s("div",{className:"feedback-reviewers",children:n.participants.map(e=>s("span",{className:"feedback-avatar",title:`${e.name} \xB7 ${e.path}`,"aria-label":`${e.name} is reviewing ${e.path}`,children:e.image?s("img",{src:e.image,alt:"",width:24,height:24}):e.name.slice(0,1).toUpperCase()},e.id))}),jt>0&&f("span",{className:"feedback-unread-count",children:[jt," unread"]})]}),s("div",{className:"feedback-tabs",role:"group","aria-label":"Filter comments",children:["open","resolved","all"].map(e=>s("button",{"aria-pressed":Ta===e,onClick:()=>Ir(e),children:e[0].toUpperCase()+e.slice(1)},e))}),tt&&f("section",{className:"feedback-guide","aria-label":"Quick start",children:[s("strong",{children:"Leave feedback"}),f("ul",{children:[f("li",{children:[s(ma,{"aria-hidden":"true"}),"Click to comment"]}),f("li",{children:[s(oa,{"aria-hidden":"true"}),"Drag to mark an area"]}),f("li",{children:[s(ka,{"aria-hidden":"true"}),"Use View to interact"]})]}),w&&s("p",{children:"A screenshot is saved with your comment."}),s("button",{type:"button",onClick:()=>{try{localStorage.setItem(`chisel:guide:${a.id}`,"1")}catch{}ga(!1)},children:"Got it"})]}),I&&f("p",{className:"feedback-notice",role:"status",children:[I,s("button",{type:"button","aria-label":"Dismiss message",onClick:()=>H(""),children:s(Sa,{size:14})})]}),pe.map(e=>f("p",{className:"feedback-notice",children:["Comment saved; its snapshot could not be attached. ",s("button",{type:"button",onClick:async()=>{try{await w?.(e.id,e.file),me(o=>o.filter(u=>u.id!==e.id))}catch{H("Snapshot still unavailable. Your comment is saved.")}},children:"Retry snapshot"})]},e.id)),ct&&s("p",{role:"alert",className:"feedback-error",children:ct}),f("div",{className:"feedback-comment-list",children:[Ao.map(e=>f("article",{onPointerEnter:o=>{!h&&o.pointerType!=="touch"&&Po(e)},onPointerLeave:()=>te.current?.schedule(),className:`feedback-comment ${(h?X.has(e.id):ze===e.id)?"active":""}`,children:[d&&h&&s("label",{className:"feedback-comment-select",children:s("input",{type:"checkbox","aria-label":`Select comment: ${e.text}`,checked:X.has(e.id),onChange:()=>wo(e.id)})}),f("button",{className:"feedback-comment-main","aria-pressed":h?X.has(e.id):ze===e.id,onClick:()=>h?wo(e.id):Ua(e),children:[f("span",{className:"feedback-comment-heading",children:[s("span",{className:"feedback-avatar",children:e.authorImage?s("img",{src:e.authorImage,alt:"",width:28,height:28}):e.author.slice(0,1).toUpperCase()}),f("span",{className:"feedback-comment-identity",children:[f("span",{className:"feedback-comment-meta",children:[s("strong",{children:e.author}),e.pending?s("span",{role:"status",children:"Sending\u2026"}):s("time",{dateTime:e.date,children:new Date(e.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),f("span",{className:"feedback-comment-status",children:[(Ta==="all"||e.status==="ready")&&f(at,{children:[e.status==="ready"?"Ready for review":e.resolved?"Resolved":"Open",s("span",{"aria-hidden":"true",children:" \xB7 "})]}),s("span",{className:"feedback-comment-path",title:e.path,children:e.path})]})]}),Ia.has(e.id)&&s("span",{className:"feedback-comment-unread-dot","aria-hidden":"true"})]}),s("span",{className:"feedback-comment-body",children:e.text||e.attachments?.map(o=>o.name).join(", ")}),(e.replies.length>0||Ia.has(e.id))&&f("span",{className:"feedback-comment-activity",children:[e.replies.length>0&&f(at,{children:[s("span",{className:"feedback-comment-avatars",children:Tt(e).slice(1,4).map((o,u)=>s("span",{className:"feedback-avatar",title:o.author,children:o.authorImage?s("img",{src:o.authorImage,alt:"",width:20,height:20}):o.author.slice(0,1).toUpperCase()},u))}),f("span",{className:"feedback-comment-reply-count",children:[e.replies.length," ",e.replies.length===1?"reply":"replies"]})]}),Ia.has(e.id)&&s("span",{className:"feedback-unread-label",children:e.replies.length?"New replies":"Unread"})]})]})]},e.id)),pt&&s("p",{role:"status",children:"Loading shared comments\u2026"}),!pt&&!Ao.length&&f("div",{className:"feedback-empty",children:[s("span",{children:s(ma,{size:30})}),s("h2",{children:ft.trim()?"No matching comments":Ta==="resolved"?"Nothing resolved yet":"No comments yet"}),s("p",{children:ft.trim()?"Try another name, phrase, or page.":Ta==="resolved"?"Resolved threads will appear here.":"Click anywhere on the page to leave your first comment."})]})]}),d&&k.length>0&&f("details",{className:"feedback-export",open:h,children:[f("summary",{onClick:e=>{e.preventDefault(),b(!h),ne(new Set)},children:[s(ba,{size:16}),"Export feedback for Codex",s(ea,{size:14})]}),f("div",{children:[s("span",{children:X.size?`${X.size} selected`:"Select comments above"}),f("button",{type:"button",disabled:!X.size,onClick:()=>{Sr()},children:[s(ba,{size:14}),"Copy feedback"]})]})]}),s(ao,{path:Z,counts:Mo,disabled:Te||!G,onNavigate:Ar,onOpen:Dr,routes:[...new Set([Z,...ot,...lt,...k.map(e=>e.path)])].filter(e=>G&&xa(e,window.location.origin)).sort((e,o)=>e.localeCompare(o))}),c&&d&&f("details",{className:"feedback-review-invite",children:[f("summary",{children:[s(ea,{"aria-hidden":"true"}),"Share review link"]}),f("form",{onSubmit:e=>{e.preventDefault(),So()},children:[s("p",{children:"Anyone with this link can sign in and review this website."}),s("button",{type:"submit",className:"feedback-primary",disabled:xt,children:xt?"Preparing link\u2026":"Copy review link"}),Lo&&f(at,{children:[s("input",{"aria-label":"Review link",value:Lo,readOnly:!0,onFocus:e=>e.currentTarget.select()}),s("button",{type:"button",onClick:()=>{So(!0)},disabled:xt,children:"Replace invitation link"}),s("p",{children:"Replacing the link blocks new joins through the old link. Existing reviewers keep access."})]}),bo&&s("p",{role:"status",children:bo})]})]})]})})]})]})}import{useEffect as hr,useSyncExternalStore as yl}from"react";import{Chisel as vl}from"use-chisel";import{jsx as Ml}from"react/jsx-runtime";function Pl(a){return window.addEventListener("chisel:mode",a),()=>window.removeEventListener("chisel:mode",a)}function Dl(){try{return window.self!==window.top&&window.parent.location.origin===window.location.origin&&window.parent.location.pathname==="/chisel"?document.documentElement.dataset.chiselMode??"view":"site"}catch{return"site"}}function Al({projectName:a="Chisel"}){let t=yl(Pl,Dl,()=>"site");return hr(()=>{process.env.NEXT_PUBLIC_CHISEL_ENABLED!=="0"&&(window.chiselReady=!0,document.dispatchEvent(new Event("chisel:ready")))},[]),hr(()=>{if(t!=="edit")return;let r=window.setTimeout(()=>window.dispatchEvent(new Event("chisel:select")),50);return()=>window.clearTimeout(r)},[t]),t==="site"||process.env.NODE_ENV==="production"||process.env.NEXT_PUBLIC_CHISEL_ENABLED==="0"?null:Ml(vl,{embedded:!0,enabled:t==="edit",projectName:a})}export{Al as ChiselPreview,mr as ChiselWorkspace,lo as ChiselWorkspaceStyles};
27
+ `,e.head.append(k),f.dataset.chiselMode=ce.current,f.dataset.chiselCommentsHidden=String(fa.current),o.dispatchEvent(new Event("chisel:mode")),o.addEventListener("chisel:selection",x=>{let P=x.detail;Ye(P),P.selector&&(f.dataset.chiselSelection=P.selector)});let D=()=>jt({x:o.scrollX,y:o.scrollY});D(),o.addEventListener("scroll",D),o.addEventListener("resize",()=>{ve(null),D()}),e.addEventListener("scroll",()=>{ve(null),D()},!0);let F=null,K=null,he=()=>{F!==null&&o.cancelAnimationFrame(F),F=null,K=null,ve(null)};e.addEventListener("mousemove",x=>{K=x.target,F===null&&(F=o.requestAnimationFrame(()=>{F=null;let P=ce.current==="comment"&&!fa.current&&K?.nodeType===1?K.getBoundingClientRect():null;ve(R=>R?.left===P?.left&&R?.top===P?.top&&R?.width===P?.width&&R?.height===P?.height?R:P)}))},!0),e.addEventListener("mouseleave",he),o.addEventListener("pagehide",he);let Y=null,ma=!1,Dt=null;e.addEventListener("keydown",x=>{if(x.key==="Escape"&&Y){Dt=Y.pointerId,Y=null,mt(void 0),x.preventDefault(),x.stopPropagation();return}x.key==="Escape"&&!fe.current&&(x.preventDefault(),ue().then(P=>{P&&(qe(null),Te(null),ve(null),Ye(null),delete f.dataset.chiselSelection)}))}),e.addEventListener("dragstart",x=>{ce.current==="comment"&&!fa.current&&!x.target?.closest("[data-chisel-root]")&&x.preventDefault()},!0),e.addEventListener("pointerdown",x=>{let P=x.target;if(!(ce.current!=="comment"||fa.current||x.pointerType!=="mouse"||x.button!==0||!P||P.closest("[data-chisel-root]"))){Y={x:x.clientX+o.scrollX,y:x.clientY+o.scrollY,clientX:x.clientX,clientY:x.clientY,target:P,pointerId:x.pointerId,moved:!1},x.preventDefault(),x.stopPropagation();try{P.setPointerCapture(x.pointerId)}catch{}}},!0);function To(x,P){let R=x.clientX+o.scrollX,ee=x.clientY+o.scrollY;return{x:Math.min(P.x,R),y:Math.min(P.y,ee),width:Math.abs(R-P.x),height:Math.abs(ee-P.y)}}e.addEventListener("pointermove",x=>{!Y||x.pointerId!==Y.pointerId||!Y.moved&&Math.hypot(x.clientX-Y.clientX,x.clientY-Y.clientY)<6||(Y.moved=!0,x.preventDefault(),x.stopPropagation(),ve(null),mt(To(x,Y)))},!0),e.addEventListener("pointercancel",()=>{Y=null,Dt=null,mt(void 0)},!0),e.addEventListener("pointerup",async x=>{if(Dt===x.pointerId){Dt=null,ma=!0,setTimeout(()=>{ma=!1},0),x.preventDefault(),x.stopPropagation();return}let P=Y;if(Y=null,!P||x.pointerId!==P.pointerId||!P.moved)return;ma=!0,setTimeout(()=>{ma=!1},0),x.preventDefault(),x.stopPropagation();let R=To(x,P);if(mt(void 0),ce.current!=="comment"||fa.current||R.width<1||R.height<1||!await ue())return;let ee=P.target,re=e.elementFromPoint(x.clientX,x.clientY);for(;ee&&(!re||!ee.contains(re));)ee=ee.parentElement;let Q=ee?.getBoundingClientRect(),aa=R.x-o.scrollX,eo=R.y-o.scrollY,qr=ee&&ee!==e.body&&ee!==f&&Q&&Q.width>0&&Q.height>0&&aa>=Q.left&&eo>=Q.top&&aa+R.width<=Q.right&&eo+R.height<=Q.bottom,Ur={...R,...qr&&Q?{selector:po(ee),relative:{x:(aa-Q.left)/Q.width,y:(eo-Q.top)/Q.height,width:R.width/Q.width,height:R.height/Q.height}}:{}},qo={x:R.x,y:R.y,area:Ur};Oe(),delete f.dataset.chiselSelection,Te(null),Qe(""),ve(null),Ye(qo),ca(null),Ke.current=crypto.randomUUID(),qe(qo)},!0),e.addEventListener("click",async x=>{if(ma){x.preventDefault(),x.stopImmediatePropagation();return}let P=x.target;if(!P||P.nodeType!==1||P.closest("[data-chisel-root]")||ce.current==="view"||ce.current==="comment"&&fa.current)return;let R=P.getBoundingClientRect(),ee=R.width?(x.clientX-R.left)/R.width:-1,re=R.height?(x.clientY-R.top)/R.height:-1,Q=P!==e.body&&P!==f&&ee>=0&&ee<=1&&re>=0&&re<=1,aa={x:x.clientX+o.scrollX,y:x.clientY+o.scrollY,...Q?{selector:po(P),tag:P.tagName.toLowerCase(),offsetX:ee,offsetY:re}:{}};ce.current==="comment"&&(x.preventDefault(),x.stopImmediatePropagation(),!await ue())||(Oe(),Ye(aa),aa.selector?f.dataset.chiselSelection=aa.selector:delete f.dataset.chiselSelection,ce.current!=="edit"&&(x.preventDefault(),x.stopImmediatePropagation(),Te(null),Qe(""),ve(null),ca(null),Ke.current=crypto.randomUUID(),qe(aa)))},!0)}le(()=>{let e=W?.defaultView;if(e)return ar(e,o=>{if(!ba(o,window.location.origin))return;qa(o),ut(f=>f.includes(o)?f:[...f,o]);let u=new URL(window.location.href);o==="/"?u.searchParams.delete("path"):u.searchParams.set("path",o),window.history.replaceState(window.history.state,"",u)})},[W]),le(()=>{W&&(W.documentElement.dataset.chiselCommentsHidden=String(Se))},[Se,W]),le(()=>()=>te.current?.cancel(),[]),le(()=>{if(!l)return;let e=!1,o=!1,u=!1,f,k=()=>{clearTimeout(f),f=setTimeout(()=>{f=void 0,D()},1e4)},D=async()=>{if(e||document.visibilityState==="hidden")return;if(fe.current){k();return}if(o){u=!0;return}o=!0,clearTimeout(f),f=void 0;let he=++He.current;try{let Y=await l.list();!e&&he===He.current&&(clearTimeout(f),f=void 0,V(Y),Lt(!1),Z(""))}catch{!e&&he===He.current&&(Lt(!1),Z("Shared comments could not be loaded. Check your connection; retrying automatically."),k())}finally{o=!1,u&&(u=!1,D())}};D();let F=l.subscribe?.(()=>{D()}),K=l.subscribe?void 0:window.setInterval(()=>{D()},1e4);return window.addEventListener("focus",D),document.addEventListener("visibilitychange",D),()=>{e=!0,clearTimeout(f),F?.(),window.clearInterval(K),window.removeEventListener("focus",D),document.removeEventListener("visibilitychange",D)}},[l]);let Bo=n?.setPage;le(()=>{Bo?.(j)},[j,Bo]),rt(()=>{let e=ho.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[ea,be,i?.id,Se,A,j]),rt(()=>{let e=w.current?.parentElement,o=e?.querySelector(".comment-box");if(!$||!e||!o||Se)return;let u=()=>{let k=hr(e),D=Ce($),F=ur({x:D.x-k.left,y:D.y},{width:o.offsetWidth,height:o.offsetHeight},k);o.style.left=`${F.left+k.left}px`,o.style.top=`${F.top}px`,o.style.maxHeight=`${F.maxHeight}px`};u();let f=new ResizeObserver(u);return f.observe(o),f.observe(e),()=>f.disconnect()}),rt(()=>{let e=We.current;if(!e||Se||Re.current?.playState==="running")return;let o=e.parentElement?.parentElement,u=o?hr(o):{left:0,width:416,height:356},f=u.height,k=u.width,D=Number(e.dataset.pinX),F=Number(e.dataset.pinY),K=be?Math.max(8,Math.min(F-40,f-Math.min(340,f-16)-8)):Math.max(8,Math.min(F+32-e.offsetHeight,f-e.offsetHeight-8)),he=be?D+44:D;e.style.left=`${Math.max(u.left+8,Math.min(he,u.left+k-e.offsetWidth-8))}px`,e.style.top=`${K}px`,e.style.maxHeight=`${f-K-8}px`}),rt(()=>(Fe.current=!1,Re.current=We.current&&!Se?Ut(We.current):null,()=>{Fe.current=!1,Re.current?.cancel()}),[i?.id,!!$,A,Se,j]),le(()=>{w.current?.contentDocument?.readyState==="complete"&&Yt()},[]),le(()=>{if(Ta.current||!Fa.current||gt||!W)return;let e=C.find(o=>o.id===Fa.current);if(!(!e&&xt)){if(Ta.current=!0,!e){Z("This comment was deleted or is unavailable to your account.");return}(async()=>{let o=e.context?.width??Nt.find(u=>u.key===(e.breakpoint??"desktop")).width;await Ze(o)&&await Na(e)})()}},[C,gt,W,xt]),le(()=>{let e=o=>{if(document.querySelector('dialog[open], [aria-modal="true"]'))return;let u=lr(o);if(!u||u===ce.current||u==="edit"&&!zt)return;o.preventDefault(),o.stopPropagation();let f=Nt.find(k=>k.key===u);if(f){Ze(f.width);return}if(u==="toggle-comments"){te.current?.cancel(),Oe(),go(k=>!k);return}(u==="edit"||u==="comment"||u==="view")&&vt(u)};return document.addEventListener("keydown",e,!0),W?.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0),W?.removeEventListener("keydown",e,!0)}},[W]),le(()=>{if(!i||Ha!==i.id||$||A==="edit"||i.path!==j||!i.selector||!W)return;let e;try{e=W.querySelector(i.selector)}catch{e=null}if(!e){Xt(null),Z("This element is no longer on the page. Its saved changes cannot be previewed.");return}let o=Bt(e,i.changes??[]);return Vt.current=o,jt({x:e.ownerDocument.defaultView.scrollX,y:e.ownerDocument.defaultView.scrollY}),o},[Ha,i,$,A,j,W]);let Pt=C.filter(e=>e.id!==Kt&&ot(e.breakpoint,wa)),Ro=pr(Pt,Oa,ht),ya=new Set(n?.unreadThreadIds),Qt=Pt.filter(e=>ya.has(e.id)).length,Ae={desktop:{open:0,unread:0},tablet:{open:0,unread:0},mobile:{open:0,unread:0}},Fo={};for(let e of C){if(e.id===Kt)continue;for(let u of["desktop","tablet","mobile"])ot(e.breakpoint,u)&&(e.resolved||Ae[u].open++,ya.has(e.id)&&Ae[u].unread++);if(!ot(e.breakpoint,wa))continue;let o=Fo[e.path.split(/[?#]/)[0]]??={open:0,unread:0};e.resolved||o.open++,ya.has(e.id)&&o.unread++}return c("main",{"aria-label":"Chisel workspace",className:`feedback-shell ${m?.className??""} ${A==="edit"?"is-editing":""} ${Se?"comments-hidden":""}`,children:[s(no,{}),_,c("div",{className:"feedback-workspace",children:[c("section",{className:"feedback-canvas","aria-label":"Website preview",children:[s("div",{className:"feedback-preview-scroll",onScroll:()=>jt({x:w.current?.contentWindow?.scrollX??0,y:w.current?.contentWindow?.scrollY??0}),children:c("div",{className:"feedback-preview-frame",style:{width:de},children:[c("div",{className:"feedback-viewport",children:[s("iframe",{ref:w,src:"/",title:"Website for feedback",onLoad:Yt}),c("div",{className:"feedback-comment-layer","data-hover-preview":!!(i&&!be&&!pa),hidden:Se,children:[(Lo||pa?.area||!pa&&i?.area)&&(()=>{let e=io(Lo||pa?.area||i?.area,W,za);return s("div",{className:"feedback-comment-area","data-testid":"comment-area",style:{left:e.left,top:e.top,width:e.width,height:e.height}})})(),$&&me?.type!=="create"&&s("span",{className:"feedback-pin comment-box-draft-pin","aria-hidden":"true",style:{left:Ce($).x,top:Ce($).y}}),i&&!pa&&A!=="edit"&&i.path===j&&c("section",{ref:We,hidden:Kt===i.id,"data-pin-x":Ce(i).x,"data-pin-y":Ce(i).y,"data-pin-width":40+(Math.min(Et(i).length,4)-1)*20,"data-expanded":be,onPointerEnter:()=>{Fe.current||te.current?.cancel()},onPointerMove:Jt,onPointerLeave:()=>te.current?.schedule(),onFocus:Jt,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||te.current?.schedule()},"data-native-ui":!!m,className:"feedback-composer feedback-thread-popup comment-thread",role:"dialog","aria-label":"Comment thread",style:{left:`clamp(8px, ${Ce(i).x-4}px, calc(100% - 408px))`,top:`clamp(8px, ${Ce(i).y-4}px, calc(100% - ${be?340:128}px))`},children:[!be&&c("button",{type:"button",className:"feedback-hover-preview","aria-label":`Expand comment: ${i.text||i.attachments?.map(e=>e.name).join(", ")}`,onClick:()=>{Na(i)},children:[s("span",{className:"feedback-avatar",children:i.authorImage?s("img",{src:i.authorImage,alt:"",width:24,height:24}):i.author.slice(0,1).toUpperCase()}),c("span",{className:"feedback-hover-copy",children:[c("span",{className:"feedback-hover-byline",children:[s("strong",{children:i.author}),s("time",{dateTime:i.date,children:mr(i.date)})]}),s("span",{className:"feedback-hover-message",children:i.text||i.attachments?.map(e=>e.name).join(", ")})]})]}),c("div",{className:"feedback-thread-content",hidden:!be,children:[c("header",{className:"feedback-thread-header",children:[s(at,{onMoveStart:()=>{Ge.current=null,te.current?.cancel(),wt()}}),c("label",{className:"feedback-thread-status","data-state":Ee,title:kt?"Saving status\u2026":Ee==="ready"?"Ready for review: the fix is ready for the reviewer to check.":Ee==="resolved"?"This feedback has been resolved.":"Choose a status for this feedback.",children:[c("span",{className:"feedback-status-value","aria-hidden":"true",children:[kt?s(la,{className:"chisel-spin"}):Ee==="resolved"?s(ra,{}):Ee==="ready"?s(Pa,{}):s(Xa,{}),s("span",{children:yr}),So&&s(xa,{})]}),c("select",{"aria-label":"Comment status","aria-busy":kt,disabled:Ue&&!kt||!So,value:Ee,onChange:e=>{let o=e.target.value;o===Ee||o!=="open"&&o!=="ready"&&o!=="resolved"||ze(o==="ready"||o==="open"&&Ee==="ready"?{type:"status",id:i.id,status:o}:{type:"resolve",id:i.id,resolved:o==="resolved"})},children:[s("option",{value:"open",children:"Open"}),s("option",{value:"ready",disabled:!d,children:"Ready for review"}),s("option",{value:"resolved",children:"Resolved"})]})]}),c("div",{className:"feedback-thread-header-actions",children:[s("button",{className:"feedback-thread-close",type:"button",title:"Copy comment link","aria-label":"Copy comment link",onClick:()=>{vr(i)},children:s(ga,{size:16})}),(!l||l.delete)&&(!l||i.authorId===a.id||d)&&s("button",{className:"feedback-thread-close feedback-thread-delete",type:"button",title:"Delete comment","aria-label":"Delete comment",disabled:Ue,onClick:()=>{Tr(i)},children:s(sa,{size:16})}),s("button",{className:"feedback-thread-close",type:"button",title:"Close thread","aria-label":"Close thread",onClick:Do,children:s(Ma,{size:18})})]})]}),c("div",{className:"feedback-thread-summary",children:[!m&&oe&&oe.id===i.id&&me?.type!=="edit"?c("form",{onSubmit:async e=>{e.preventDefault(),await ze({type:"edit",id:i.id,text:oe.text.trimEnd(),changes:i.changes??[]})&&(se.current=!1,Xe(null))},children:[s("textarea",{"aria-label":"Edit comment",value:oe.text,onChange:e=>{se.current=e.target.value!==oe.original,Xe({...oe,text:e.target.value})}}),s("button",{type:"button",onClick:async()=>{se.current&&!await ue()||(se.current=!1,Xe(null))},children:"Cancel"}),i.selector&&s("button",{type:"button",onClick:()=>{Ao(i)},children:"Edit styles"}),s("button",{type:"submit",disabled:Ue||!oe.text.trim()&&!i.attachments?.length,children:"Save"})]}):!m&&c("button",{type:"button",className:"feedback-thread-summary-button","aria-label":`Expand comment: ${i.text}`,"aria-expanded":be,onClick:wt,children:[s("span",{className:"feedback-avatar",children:i.authorImage?s("img",{src:i.authorImage,alt:"",width:27,height:27}):i.author.slice(0,1).toUpperCase()}),c("span",{className:"feedback-thread-summary-copy",children:[c("span",{className:"feedback-thread-byline",children:[s("strong",{children:i.author}),s("time",{dateTime:i.date,children:new Date(i.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),s("span",{className:"feedback-thread-message",children:i.text}),!be&&s("span",{className:"feedback-thread-reply-count",children:i.replies.length?`${i.replies.length} ${i.replies.length===1?"reply":"replies"}`:"Reply\u2026"})]})]}),!m&&i.authorId===a.id&&oe?.id!==i.id&&s("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:Ue,onClick:async()=>{await ue()&&(pe(""),se.current=!1,Xe({id:i.id,text:i.text,original:i.text}))},children:s(Aa,{size:16})})]}),!!i.changes?.length&&s("div",{className:"feedback-proposal-actions",children:c("button",{type:"button",className:"feedback-preview","aria-pressed":Ha===i.id,disabled:!i.selector,onClick:()=>{Z(""),Xt(Ha===i.id?null:i.id)},children:[s(Pa,{size:16}),Ha===i.id?"Exit preview":"Preview changes"]})}),(be||m)&&s(lt,{children:m?m.renderThread({draftKey:`${ke}:reply:${i.id}`,comment:i,expanded:be,reply:ea,saving:Ue,submittingReply:me?.type==="reply"&&me.id===i.id,userId:a.id,onEditDraftChange:e=>{se.current=e},onDiscardEdit:ue,onBeginEdit:async()=>await ue()?(pe(""),Ie.current=null,!0):!1,onEditStyles:i.selector?()=>{Ao(i)}:void 0,onEdit:(e,o,u)=>ze(e?{type:"edit_reply",id:i.id,replyId:e,text:o,body:u}:{type:"edit",id:i.id,text:o,changes:i.changes??[],body:u}),canResolve:!l||d||i.authorId===a.id,replyAuthor:a,onAttachmentDraftChange:e=>{na.current=e},onReplyText:e=>{pe(e),Ie.current=null},onReply:async(e,o,u,f)=>{if(!e.trim()&&!u?.length)return!1;let k=await ze({type:"reply",id:i.id,body:o,attachmentTokens:u,reply:{id:Ie.current??(Ie.current=crypto.randomUUID()),text:e.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}},f);return k&&(pe(""),Ie.current=null),k},onResolve:()=>{ze({type:"resolve",id:i.id,resolved:!i.resolved})},onExpand:wt}):c(lt,{children:[s("div",{className:"feedback-thread-replies",children:i.replies.map((e,o)=>c("div",{className:"feedback-thread-reply",children:[s("span",{className:"feedback-avatar","aria-hidden":"true",children:(typeof e=="string"?"?":e.author.slice(0,1)).toUpperCase()}),c("div",{children:[typeof e!="string"&&s("strong",{children:e.author}),typeof e!="string"&&oe&&oe.id===e.id&&me?.type!=="edit_reply"?c("form",{onSubmit:async u=>{u.preventDefault(),await ze({type:"edit_reply",id:i.id,replyId:oe.id,text:oe.text.trimEnd()})&&(se.current=!1,Xe(null))},children:[s("textarea",{"aria-label":"Edit comment",value:oe.text,onChange:u=>{se.current=u.target.value!==oe.original,Xe({...oe,text:u.target.value})}}),s("button",{type:"button",onClick:async()=>{se.current&&!await ue()||(se.current=!1,Xe(null))},children:"Cancel"}),s("button",{type:"submit",disabled:Ue||!oe.text.trim()&&!e.attachments?.length,children:"Save"})]}):s("p",{children:typeof e=="string"?e:e.text})]}),typeof e!="string"&&e.id&&e.authorId===a.id&&oe?.id!==e.id&&s("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:Ue,onClick:async()=>{await ue()&&(pe(""),se.current=!1,Xe({id:e.id,text:e.text,original:e.text}))},children:s(Aa,{size:16})})]},o))}),c("form",{hidden:me?.type==="reply"&&me.id===i.id,onSubmit:async e=>{e.preventDefault(),ea.trim()&&await ze({type:"reply",id:i.id,reply:{id:Ie.current??(Ie.current=crypto.randomUUID()),text:ea.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}})&&(pe(""),Ie.current=null)},children:[s("textarea",{ref:ho,"aria-label":"Reply",rows:1,placeholder:"Write a reply\u2026",value:ea,maxLength:4e3,onChange:e=>{pe(e.target.value),Ie.current=null},disabled:Ue,required:!0}),s("div",{className:"feedback-thread-actions",children:c("button",{type:"submit",className:"feedback-primary",disabled:Ue||!ea.trim(),"aria-label":"Reply",children:["Reply ",s(Va,{})]})})]})]})})]})]},i.id),A==="comment"&&[Ir,Ce(pa??i??Cr??{x:0,y:0}).rect].map((e,o)=>e&&s("div",{"data-testid":o===0?"element-hover":"element-selection",className:`feedback-element-box ${o===1?"is-selected":""}`,style:{left:e.left,top:e.top,width:e.width,height:e.height}},o)),A!=="edit"&&Pt.filter(e=>e.path===j&&!e.resolved).map(e=>{let o=Et(e);return c("button",{"aria-label":`Open comment: ${e.text}`,title:o.map(u=>u.author).join(", "),className:`feedback-pin ${o.length>1?"feedback-pin-group":""} ${Ve===e.id?"selected":""}`,onPointerEnter:u=>{u.pointerType!=="touch"&&Mo(e)},onPointerLeave:()=>te.current?.schedule(),style:{left:Ce(e).x,top:Ce(e).y},onClick:()=>Na(e),children:[o.slice(0,3).map((u,f)=>s("span",{className:"feedback-avatar","aria-hidden":"true",children:u.authorImage?s("img",{src:u.authorImage,alt:"",width:24,height:24}):u.author.slice(0,1).toUpperCase()},f)),o.length>3&&c("span",{className:"feedback-avatar feedback-pin-more","aria-hidden":"true",children:["+",o.length-3]})]},e.id)}),$&&W&&s(oo,{target:$.selector?W.querySelector($.selector):null,text:Ea,onText:Qe,onDraftChange:e=>{pt.current=e},draftKey:`${ia}:body`,onDiscard:ue,hidden:me?.type==="create"||me?.type==="edit"&&me.id===ye,editing:!!ye,commentId:ye??void 0,renderComposer:m?.renderComposer,changes:C.find(e=>e.id===ye)?.changes,hasExistingAttachments:!!C.find(e=>e.id===ye)?.attachments?.length,onCancel:()=>{_t(ye?ct.current:null),qe(null),Qe(""),ca(null)},onPost:(e,o,u,f,k)=>ze(ye?{type:"edit",id:ye,text:o,changes:e,body:u,attachmentTokens:f}:{type:"create",body:u,attachmentTokens:f,comment:{id:Ke.current??(Ke.current=crypto.randomUUID()),path:j,...$,breakpoint:wa,context:Pe.current?.context??{width:w.current?.contentWindow?.innerWidth??de,height:w.current?.contentWindow?.innerHeight??900,url:window.location.origin+j,capturedAt:new Date().toISOString()},text:o,author:a.name,authorId:a.id,authorImage:a.image,date:new Date().toISOString(),resolved:!1,replies:[],changes:e}},k),style:{left:Ce($).x+44,top:Ce($).y}},`${$.selector}:${$.x}:${$.y}`)]})]}),[-1,1].map(e=>s("div",{className:"feedback-preview-resize","data-edge":e===-1?"left":"right",role:"separator","aria-label":`Resize preview from ${e===-1?"left":"right"} edge`,"aria-orientation":"vertical","aria-valuemin":320,"aria-valuemax":Ne,"aria-valuenow":de,tabIndex:0,title:"Drag to resize \xB7 Arrow keys to adjust",onPointerDown:o=>Ar(o,e),onPointerMove:Mr,onPointerUp:()=>{yt()},onPointerCancel:()=>{yt(!0)},onLostPointerCapture:()=>{yt(!0)},onKeyDown:o=>{if(o.key==="Escape"){o.preventDefault(),yt(!0);return}o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),o.stopPropagation(),Ze(de+(o.key==="ArrowRight"?1:-1)*e*(o.shiftKey?50:10),!0))}},e))]})}),c("div",{className:"feedback-toolbar",role:"group","aria-label":"Preview mode",children:[zt&&c("button",{title:"Edit styles","aria-keyshortcuts":"E","aria-pressed":A==="edit",onClick:()=>vt("edit"),children:[s(Ia,{}),s("span",{children:"Edit"})]}),c("button",{title:"Add comments","aria-keyshortcuts":"C","aria-pressed":A==="comment",onClick:()=>vt("comment"),children:[s(La,{}),s("span",{children:"Comment"})]}),c("button",{title:"View website","aria-keyshortcuts":"V","aria-pressed":A==="view",onClick:()=>vt("view"),children:[s(Da,{}),s("span",{children:"View"})]})]}),c("div",{className:"feedback-toolbar feedback-breakpoints",role:"group","aria-label":"Preview breakpoint",children:[c("label",{className:"feedback-preview-width",children:[s("input",{"aria-label":"Preview width",title:`Preview width \xB7 320\u2013${Ne}px`,inputMode:"numeric",value:N??String(de),onFocus:e=>{we(e.currentTarget.value),e.currentTarget.select()},onChange:e=>we(e.target.value),onBlur:e=>{N!==null&&Dr(e.currentTarget.value)},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),e.currentTarget.blur()),e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),we(null))}}),s("span",{"aria-hidden":"true",children:"px"})]}),Nt.map(({key:e,label:o,width:u,shortcut:f,Icon:k})=>c("button",{type:"button","aria-label":o,title:`${o} \xB7 ${u}px \xB7 ${f} \xB7 ${Ae[e].open} open, ${Ae[e].unread} unread`,"aria-keyshortcuts":f,"aria-description":`${Ae[e].open} open comments, ${Ae[e].unread} unread comments`,"aria-pressed":wa===e,onClick:()=>{Ze(u)},children:[s(k,{"aria-hidden":"true"}),(Ae[e].open>0||Ae[e].unread>0)&&c("sup",{"aria-hidden":"true",children:[Ae[e].open,Ae[e].unread>0&&`\xB7${Ae[e].unread}`]})]},e))]})]}),s("aside",{className:"feedback-sidebar",hidden:A==="edit"||Se,children:c("div",{className:"feedback-sidebar-panel",children:[c("div",{className:"feedback-sidebar-title",children:[c("h1",{children:["Comments ",s("span",{children:Pt.length})]}),c("details",{className:"feedback-account",children:[s("summary",{title:`Signed in as ${a.name}`,"aria-label":`Account: ${a.name}`,children:s("span",{className:"feedback-avatar",children:a.image?s("img",{src:a.image,alt:"",width:27,height:27}):a.name.slice(0,1).toUpperCase()})}),c("div",{children:[s("strong",{children:a.name}),s("span",{children:a.email}),G&&s("a",{href:G,target:"_blank",rel:"noopener noreferrer",children:"Connect your agent"}),M&&s("a",{href:M,children:"My projects"}),c("button",{onClick:async()=>{try{await r(),window.location.reload()}catch{Z("Sign out failed. Please try again.")}},children:[s(Za,{}),"Sign out"]})]})]})]}),c("label",{className:"feedback-search",children:[s(Ja,{"aria-hidden":"true",size:18}),s("input",{type:"search","aria-label":"Search comments",placeholder:"Search",value:ht,onChange:e=>wr(e.target.value)})]}),n&&(n.status!=="connected"||n.participants.length>0||Qt>0)&&c("div",{className:"feedback-collaboration","aria-label":"Review activity",children:[n.status!=="connected"&&s("span",{role:"status",children:n.status==="connecting"||n.status==="initial"?"Connecting\u2026":"Reconnecting\u2026"}),s("div",{className:"feedback-reviewers",children:n.participants.map(e=>s("span",{className:"feedback-avatar",title:`${e.name} \xB7 ${e.path}`,"aria-label":`${e.name} is reviewing ${e.path}`,children:e.image?s("img",{src:e.image,alt:"",width:24,height:24}):e.name.slice(0,1).toUpperCase()},e.id))}),Qt>0&&c("span",{className:"feedback-unread-count",children:[Qt," unread"]})]}),s("div",{className:"feedback-tabs",role:"group","aria-label":"Filter comments",children:["open","resolved","all"].map(e=>s("button",{"aria-pressed":Oa===e,onClick:()=>kr(e),children:e[0].toUpperCase()+e.slice(1)},e))}),dt&&c("section",{className:"feedback-guide","aria-label":"Quick start",children:[s("strong",{children:"Leave feedback"}),c("ul",{children:[c("li",{children:[s(La,{"aria-hidden":"true"}),"Click to comment"]}),c("li",{children:[s(da,{"aria-hidden":"true"}),"Drag to mark an area"]}),c("li",{children:[s(Da,{"aria-hidden":"true"}),"Use View to interact"]})]}),S&&s("p",{children:"A screenshot is saved with your comment."}),s("button",{type:"button",onClick:()=>{try{localStorage.setItem(`chisel:guide:${a.id}`,"1")}catch{}ka(!1)},children:"Got it"})]}),I&&c("p",{className:"feedback-notice",role:"status",children:[I,s("button",{type:"button","aria-label":"Dismiss message",onClick:()=>U(""),children:s(Ma,{size:14})})]}),xe.map(e=>c("p",{className:"feedback-notice",children:["Comment saved; its snapshot could not be attached. ",s("button",{type:"button",onClick:async()=>{try{await S?.(e.id,e.file),ge(o=>o.filter(u=>u.id!==e.id))}catch{U("Snapshot still unavailable. Your comment is saved.")}},children:"Retry snapshot"})]},e.id)),xt&&s("p",{role:"alert",className:"feedback-error",children:xt}),c("div",{className:"feedback-comment-list",children:[Ro.map(e=>c("article",{onPointerEnter:o=>{!h&&o.pointerType!=="touch"&&Mo(e)},onPointerLeave:()=>te.current?.schedule(),className:`feedback-comment ${(h?X.has(e.id):Ve===e.id)?"active":""}`,children:[d&&h&&s("label",{className:"feedback-comment-select",children:s("input",{type:"checkbox","aria-label":`Select comment: ${e.text}`,checked:X.has(e.id),onChange:()=>vo(e.id)})}),c("button",{className:"feedback-comment-main","aria-pressed":h?X.has(e.id):Ve===e.id,onClick:()=>h?vo(e.id):Na(e),children:[c("span",{className:"feedback-comment-heading",children:[s("span",{className:"feedback-avatar",children:e.authorImage?s("img",{src:e.authorImage,alt:"",width:28,height:28}):e.author.slice(0,1).toUpperCase()}),c("span",{className:"feedback-comment-identity",children:[c("span",{className:"feedback-comment-meta",children:[s("strong",{children:e.author}),e.pending?s("span",{role:"status",children:"Sending\u2026"}):s("time",{dateTime:e.date,children:new Date(e.date).toLocaleDateString(void 0,{month:"short",day:"numeric"})})]}),c("span",{className:"feedback-comment-status",children:[(Oa==="all"||e.status==="ready")&&c(lt,{children:[e.status==="ready"?"Ready for review":e.resolved?"Resolved":"Open",s("span",{"aria-hidden":"true",children:" \xB7 "})]}),s("span",{className:"feedback-comment-path",title:e.path,children:e.path})]})]}),ya.has(e.id)&&s("span",{className:"feedback-comment-unread-dot","aria-hidden":"true"})]}),s("span",{className:"feedback-comment-body",children:e.text||e.attachments?.map(o=>o.name).join(", ")}),(e.replies.length>0||ya.has(e.id))&&c("span",{className:"feedback-comment-activity",children:[e.replies.length>0&&c(lt,{children:[s("span",{className:"feedback-comment-avatars",children:Et(e).slice(1,4).map((o,u)=>s("span",{className:"feedback-avatar",title:o.author,children:o.authorImage?s("img",{src:o.authorImage,alt:"",width:20,height:20}):o.author.slice(0,1).toUpperCase()},u))}),c("span",{className:"feedback-comment-reply-count",children:[e.replies.length," ",e.replies.length===1?"reply":"replies"]})]}),ya.has(e.id)&&s("span",{className:"feedback-unread-label",children:e.replies.length?"New replies":"Unread"})]})]})]},e.id)),gt&&s("p",{role:"status",children:"Loading shared comments\u2026"}),!gt&&!Ro.length&&c("div",{className:"feedback-empty",children:[s("span",{children:s(La,{size:30})}),s("h2",{children:ht.trim()?"No matching comments":Oa==="resolved"?"Nothing resolved yet":"No comments yet"}),s("p",{children:ht.trim()?"Try another name, phrase, or page.":Oa==="resolved"?"Resolved threads will appear here.":"Click anywhere on the page to leave your first comment."})]})]}),s(lo,{path:j,counts:Fo,disabled:Ue||!W,onNavigate:Rr,onOpen:Br,routes:[...new Set([j,...st,...it,...C.map(e=>e.path)])].filter(e=>W&&ba(e,window.location.origin)).sort((e,o)=>e.localeCompare(o))}),d&&C.length>0&&c("details",{className:"feedback-export",open:h,children:[c("summary",{onClick:e=>{e.preventDefault(),b(!h),ne(new Set)},children:[s(va,{size:16}),"Export feedback for agents",s(oa,{size:14})]}),c("div",{children:[s("span",{children:X.size?`${X.size} selected`:"Select comments above"}),c("button",{type:"button",disabled:!X.size,onClick:()=>{Pr()},children:[s(va,{size:14}),"Copy feedback"]})]})]}),p&&d&&c("details",{className:"feedback-review-invite",children:[c("summary",{children:[s(oa,{"aria-hidden":"true"}),"Share review link"]}),c("form",{onSubmit:e=>{e.preventDefault(),Po()},children:[s("p",{children:"Anyone with this link can sign in and review this website."}),s("button",{type:"submit",className:"feedback-primary",disabled:bt,children:bt?"Preparing link\u2026":"Copy review link"}),bo&&c(lt,{children:[s("input",{"aria-label":"Review link",value:bo,readOnly:!0,onFocus:e=>e.currentTarget.select()}),s("button",{type:"button",onClick:()=>{Po(!0)},disabled:bt,children:"Replace invitation link"}),s("p",{children:"Replacing the link blocks new joins through the old link. Existing reviewers keep access."})]}),ko&&s("p",{role:"status",children:ko})]})]})]})})]})]})}import{useEffect as Lr,useSyncExternalStore as Al}from"react";import{Chisel as Ml}from"use-chisel";import{jsx as Tl}from"react/jsx-runtime";function Bl(a){return window.addEventListener("chisel:mode",a),()=>window.removeEventListener("chisel:mode",a)}function Rl(){try{return window.self!==window.top&&window.parent.location.origin===window.location.origin&&window.parent.location.pathname==="/chisel"?document.documentElement.dataset.chiselMode??"view":"site"}catch{return"site"}}function Fl({projectName:a="Chisel"}){let t=Al(Bl,Rl,()=>"site");return Lr(()=>{process.env.NEXT_PUBLIC_CHISEL_ENABLED!=="0"&&(window.chiselReady=!0,document.dispatchEvent(new Event("chisel:ready")))},[]),Lr(()=>{if(t!=="edit")return;let r=window.setTimeout(()=>window.dispatchEvent(new Event("chisel:select")),50);return()=>window.clearTimeout(r)},[t]),t==="site"||process.env.NODE_ENV==="production"||process.env.NEXT_PUBLIC_CHISEL_ENABLED==="0"?null:Tl(Ml,{embedded:!0,enabled:t==="edit",projectName:a})}export{Fl as ChiselPreview,gr as ChiselWorkspace,no as ChiselWorkspaceStyles};
28
28
  /*! Bundled license information:
29
29
 
30
30
  lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-chisel",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Hosted website reviews and visual editing for Next.js.",
5
5
  "type": "module",
6
6
  "keywords": [