use-chisel 0.1.11 → 0.1.13

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.
package/README.md CHANGED
@@ -21,7 +21,7 @@ Return to your projects from the account menu or the hosted `/chisel/projects` p
21
21
  ## Review workflow
22
22
 
23
23
  - Copy a thread link to reopen its page, breakpoint, and exact captured width,
24
- including after sign-in. Links require existing review access.
24
+ including after sign-in. Anyone with the website's review link can sign in and review.
25
25
  - The thread header's status pill shows **Open**, **Ready**, or **Resolved**.
26
26
  Owners choose Ready for review; the comment author confirms by selecting
27
27
  Resolved, or selects Open if more work is needed. Changes appear immediately
@@ -74,7 +74,8 @@ idempotent. The demo uses authenticated Supabase endpoints with server-derived
74
74
  authors; see `apps/demo/lib/comments.ts` and `supabase/` for its adapter, migrations,
75
75
  and reviewer access policies.
76
76
  `canManageComments` exposes management controls for other reviewers’ threads; optional
77
- `getReviewLink(rotate?)` enables sharing a client review link.
77
+ `getReviewLink()` enables sharing the website's review URL. Visitors can sign in
78
+ without an invitation token or manual approval.
78
79
  The host must enforce
79
80
  these permissions in its backend as the demo does. The tweak editor is development-only. The standalone API below remains
80
81
  supported.
@@ -106,7 +107,9 @@ replies, resolution, review links, reviewer presence, and unread indicators.
106
107
  Review sign-in is remembered across tabs and browser restarts on the same
107
108
  website. Sessions expire after 30 days of inactivity and renew during use.
108
109
  Temporary connection failures keep the saved sign-in; signing out clears it
109
- across tabs. Project access and website origin are still checked on every request.
110
+ across tabs. Each session stays bound to its website and origin. Signing in through
111
+ the website's review link automatically grants reviewer access; owner and author
112
+ permissions still control editing and management actions.
110
113
 
111
114
  The generated route defaults off in production. To use it on a deployed review
112
115
  site, set `CHISEL_ENABLED=1` for that deployment and redeploy. Hosted connections
@@ -155,6 +158,34 @@ import { EditableRegion } from "use-chisel"
155
158
 
156
159
  Chisel persists route versions in the browser. Local image files are previewed only for the current session; after a reload, re-select the file when prompted. Chisel inspects same-document light DOM. Cross-origin iframes and closed shadow roots are not supported.
157
160
 
161
+ ## Hosted UI updates
162
+
163
+ After installing a release that includes the hosted UI loader, `HostedChisel`
164
+ loads the current compatible interface from Chisel's HTTPS service. While the UI
165
+ is open, it checks for a new build once per minute and when the tab becomes
166
+ visible or focused. A Sonner toast offers **Update**; it switches the UI without
167
+ reinstalling the npm package or redeploying the customer's website.
168
+
169
+ Updates wait until comments, replies, edits and uploads have finished or their
170
+ drafts have been closed. A draft created while downloading also blocks the switch.
171
+ The loader verifies the script's integrity before executing it. If downloading or
172
+ starting an update fails, the working UI remains available; initial loading can
173
+ fall back to the interface bundled with the installed package. Sessions, thread
174
+ URLs and saved feedback continue to use the existing project.
175
+
176
+ The hosted interface shares the website's React runtime and development/production
177
+ mode. Websites with a Content Security Policy must allow
178
+ `https://chisel-review.vercel.app` in both `script-src` and `connect-src`; if remote
179
+ scripts are blocked, the bundled UI still works. Chisel uses a dedicated Sonner
180
+ toaster so its notices stay separate from the customer's toasts.
181
+
182
+ `npm --workspace use-chisel run build` generates the versioned UI script and
183
+ `manifest.json` in `apps/demo/public/chisel-ui/`. Deploy them together with the
184
+ hosted service. The manifest is not cached; scripts are content-addressed and
185
+ integrity checked. Only UI protocol 1 is accepted by this loader. Changes to the
186
+ Next.js integration, generated routes or loader protocol still require an npm
187
+ upgrade and website redeployment. Publishing npm alone does not deploy UI assets.
188
+
158
189
  ## Publish
159
190
 
160
191
  ```bash
@@ -1,5 +1,5 @@
1
- "use client";import{useCallback as u,useEffect as F,useMemo as H,useRef as g,useState as v}from"react";import{ChiselWorkspace as ye,ChiselWorkspaceStyles as J}from"use-chisel/workspace";import{ReviewComposer as ke,ReviewThread as Se,useReviewAttachments as Te,useReadQueue as Ce,uploadSnapshot as Ee}from"use-chisel/review";import{publicReviewURL as Re}from"use-chisel/review-content";var ee=`.chisel-review{font-family:var(--chisel-ui-font);-webkit-font-smoothing:antialiased}.chisel-review .comment-thread[data-native-ui=true]{padding:0;gap:0;border:0;border-radius:16px;background:var(--chisel-ui-surface);box-shadow:0 0 0 1px var(--chisel-ui-border),0 8px 32px #00000014;font-size:14px}.chisel-review .comment-thread[data-native-ui=true] .feedback-preview{margin:4px 12px 0;border-radius:8px}.chisel-review .comment-thread[data-native-ui=true] form{width:100%}.chisel-review-thread-content{width:100%;min-width:0}.chisel-review-message{display:flex;gap:12px;padding:16px}.chisel-review-message-content{min-width:0;flex:1}.chisel-review-avatar{width:32px;height:32px;flex-shrink:0}.chisel-review-avatar img,.chisel-review .feedback-reply-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.chisel-review-byline{display:flex;gap:8px;flex-wrap:wrap;align-items:baseline;line-height:1.5}.chisel-review-byline strong{font-weight:500}.chisel-review-byline time{color:var(--chisel-ui-secondary);font-size:12px;font-variant-numeric:tabular-nums}.chisel-rich-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;color:var(--chisel-ui-text)}.chisel-rich-body p,.chisel-rich-editor p{margin:0;min-height:1.5em}.chisel-rich-body a,.chisel-rich-editor a{color:var(--chisel-ui-accent-text);text-decoration:underline;text-underline-offset:2px}.chisel-rich-body code,.chisel-rich-editor code{font:.9em ui-monospace,monospace;background:var(--chisel-ui-inset);padding:1px 3px;border-radius:4px}.chisel-review .chisel-expand-thread{margin:0 16px 12px 60px;min-height:40px;padding:0;background:transparent;color:var(--chisel-ui-accent-text)}.chisel-review-reply{display:flex;align-items:flex-start;gap:12px;padding:16px;border-top:1px solid var(--chisel-ui-border)}.chisel-rich-editor{min-width:0;min-height:40px;max-height:min(180px,30dvh);overflow-y:auto;padding:8px;font-size:14px;line-height:1.5;outline:none;overflow-wrap:anywhere}.chisel-review-reply .chisel-rich-editor{padding:12px 14px;min-height:44px}.chisel-review .comment-box-native{border:0;border-radius:var(--chisel-ui-radius);box-shadow:0 0 0 1px var(--chisel-ui-border),0 8px 32px #00000014;font:inherit}.chisel-review .comment-box-native>form{display:flex;flex-direction:column;min-height:0;height:100%;flex:1}.chisel-review .comment-box-native .comment-box-prompt{align-items:flex-start;padding:8px;gap:0}.chisel-review .comment-box-native .comment-box-symbol{margin-top:0;background:transparent;border-radius:8px}.chisel-review .comment-box-native .comment-box-footer{background:var(--chisel-ui-surface);border-top:1px solid var(--chisel-ui-border)}.chisel-review .comment-box-native .comment-box-cancel{border:0;border-radius:8px;background:transparent;font:inherit}.chisel-review .comment-box-native .comment-box-submit{border-radius:8px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.chisel-review .comment-box-native .comment-box-element{background:var(--chisel-ui-inset)}.chisel-review .comment-box-native .comment-box-properties{background:var(--chisel-ui-surface)}.chisel-review .feedback-comment{border-radius:var(--chisel-ui-radius)}.chisel-review .comment-thread[data-expanded=false] .chisel-rich-body{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;max-height:4.5em;overflow:hidden}.chisel-review [data-slate-placeholder]{color:var(--chisel-ui-secondary);opacity:1!important}.chisel-review .chisel-reply-field{position:relative;flex:1;min-width:0;border:1px solid var(--chisel-ui-border);border-radius:16px;background:var(--chisel-ui-raised)}.chisel-review .chisel-reply-submit{position:absolute;right:4px;bottom:4px;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:50%;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.chisel-review .feedback-reply-avatar{width:32px;height:32px;margin-top:8px}.chisel-composer-input{flex:1;min-width:0;max-height:min(320px,42dvh);overflow:auto}.chisel-attachment-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:0 8px;font-size:12px;color:var(--chisel-ui-secondary)}.chisel-review-reply .chisel-attachment-controls{padding-right:48px}.chisel-formatting-tools button{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);transition:background .15s,scale .15s}.chisel-formatting-tools button:hover{background:var(--chisel-ui-hover)}.chisel-formatting-tools button[aria-pressed=true]{color:var(--chisel-ui-accent-text);background:var(--chisel-ui-accent-surface)}.chisel-formatting-tools{display:flex;gap:0;flex-wrap:wrap;padding:0 4px}.chisel-formatting-tools button:active{scale:.96}.chisel-link-dialog{display:flex;flex-wrap:wrap;gap:6px;padding:8px;border-top:1px solid var(--chisel-ui-border);background:var(--chisel-ui-surface)}.chisel-link-dialog label{flex:1;min-width:120px;font-size:12px;color:var(--chisel-ui-secondary)}.chisel-link-dialog input{display:block;width:100%;height:40px;background:var(--chisel-ui-inset);border:1px solid var(--chisel-ui-border);border-radius:6px;color:var(--chisel-ui-text);padding:6px}.chisel-link-dialog button{align-self:flex-end;min-height:40px;min-width:40px;padding:6px;border:0;border-radius:6px;background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.chisel-link-dialog [role=alert]{width:100%;color:var(--chisel-ui-danger);font-size:12px}.chisel-attachment-error{color:var(--chisel-ui-danger);line-height:1.5}.chisel-attachment-previews{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px;max-height:240px;overflow:auto}.chisel-attachment-preview{position:relative;min-width:0;overflow:hidden;border:1px solid var(--chisel-ui-border);border-radius:8px;background:var(--chisel-ui-surface)}.chisel-attachment-preview>img,.chisel-attachment-preview>a>img,.chisel-attachment-preview>video{display:block;width:100%;height:100px;object-fit:contain;background:var(--chisel-ui-inset);outline:1px solid #0000001a;outline-offset:-1px}.chisel-attachment-preview>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;font-size:12px}.chisel-attachment-preview>button:not(.review-media-thumbnail){position:absolute;top:0;right:0;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:0 8px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text)}.chisel-attachment-preview>.chisel-attachment-retry{right:40px;border-radius:0 0 0 8px}.chisel-attachment-preview>.chisel-attachment-load{position:static;width:100%;height:auto;min-height:100px;padding:8px}.comment-thread .feedback-thread-header{position:sticky;top:0;z-index:1;background:var(--chisel-ui-surface)}.chisel-review .comment-thread[data-native-ui=true][data-expanded=false]{border-radius:16px 16px 16px 0}@media(prefers-color-scheme:dark){.chisel-attachment-preview>img,.chisel-attachment-preview>a>img,.chisel-attachment-preview>video{outline-color:#ffffff1a}}@media(prefers-reduced-motion:reduce){.chisel-formatting-tools button{transition:none}}
2
- `;var ie=`.feedback-shell.chisel-review .comment-thread[data-native-ui=true],.feedback-shell.chisel-review .comment-box-native{border:0;border-radius:16px;background:var(--chisel-ui-surface);box-shadow:var(--chisel-ui-popover-shadow)}.feedback-shell.chisel-review .comment-thread[data-expanded=false]{border-radius:16px 16px 16px 0}.chisel-review-thread-content,.review-thread,.review-comment-content{width:100%;min-width:0}.review-capture-context{margin:4px 12px 8px;font-size:12px;line-height:18px;color:var(--chisel-ui-muted);overflow-wrap:anywhere}.review-comment,.feedback-shell.chisel-review .chisel-review-message{display:flex;align-items:flex-start;gap:12px;padding:12px 20px}.review-comment-content,.chisel-review-message-content{flex:1;min-width:0}.review-comment-avatar{display:grid;place-items:center;flex-shrink:0;width:28px;height:28px;border-radius:50%;overflow:hidden;background:var(--chisel-ui-avatar);color:var(--chisel-ui-avatar-text);font-size:12px}.review-comment-avatar img{width:100%;height:100%;object-fit:cover}.review-comment-header,.chisel-review-byline{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;line-height:20px;margin-bottom:4px}.review-comment-author{font-size:13px;font-weight:500;overflow-wrap:anywhere}.review-comment-time{font-size:12px;color:var(--chisel-ui-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.review-comment-header{position:relative;padding-right:32px}.review-comment-edit{position:absolute;right:-8px;top:-10px;display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-muted);opacity:0;transition:opacity .12s,background .12s}.review-comment:hover .review-comment-edit,.review-comment:focus-within .review-comment-edit,.review-comment-edit:focus-visible{opacity:1}.review-comment-edit:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}@media(hover:none){.review-comment-edit{opacity:1}}.review-inline-edit{border:1px solid var(--chisel-ui-border);border-radius:10px;padding:8px}.review-inline-edit-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:8px}.review-inline-edit-actions button{min-height:40px;padding:0 10px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text)}.review-inline-edit-actions button:last-child{background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.review-inline-edit-actions button:not(:last-child):hover{background:var(--chisel-ui-hover)}.review-inline-edit-actions button:disabled{opacity:.45}@media(pointer:coarse){.review-inline-edit-actions button{min-height:44px}}.review-comment-body,.chisel-rich-body{font-size:14px;line-height:21px;white-space:pre-wrap;overflow-wrap:anywhere}.review-comment-body p{margin:0;min-height:21px}.review-comment-body p+p{margin-top:8px}.review-comment-body a{color:var(--chisel-ui-accent-text);text-decoration:underline;text-underline-offset:3px}.review-comment-body code{font:12px/1.5 ui-monospace,SFMono-Regular,monospace;background:var(--chisel-ui-inset);border-radius:4px;padding:2px 4px}.review-composer{margin:0}.feedback-shell.chisel-review .chisel-review-reply{display:flex;align-items:flex-start;gap:12px;border:0;padding:20px}.feedback-shell.chisel-review .chisel-review-reply[hidden]{display:none}.feedback-shell.chisel-review .feedback-reply-avatar{width:28px;height:28px;margin-top:8px}.feedback-shell.chisel-review .chisel-reply-field{position:relative;flex:1;min-width:0;min-height:48px;border:0;border-radius:12px;background:var(--chisel-ui-raised)}.review-composer-editor{min-width:0;min-height:40px;max-height:min(180px,30dvh);overflow:auto;padding:10px 12px;font-size:14px;line-height:21px;overflow-wrap:anywhere;outline:none}.review-composer-editor p{margin:0}.review-composer-editor>p,.chisel-rich-editor>p{position:relative}.feedback-shell.chisel-review .chisel-review-reply :is(.review-composer-editor,.chisel-rich-editor){padding-right:56px}.feedback-shell.chisel-review .chisel-reply-submit{position:absolute;right:4px;bottom:4px;display:grid;place-items:center;width:40px;height:40px;min-height:40px;padding:0;border:0;border-radius:8px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.chisel-reply-submit:disabled{opacity:.35}.feedback-shell.chisel-review .comment-box-native>form{display:flex;flex-direction:column;flex:1;min-height:0;height:100%}.feedback-shell.chisel-review .comment-box-native .comment-box-prompt{align-items:flex-start;padding:8px;gap:0}.feedback-shell.chisel-review .comment-box-native .comment-box-footer{border:0;background:var(--chisel-ui-surface)}.feedback-shell.chisel-review .comment-box-native .comment-box-element{background:var(--chisel-ui-raised)}.feedback-shell.chisel-review .comment-box-native .comment-box-cancel{border:0;border-radius:8px;background:transparent}.feedback-shell.chisel-review .comment-box-native .comment-box-cancel:hover{background:var(--chisel-ui-hover)}.feedback-shell.chisel-review .comment-box-native .comment-box-submit{border-radius:8px}.chisel-composer-input{flex:1;min-width:0;max-height:min(320px,42dvh);overflow:auto}.chisel-attachment-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:0 8px;color:var(--chisel-ui-secondary);font-size:12px;line-height:18px}.chisel-review-reply .chisel-attachment-controls{padding-right:48px}.chisel-attachment-error{color:var(--chisel-ui-danger);line-height:1.5}.chisel-attachment-previews,.review-attachments{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px;max-height:240px;overflow:auto}.review-attachments{padding:12px 0 0;max-height:none}.feedback-shell.chisel-review .chisel-attachment-preview,.review-attachment{position:relative;min-width:0;margin:0;overflow:hidden;border:0;border-radius:8px;background:var(--chisel-ui-raised)}.chisel-attachment-preview>img,.chisel-attachment-preview>video,.review-media-thumbnail img,.review-media-thumbnail video{display:block;width:100%;height:120px;object-fit:contain;background:var(--chisel-ui-inset)}.review-attachment figcaption{padding:8px;font-size:12px;line-height:18px;overflow-wrap:anywhere}.review-attachment-placeholder{min-height:100px;display:grid;place-items:center;padding:12px;color:var(--chisel-ui-secondary);font-size:12px}.chisel-attachment-preview>button:not(.review-media-thumbnail){position:absolute;top:0;right:0;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:0 8px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text)}.review-retry-upload{display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text);font:inherit}.review-retry-upload:hover{background:var(--chisel-ui-hover)}.chisel-attachment-controls .review-retry-upload[aria-label]{min-width:40px;justify-content:center}.chisel-attachment-preview>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;font-size:12px}.feedback-shell.chisel-review .chisel-expand-thread{display:inline-flex;align-items:center;margin:0 20px 8px 60px;min-height:40px;padding:0;border:0;background:transparent;color:var(--chisel-ui-secondary);font-size:13px}.chisel-review [data-slate-placeholder]{opacity:1!important;color:var(--chisel-ui-secondary)}@media(pointer:coarse){.feedback-shell.chisel-review .chisel-reply-submit{width:44px;height:44px}.chisel-review-reply .chisel-attachment-controls{padding-right:52px}.feedback-shell.chisel-review .chisel-reply-field{min-height:52px}.feedback-shell.chisel-review .chisel-review-reply :is(.review-composer-editor,.chisel-rich-editor){padding-right:60px}}@media(forced-colors:active){.feedback-shell.chisel-review .comment-thread[data-native-ui=true],.feedback-shell.chisel-review .comment-box-native,.feedback-shell.chisel-review .chisel-reply-field{border:1px solid CanvasText;box-shadow:none}.review-comment-avatar{border:1px solid CanvasText}}.review-media-thumbnail{position:relative;display:block;width:100%;padding:0;border:0;background:var(--chisel-ui-inset);cursor:pointer}.review-media-thumbnail img,.review-media-thumbnail video{display:block;width:100%;height:120px;object-fit:contain}.review-media-play{position:absolute;inset:50% auto auto 50%;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:#0009;color:#fff;transform:translate(-50%,-50%)}.review-media-lightbox{position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:24px;border:0;background:transparent;color:var(--chisel-ui-text)}.review-media-lightbox[open]{display:flex;align-items:center;justify-content:center}.review-media-lightbox::backdrop{background:#000b}.review-media-lightbox-content{display:flex;flex-direction:column;width:fit-content;min-width:min(320px,100%);max-width:min(100%,1000px);max-height:100%;margin:auto;border-radius:12px;overflow:hidden;background:var(--chisel-ui-surface);box-shadow:0 16px 48px #0006}.review-media-lightbox-content header{display:flex;align-items:center;gap:12px;min-height:56px;padding:8px 12px 8px 16px}.review-media-lightbox-content header span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.review-media-lightbox-content header a{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:40px;min-height:40px;padding:0;border-radius:8px;color:var(--chisel-ui-text);font-size:13px}.review-media-lightbox-content header a:hover{background:var(--chisel-ui-hover)}.review-media-lightbox-content header button{display:grid;place-items:center;flex-shrink:0;width:40px;height:40px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text)}.review-media-lightbox-content header button:hover{background:var(--chisel-ui-hover)}.review-media-lightbox-content>img,.review-media-lightbox-content>video{display:block;min-height:0;max-width:100%;max-height:calc(100dvh - 104px);margin:auto;object-fit:contain;background:#000}
3
- `;import{Fragment as Le,jsx as d,jsxs as b}from"react/jsx-runtime";var x="https://chisel-review.vercel.app";function re(l,n){try{localStorage.setItem(l,n),sessionStorage.removeItem(l);return}catch{}try{sessionStorage.setItem(l,n)}catch{}}function X(l){try{localStorage.removeItem(l)}catch{}try{sessionStorage.removeItem(l)}catch{}}function Pe(l){let n="";try{n=localStorage.getItem(l)||""}catch{}if(!/^[0-9a-f]{64}$/.test(n))try{n=sessionStorage.getItem(l)||""}catch{}return/^[0-9a-f]{64}$/.test(n)?(re(l,n),n):""}function te(l){return Array.isArray(l)?l.filter(n=>n&&typeof n.id=="string"&&typeof n.name=="string"&&typeof n.path=="string").map(n=>({id:n.id,name:n.name.slice(0,100),path:n.path.slice(0,2048),image:typeof n.image=="string"&&/^https?:\/\//.test(n.image)?n.image:null})):[]}function Me({projectId:l}){let n=`chisel:session:${l}`,o=g(""),Y=g(n),[ne,O]=v(0),[m,j]=v(null),[ae,q]=v(!0),[P,k]=v(""),[oe,y]=v(!1),[K,S]=v([]),[se,N]=v([]),[ce,M]=v("connecting"),L=g("/"),z=g(!1),[le,de]=v(0),W=g(new Set),f=u(()=>{for(let e of W.current)e()},[]),T=g(null);T.current=m;let A=g(null),I=g(""),p=u(async(e,i,t,a,r=!1)=>{let c=o.current,h=await fetch(`${x}/chisel/api/hosted/${e}`,{method:i,headers:{Authorization:`Bearer ${c}`,...t?{"Content-Type":"application/json","X-Chisel-Protocol":"2"}:{}},...t?{body:JSON.stringify(t)}:{},signal:a,keepalive:r}),s=await h.json().catch(()=>null);if(c!==o.current)throw new Error("Your Chisel account changed. Please retry.");if(!h.ok)throw h.status===401&&c===o.current&&T.current&&y(!0),Object.assign(new Error(s?.error||"Chisel is unavailable. Please try again."),{status:h.status});if(!s||typeof s!="object")throw new Error("Chisel is unavailable. Please try again.");if(s.siteId&&s.siteId!==l)throw new Error("This session belongs to another project.");return s},[l]),w=u((e,i)=>p(e==="GET"?`comments?path=${encodeURIComponent(L.current)}`:"comments",e,i),[p]),B=H(()=>{let e=0;return{async list(){let i=++e,t=await w("GET");return i===e&&(S(t.comments),z.current||N(te(t.participants))),t.comments},async mutate(i){++e;let t=(await w("POST",i)).comment;return++e,S(a=>a.some(r=>r.id===t.id)?a.map(r=>r.id===t.id?t:r):[...a,t]),window.setTimeout(f,0),t},async delete(i){++e,await w("POST",{type:"delete",id:i}),++e,S(t=>t.filter(a=>a.id!==i)),window.setTimeout(f,0)},subscribe(i){return W.current.add(i),()=>{W.current.delete(i)}}}},[w,f]),he=u(async(e,i)=>{await w("POST",{type:"read",id:e,activity:i})},[w]),pe=u((e,i)=>{S(t=>t.map(a=>a.id===e?{...a,readActivity:Math.max(a.readActivity??0,i)}:a))},[]),{flush:Q,markDisplayed:ue}=Ce(he,pe);F(()=>{if(!m)return;let e=!0,i,t,a=new AbortController,r=()=>{document.visibilityState==="visible"&&(clearTimeout(t),t=setTimeout(()=>{f(),Q()},40))};async function c(){let s=!1;try{let C=o.current,$=await fetch(`${x}/chisel/api/hosted/events?path=${encodeURIComponent(L.current)}`,{headers:{Authorization:`Bearer ${C}`},signal:a.signal});if(e&&$.status===401&&C===o.current&&y(!0),!$.ok||!$.body)throw new Error("Live updates unavailable");let ge=$.body.getReader(),xe=new TextDecoder,E="";for(;e;){let{value:be,done:fe}=await ge.read();if(fe)break;E+=xe.decode(be,{stream:!0});let D;for(;(D=E.indexOf(`
1
+ "use client";import{Component as Ye,useEffect as be,useRef as D,useState as qe}from"react";import{Toaster as Je,toast as M}from"sonner";import{ChiselWorkspaceStyles as Xe}from"use-chisel/workspace";import{useCallback as S,useEffect as Y,useMemo as ie,useRef as L,useState as T}from"react";import{ChiselWorkspace as Me,ChiselWorkspaceStyles as te}from"use-chisel/workspace";import{ReviewComposer as _e,ReviewThread as Oe,useReviewAttachments as je,useReadQueue as Ne,uploadSnapshot as Be}from"use-chisel/review";import{publicReviewURL as De}from"use-chisel/review-content";var pe=`.chisel-review{font-family:var(--chisel-ui-font);-webkit-font-smoothing:antialiased}.chisel-review .comment-thread[data-native-ui=true]{padding:0;gap:0;border:0;border-radius:16px;background:var(--chisel-ui-surface);box-shadow:0 0 0 1px var(--chisel-ui-border),0 8px 32px #00000014;font-size:14px}.chisel-review .comment-thread[data-native-ui=true] .feedback-preview{margin:4px 12px 0;border-radius:8px}.chisel-review .comment-thread[data-native-ui=true] form{width:100%}.chisel-review-thread-content{width:100%;min-width:0}.chisel-review-message{display:flex;gap:12px;padding:16px}.chisel-review-message-content{min-width:0;flex:1}.chisel-review-avatar{width:32px;height:32px;flex-shrink:0}.chisel-review-avatar img,.chisel-review .feedback-reply-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}.chisel-review-byline{display:flex;gap:8px;flex-wrap:wrap;align-items:baseline;line-height:1.5}.chisel-review-byline strong{font-weight:500}.chisel-review-byline time{color:var(--chisel-ui-secondary);font-size:12px;font-variant-numeric:tabular-nums}.chisel-rich-body{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.5;color:var(--chisel-ui-text)}.chisel-rich-body p,.chisel-rich-editor p{margin:0;min-height:1.5em}.chisel-rich-body a,.chisel-rich-editor a{color:var(--chisel-ui-accent-text);text-decoration:underline;text-underline-offset:2px}.chisel-rich-body code,.chisel-rich-editor code{font:.9em ui-monospace,monospace;background:var(--chisel-ui-inset);padding:1px 3px;border-radius:4px}.chisel-review .chisel-expand-thread{margin:0 16px 12px 60px;min-height:40px;padding:0;background:transparent;color:var(--chisel-ui-accent-text)}.chisel-review-reply{display:flex;align-items:flex-start;gap:12px;padding:16px;border-top:1px solid var(--chisel-ui-border)}.chisel-rich-editor{min-width:0;min-height:40px;max-height:min(180px,30dvh);overflow-y:auto;padding:8px;font-size:14px;line-height:1.5;outline:none;overflow-wrap:anywhere}.chisel-review-reply .chisel-rich-editor{padding:12px 14px;min-height:44px}.chisel-review .comment-box-native{border:0;border-radius:var(--chisel-ui-radius);box-shadow:0 0 0 1px var(--chisel-ui-border),0 8px 32px #00000014;font:inherit}.chisel-review .comment-box-native>form{display:flex;flex-direction:column;min-height:0;height:100%;flex:1}.chisel-review .comment-box-native .comment-box-prompt{align-items:flex-start;padding:8px;gap:0}.chisel-review .comment-box-native .comment-box-symbol{margin-top:0;background:transparent;border-radius:8px}.chisel-review .comment-box-native .comment-box-footer{background:var(--chisel-ui-surface);border-top:1px solid var(--chisel-ui-border)}.chisel-review .comment-box-native .comment-box-cancel{border:0;border-radius:8px;background:transparent;font:inherit}.chisel-review .comment-box-native .comment-box-submit{border-radius:8px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.chisel-review .comment-box-native .comment-box-element{background:var(--chisel-ui-inset)}.chisel-review .comment-box-native .comment-box-properties{background:var(--chisel-ui-surface)}.chisel-review .feedback-comment{border-radius:var(--chisel-ui-radius)}.chisel-review .comment-thread[data-expanded=false] .chisel-rich-body{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;max-height:4.5em;overflow:hidden}.chisel-review [data-slate-placeholder]{color:var(--chisel-ui-secondary);opacity:1!important}.chisel-review .chisel-reply-field{position:relative;flex:1;min-width:0;border:1px solid var(--chisel-ui-border);border-radius:16px;background:var(--chisel-ui-raised)}.chisel-review .chisel-reply-submit{position:absolute;right:4px;bottom:4px;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:50%;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.chisel-review .feedback-reply-avatar{width:32px;height:32px;margin-top:8px}.chisel-composer-input{flex:1;min-width:0;max-height:min(320px,42dvh);overflow:auto}.chisel-attachment-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:0 8px;font-size:12px;color:var(--chisel-ui-secondary)}.chisel-review-reply .chisel-attachment-controls{padding-right:48px}.chisel-formatting-tools button{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);transition:background .15s,scale .15s}.chisel-formatting-tools button:hover{background:var(--chisel-ui-hover)}.chisel-formatting-tools button[aria-pressed=true]{color:var(--chisel-ui-accent-text);background:var(--chisel-ui-accent-surface)}.chisel-formatting-tools{display:flex;gap:0;flex-wrap:wrap;padding:0 4px}.chisel-formatting-tools button:active{scale:.96}.chisel-link-dialog{display:flex;flex-wrap:wrap;gap:6px;padding:8px;border-top:1px solid var(--chisel-ui-border);background:var(--chisel-ui-surface)}.chisel-link-dialog label{flex:1;min-width:120px;font-size:12px;color:var(--chisel-ui-secondary)}.chisel-link-dialog input{display:block;width:100%;height:40px;background:var(--chisel-ui-inset);border:1px solid var(--chisel-ui-border);border-radius:6px;color:var(--chisel-ui-text);padding:6px}.chisel-link-dialog button{align-self:flex-end;min-height:40px;min-width:40px;padding:6px;border:0;border-radius:6px;background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}.chisel-link-dialog [role=alert]{width:100%;color:var(--chisel-ui-danger);font-size:12px}.chisel-attachment-error{color:var(--chisel-ui-danger);line-height:1.5}.chisel-attachment-previews{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px;max-height:240px;overflow:auto}.chisel-attachment-preview{position:relative;min-width:0;overflow:hidden;border:1px solid var(--chisel-ui-border);border-radius:8px;background:var(--chisel-ui-surface)}.chisel-attachment-preview>img,.chisel-attachment-preview>a>img,.chisel-attachment-preview>video{display:block;width:100%;height:100px;object-fit:contain;background:var(--chisel-ui-inset);outline:1px solid #0000001a;outline-offset:-1px}.chisel-attachment-preview>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;font-size:12px}.chisel-attachment-preview>button:not(.review-media-thumbnail){position:absolute;top:0;right:0;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:0 8px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text)}.chisel-attachment-preview>.chisel-attachment-retry{right:40px;border-radius:0 0 0 8px}.chisel-attachment-preview>.chisel-attachment-load{position:static;width:100%;height:auto;min-height:100px;padding:8px}.comment-thread .feedback-thread-header{position:sticky;top:0;z-index:1;background:var(--chisel-ui-surface)}.chisel-review .comment-thread[data-native-ui=true][data-expanded=false]{border-radius:16px 16px 16px 0}@media(prefers-color-scheme:dark){.chisel-attachment-preview>img,.chisel-attachment-preview>a>img,.chisel-attachment-preview>video{outline-color:#ffffff1a}}@media(prefers-reduced-motion:reduce){.chisel-formatting-tools button{transition:none}}
2
+ `;var ue=`.feedback-shell.chisel-review .comment-thread[data-native-ui=true],.feedback-shell.chisel-review .comment-box-native{border:0;border-radius:16px;background:var(--chisel-ui-surface);box-shadow:var(--chisel-ui-popover-shadow)}.feedback-shell.chisel-review .comment-thread[data-expanded=false]{border-radius:16px 16px 16px 0}.chisel-review-thread-content,.review-thread,.review-comment-content{width:100%;min-width:0}.review-capture-context{margin:4px 12px 8px;font-size:12px;line-height:18px;color:var(--chisel-ui-muted);overflow-wrap:anywhere}.review-comment,.feedback-shell.chisel-review .chisel-review-message{display:flex;align-items:flex-start;gap:12px;padding:12px 20px}.review-comment-content,.chisel-review-message-content{flex:1;min-width:0}.review-comment-avatar{display:grid;place-items:center;flex-shrink:0;width:28px;height:28px;border-radius:50%;overflow:hidden;background:var(--chisel-ui-avatar);color:var(--chisel-ui-avatar-text);font-size:12px}.review-comment-avatar img{width:100%;height:100%;object-fit:cover}.review-comment-header,.chisel-review-byline{display:flex;align-items:baseline;flex-wrap:wrap;gap:8px;line-height:20px;margin-bottom:4px}.review-comment-author{font-size:13px;font-weight:500;overflow-wrap:anywhere}.review-comment-time{font-size:12px;color:var(--chisel-ui-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.review-comment-header{position:relative;padding-right:32px}.review-comment-edit{position:absolute;right:-8px;top:-10px;display:grid;place-items:center;width:40px;height:40px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-muted);opacity:0;transition:opacity .12s,background .12s}.review-comment:hover .review-comment-edit,.review-comment:focus-within .review-comment-edit,.review-comment-edit:focus-visible{opacity:1}.review-comment-edit:hover{background:var(--chisel-ui-hover);color:var(--chisel-ui-text)}@media(hover:none){.review-comment-edit{opacity:1}}.review-inline-edit{border:1px solid var(--chisel-ui-border);border-radius:10px;padding:8px}.review-inline-edit-actions{display:flex;justify-content:flex-end;gap:6px;margin-top:8px}.review-inline-edit-actions button{min-height:40px;padding:0 10px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text)}.review-inline-edit-actions button:last-child{background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.review-inline-edit-actions button:not(:last-child):hover{background:var(--chisel-ui-hover)}.review-inline-edit-actions button:disabled{opacity:.45}@media(pointer:coarse){.review-inline-edit-actions button{min-height:44px}}.review-comment-body,.chisel-rich-body{font-size:14px;line-height:21px;white-space:pre-wrap;overflow-wrap:anywhere}.review-comment-body p{margin:0;min-height:21px}.review-comment-body p+p{margin-top:8px}.review-comment-body a{color:var(--chisel-ui-accent-text);text-decoration:underline;text-underline-offset:3px}.review-comment-body code{font:12px/1.5 ui-monospace,SFMono-Regular,monospace;background:var(--chisel-ui-inset);border-radius:4px;padding:2px 4px}.review-composer{margin:0}.feedback-shell.chisel-review .chisel-review-reply{display:flex;align-items:flex-start;gap:12px;border:0;padding:20px}.feedback-shell.chisel-review .chisel-review-reply[hidden]{display:none}.feedback-shell.chisel-review .feedback-reply-avatar{width:28px;height:28px;margin-top:8px}.feedback-shell.chisel-review .chisel-reply-field{position:relative;flex:1;min-width:0;min-height:48px;border:0;border-radius:12px;background:var(--chisel-ui-raised)}.review-composer-editor{min-width:0;min-height:40px;max-height:min(180px,30dvh);overflow:auto;padding:10px 12px;font-size:14px;line-height:21px;overflow-wrap:anywhere;outline:none}.review-composer-editor p{margin:0}.review-composer-editor>p,.chisel-rich-editor>p{position:relative}.feedback-shell.chisel-review .chisel-review-reply :is(.review-composer-editor,.chisel-rich-editor){padding-right:56px}.feedback-shell.chisel-review .chisel-reply-submit{position:absolute;right:4px;bottom:4px;display:grid;place-items:center;width:40px;height:40px;min-height:40px;padding:0;border:0;border-radius:8px;background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.chisel-reply-submit:disabled{opacity:.35}.feedback-shell.chisel-review .comment-box-native>form{display:flex;flex-direction:column;flex:1;min-height:0;height:100%}.feedback-shell.chisel-review .comment-box-native .comment-box-prompt{align-items:flex-start;padding:8px;gap:0}.feedback-shell.chisel-review .comment-box-native .comment-box-footer{border:0;background:var(--chisel-ui-surface)}.feedback-shell.chisel-review .comment-box-native .comment-box-element{background:var(--chisel-ui-raised)}.feedback-shell.chisel-review .comment-box-native .comment-box-cancel{border:0;border-radius:8px;background:transparent}.feedback-shell.chisel-review .comment-box-native .comment-box-cancel:hover{background:var(--chisel-ui-hover)}.feedback-shell.chisel-review .comment-box-native .comment-box-submit{border-radius:8px}.chisel-composer-input{flex:1;min-width:0;max-height:min(320px,42dvh);overflow:auto}.chisel-attachment-controls{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding:0 8px;color:var(--chisel-ui-secondary);font-size:12px;line-height:18px}.chisel-review-reply .chisel-attachment-controls{padding-right:48px}.chisel-attachment-error{color:var(--chisel-ui-danger);line-height:1.5}.chisel-attachment-previews,.review-attachments{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding:8px;max-height:240px;overflow:auto}.review-attachments{padding:12px 0 0;max-height:none}.feedback-shell.chisel-review .chisel-attachment-preview,.review-attachment{position:relative;min-width:0;margin:0;overflow:hidden;border:0;border-radius:8px;background:var(--chisel-ui-raised)}.chisel-attachment-preview>img,.chisel-attachment-preview>video,.review-media-thumbnail img,.review-media-thumbnail video{display:block;width:100%;height:120px;object-fit:contain;background:var(--chisel-ui-inset)}.review-attachment figcaption{padding:8px;font-size:12px;line-height:18px;overflow-wrap:anywhere}.review-attachment-placeholder{min-height:100px;display:grid;place-items:center;padding:12px;color:var(--chisel-ui-secondary);font-size:12px}.chisel-attachment-preview>button:not(.review-media-thumbnail){position:absolute;top:0;right:0;display:grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:0 8px;background:var(--chisel-ui-surface);color:var(--chisel-ui-text)}.review-retry-upload{display:inline-flex;align-items:center;gap:6px;min-height:40px;padding:0 8px;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text);font:inherit}.review-retry-upload:hover{background:var(--chisel-ui-hover)}.chisel-attachment-controls .review-retry-upload[aria-label]{min-width:40px;justify-content:center}.chisel-attachment-preview>span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:8px;font-size:12px}.feedback-shell.chisel-review .chisel-expand-thread{display:inline-flex;align-items:center;margin:0 20px 8px 60px;min-height:40px;padding:0;border:0;background:transparent;color:var(--chisel-ui-secondary);font-size:13px}.chisel-review [data-slate-placeholder]{opacity:1!important;color:var(--chisel-ui-secondary)}@media(pointer:coarse){.feedback-shell.chisel-review .chisel-reply-submit{width:44px;height:44px}.chisel-review-reply .chisel-attachment-controls{padding-right:52px}.feedback-shell.chisel-review .chisel-reply-field{min-height:52px}.feedback-shell.chisel-review .chisel-review-reply :is(.review-composer-editor,.chisel-rich-editor){padding-right:60px}}@media(forced-colors:active){.feedback-shell.chisel-review .comment-thread[data-native-ui=true],.feedback-shell.chisel-review .comment-box-native,.feedback-shell.chisel-review .chisel-reply-field{border:1px solid CanvasText;box-shadow:none}.review-comment-avatar{border:1px solid CanvasText}}.review-media-thumbnail{position:relative;display:block;width:100%;padding:0;border:0;background:var(--chisel-ui-inset);cursor:pointer}.review-media-thumbnail img,.review-media-thumbnail video{display:block;width:100%;height:120px;object-fit:contain}.review-media-play{position:absolute;inset:50% auto auto 50%;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:#0009;color:#fff;transform:translate(-50%,-50%)}.review-media-lightbox{position:fixed;inset:0;width:100vw;height:100dvh;max-width:none;max-height:none;margin:0;padding:24px;border:0;background:transparent;color:var(--chisel-ui-text)}.review-media-lightbox[open]{display:flex;align-items:center;justify-content:center}.review-media-lightbox::backdrop{background:#000b}.review-media-lightbox-content{display:flex;flex-direction:column;width:fit-content;min-width:min(320px,100%);max-width:min(100%,1000px);max-height:100%;margin:auto;border-radius:12px;overflow:hidden;background:var(--chisel-ui-surface);box-shadow:0 16px 48px #0006}.review-media-lightbox-content header{display:flex;align-items:center;gap:12px;min-height:56px;padding:8px 12px 8px 16px}.review-media-lightbox-content header span{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.review-media-lightbox-content header a{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:40px;min-height:40px;padding:0;border-radius:8px;color:var(--chisel-ui-text);font-size:13px}.review-media-lightbox-content header a:hover{background:var(--chisel-ui-hover)}.review-media-lightbox-content header button{display:grid;place-items:center;flex-shrink:0;width:40px;height:40px;padding:0;border:0;border-radius:8px;background:transparent;color:var(--chisel-ui-text)}.review-media-lightbox-content header button:hover{background:var(--chisel-ui-hover)}.review-media-lightbox-content>img,.review-media-lightbox-content>video{display:block;min-height:0;max-width:100%;max-height:calc(100dvh - 104px);margin:auto;object-fit:contain;background:#000}
3
+ `;import{Fragment as He,jsx as p,jsxs as A}from"react/jsx-runtime";var z="https://chisel-review.vercel.app";function ge(n,i){try{localStorage.setItem(n,i),sessionStorage.removeItem(n);return}catch{}try{sessionStorage.setItem(n,i)}catch{}}function re(n){try{localStorage.removeItem(n)}catch{}try{sessionStorage.removeItem(n)}catch{}}function me(n){let i="";try{i=localStorage.getItem(n)||""}catch{}if(!/^[0-9a-f]{64}$/.test(i))try{i=sessionStorage.getItem(n)||""}catch{}return/^[0-9a-f]{64}$/.test(i)?(ge(n,i),i):""}function ve(n){return Array.isArray(n)?n.filter(i=>i&&typeof i.id=="string"&&typeof i.name=="string"&&typeof i.path=="string").map(i=>({id:i.id,name:i.name.slice(0,100),path:i.path.slice(0,2048),image:typeof i.image=="string"&&/^https?:\/\//.test(i.image)?i.image:null})):[]}function ne({projectId:n}){let i=`chisel:session:${n}`,o=L(""),E=L(i),[I,k]=T(0),[v,u]=T(null),[w,f]=T(!0),[b,x]=T(""),[_,l]=T(!1),[g,d]=T([]),[q,R]=T([]),[ke,J]=T("connecting"),H=L("/"),V=L(!1),[Ce,Se]=T(0),X=L(new Set),P=S(()=>{for(let e of X.current)e()},[]),O=L(null);O.current=v;let $=L(null),W=L("");Y(()=>{let e=t=>{($.current&&!$.current.closed||o.current&&me(i)!==o.current)&&t.preventDefault()};return document.addEventListener("chisel:before-ui-update",e),()=>document.removeEventListener("chisel:before-ui-update",e)},[i]);let C=S(async(e,t,r,s,a=!1)=>{let h=o.current,m=await fetch(`${z}/chisel/api/hosted/${e}`,{method:t,headers:{Authorization:`Bearer ${h}`,...r?{"Content-Type":"application/json","X-Chisel-Protocol":"2"}:{}},...r?{body:JSON.stringify(r)}:{},signal:s,keepalive:a}),c=await m.json().catch(()=>null);if(h!==o.current)throw new Error("Your Chisel account changed. Please retry.");if(!m.ok)throw m.status===401&&h===o.current&&O.current&&l(!0),Object.assign(new Error(c?.error||"Chisel is unavailable. Please try again."),{status:m.status});if(!c||typeof c!="object")throw new Error("Chisel is unavailable. Please try again.");if(c.siteId&&c.siteId!==n)throw new Error("This session belongs to another project.");return c},[n]),U=S((e,t)=>C(e==="GET"?`comments?path=${encodeURIComponent(H.current)}`:"comments",e,t),[C]),K=ie(()=>{let e=0;return{async list(){let t=++e,r=await U("GET");return t===e&&(d(r.comments),V.current||R(ve(r.participants))),r.comments},async mutate(t){++e;let r=(await U("POST",t)).comment;return++e,d(s=>s.some(a=>a.id===r.id)?s.map(a=>a.id===r.id?r:a):[...s,r]),window.setTimeout(P,0),r},async delete(t){++e,await U("POST",{type:"delete",id:t}),++e,d(r=>r.filter(s=>s.id!==t)),window.setTimeout(P,0)},subscribe(t){return X.current.add(t),()=>{X.current.delete(t)}}}},[U,P]),Ee=S(async(e,t)=>{await U("POST",{type:"read",id:e,activity:t})},[U]),Ie=S((e,t)=>{d(r=>r.map(s=>s.id===e?{...s,readActivity:Math.max(s.readActivity??0,t)}:s))},[]),{flush:le,markDisplayed:Te}=Ne(Ee,Ie);Y(()=>{if(!v)return;let e=!0,t,r,s=new AbortController,a=()=>{document.visibilityState==="visible"&&(clearTimeout(r),r=setTimeout(()=>{P(),le()},40))};async function h(){let c=!1;try{let j=o.current,G=await fetch(`${z}/chisel/api/hosted/events?path=${encodeURIComponent(H.current)}`,{headers:{Authorization:`Bearer ${j}`},signal:s.signal});if(e&&G.status===401&&j===o.current&&l(!0),!G.ok||!G.body)throw new Error("Live updates unavailable");let Ae=G.body.getReader(),Pe=new TextDecoder,N="";for(;e;){let{value:ze,done:$e}=await Ae.read();if($e)break;N+=Pe.decode(ze,{stream:!0});let ee;for(;(ee=N.indexOf(`
4
4
 
5
- `))>=0;){let R=E.slice(0,D);if(E=E.slice(D+2),R==="data: ready")M("connected"),r();else if(R==="data: renew")s=!0;else if(R==="data: change")r();else if(R.startsWith("data: presence:"))try{z.current=!0,N(te(JSON.parse(R.slice(15))))}catch{}}}}catch{}e&&(z.current=!1,s||M("reconnecting"),i=setTimeout(()=>{c()},s?0:2e3))}M(s=>s==="connected"?s:"connecting"),c();let h=window.setInterval(r,1e4);return window.addEventListener("focus",r),window.addEventListener("online",r),document.addEventListener("visibilitychange",r),()=>{e=!1,z.current=!1,a.abort(),clearTimeout(i),clearTimeout(t),window.clearInterval(h),window.removeEventListener("focus",r),window.removeEventListener("online",r),document.removeEventListener("visibilitychange",r)}},[m,le,f,Q]);let me=u(e=>{L.current!==e&&(L.current=e,de(i=>i+1),f())},[f]),U=H(()=>({async userId(){return T.current?.user.id??""},async discard(e){await p("attachments","POST",{action:"cancel",id:e.id},void 0,!0)},async send(e,i,t){let a=async()=>{let c=await p("attachments","POST",{action:"confirm",id:e.id});if(c.attachment?.id!==e.id||c.attachment.token!==e.id)throw new Error("The upload confirmation was incomplete. Please retry.");return e.id};if(i){if(!t())return"";try{return await a()}catch(c){if(![404,503].includes(c.status??0))throw c}}let r=await p("attachments","POST",{action:"prepare",id:e.id,name:e.name,mimeType:e.mimeType,size:e.size});if(r.attachment?.id===e.id&&r.attachment.token===e.id)return e.id;if(typeof r.url!="string"||typeof r.key!="string")throw new Error("The upload could not be started. Please retry.");if(!t())return"";if(!e.stored){let c=new FormData;c.append("cacheControl","3600"),c.append("",e.file);try{(await fetch(r.url,{method:"PUT",headers:{apikey:r.key,"x-upsert":"false"},body:c})).ok&&(e.stored=!0)}catch{}}return t()?a():""}}),[p]),Z=H(()=>function(i=!1,t=0){return Te(i,t,U)},[U]),V=u(async(e,i)=>{let t=await p(`attachments?id=${encodeURIComponent(e)}`,"GET",void 0,i);if(typeof t.url!="string")throw new Error("Attachment unavailable");return t.url},[p]),G=u((e,i)=>p("project",e==="get"?"GET":"POST",e==="get"?void 0:{...i,action:e}),[p]),ve=u((e,i)=>Ee(i,U,t=>B.mutate({type:"snapshot",id:e,attachmentTokens:[t]})),[U,B]),we=u(e=>V(e,new AbortController().signal),[V]);F(()=>{Y.current!==n&&(o.current="",Y.current=n,j(null)),o.current=o.current||Pe(n);let e=!0,i=!1,t;q(!!o.current&&!T.current);async function a(){if(i||!o.current)return;clearTimeout(t),i=!0;let h=o.current;try{let s=await w("GET");if(!s.user?.id||s.siteId!==l||!["owner","reviewer"].includes(s.role))throw new Error("Could not verify your Chisel session. Please retry.");if(!e||h!==o.current)return;j(s),y(!1),k("");let C=new URL(window.location.href);C.searchParams.delete("invite"),window.history.replaceState(window.history.state,"",C)}catch(s){if(!e||h!==o.current)return;s.status===401?(o.current="",X(n),y(!!T.current)):t=setTimeout(()=>{document.visibilityState==="visible"&&a()},5e3),k(s instanceof Error?s.message:"Could not connect to Chisel.")}finally{i=!1,e&&q(!1)}}let r=()=>{document.visibilityState==="visible"&&a()},c=h=>{if(!(h.key!==n&&h.key!==null)){try{if(h.storageArea!==localStorage)return}catch{return}o.current=h.newValue&&/^[0-9a-f]{64}$/.test(h.newValue)?h.newValue:"",o.current||X(n),j(null),S([]),N([]),y(!1),k(""),O(s=>s+1)}};return o.current&&a(),window.addEventListener("online",r),window.addEventListener("focus",r),document.addEventListener("visibilitychange",r),window.addEventListener("storage",c),()=>{e=!1,clearTimeout(t),window.removeEventListener("online",r),window.removeEventListener("focus",r),document.removeEventListener("visibilitychange",r),window.removeEventListener("storage",c)}},[n,l,w,ne]),F(()=>{let e=i=>{i.origin!==x||i.source!==A.current||i.data?.type!=="chisel:session"||i.data.state!==I.current||!/^[0-9a-f]{64}$/.test(i.data.token)||(o.current=i.data.token,re(n,o.current),I.current="",A.current=null,k(""),O(t=>t+1))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[n]);function _(){let e=crypto.getRandomValues(new Uint8Array(32));I.current=Array.from(e,a=>a.toString(16).padStart(2,"0")).join("");let i=new URL("/chisel/connect",x);i.searchParams.set("site",l),i.searchParams.set("origin",window.location.origin),i.searchParams.set("state",I.current);let t=new URLSearchParams(window.location.search).get("invite");t&&i.searchParams.set("invite",t),A.current=window.open(i.toString(),"chisel-sign-in","popup,width=520,height=700"),A.current||k("Allow pop-ups for this site, then try again.")}return ae?b("main",{className:"chisel-sign-in",children:[d(J,{}),d("section",{children:d("p",{children:"Connecting to Chisel\u2026"})})]}):!m&&o.current?b("main",{className:"chisel-sign-in",children:[d(J,{}),b("section",{children:[d("strong",{className:"chisel-sign-in-brand",children:"chisel"}),d("h1",{children:"Reconnecting to Chisel"}),d("p",{children:"Your sign-in is saved. Check your connection and try again."}),d("button",{onClick:()=>O(e=>e+1),children:"Retry connection"}),P&&d("p",{role:"alert",children:P})]})]}):m?b(Le,{children:[b("style",{children:[ee,ie]}),d(ye,{user:m.user,commentStore:B,canManageComments:m.role==="owner",projectId:l,manageReview:G,saveSnapshot:ve,getAttachmentURL:we,accountURL:`${x}/chisel/projects`,agentURL:`${x}/chisel/mcp`,commentUI:{className:"chisel-review",renderComposer:e=>{let i=K.find(t=>t.id===e.commentId);return d(ke,{...e,defaultBody:i?.body,existingAttachments:i?.attachments,useAttachments:Z})},renderThread:e=>d(Se,{...e,onRead:ue,useAttachments:Z,loadMedia:V},e.comment.id)},collaboration:{status:ce,participants:se,setPage:me,markRead(){},unreadThreadIds:K.filter(e=>e.readActivity!==null&&e.readActivity<e.activity).map(e=>e.id)},getReviewLink:m.role==="owner"?async(e=!1)=>{let i=await G("get"),t=i.reviewURL??Re(window.location.origin);if(!t)throw new Error("Open the deployed website\u2019s HTTPS /chisel page to copy a review link. Localhost links cannot be shared with clients.");i.reviewURL||await G("settings",{reviewURL:t});let a=await fetch(`${x}/chisel/api/hosted/invite`,{method:"POST",headers:{Authorization:`Bearer ${o.current}`,"Content-Type":"application/json","X-Chisel-Protocol":"2"},body:JSON.stringify({rotate:e})}),r=await a.json();if(a.status===401&&y(!0),!a.ok||typeof r.invite!="string")throw new Error(r.error||"Could not create a review link.");let c=new URL(t);return c.searchParams.set("mode","comment"),c.searchParams.set("invite",r.invite),c.toString()}:void 0,validateSession:async()=>!!o.current,signOut:async()=>{let e=await fetch(`${x}/chisel/api/hosted/logout`,{method:"DELETE",headers:{Authorization:`Bearer ${o.current}`,"X-Chisel-Protocol":"2"}});if(!e.ok&&e.status!==401)throw new Error("Sign out failed.");o.current="",X(n)}},m.user.id),oe&&b("div",{role:"alert",style:{position:"fixed",bottom:16,right:16,zIndex:999999,background:"white",color:"black",padding:12,borderRadius:8,boxShadow:"0 2px 12px #0003"},children:["Your Chisel session expired. ",d("button",{type:"button",onClick:_,children:"Sign in again"})]})]}):b("main",{className:"chisel-sign-in",children:[d(J,{}),b("section",{children:[d("strong",{className:"chisel-sign-in-brand",children:"chisel"}),d("h1",{children:"Sign in to review"}),d("p",{children:"Connect this website to your Chisel account."}),d("button",{onClick:_,children:"Continue with Chisel"}),P&&d("p",{role:"alert",children:P})]})]})}export{Me as HostedChisel};
5
+ `))>=0;){let B=N.slice(0,ee);if(N=N.slice(ee+2),B==="data: ready")J("connected"),a();else if(B==="data: renew")c=!0;else if(B==="data: change")a();else if(B.startsWith("data: presence:"))try{V.current=!0,R(ve(JSON.parse(B.slice(15))))}catch{}}}}catch{}e&&(V.current=!1,c||J("reconnecting"),t=setTimeout(()=>{h()},c?0:2e3))}J(c=>c==="connected"?c:"connecting"),h();let m=window.setInterval(a,1e4);return window.addEventListener("focus",a),window.addEventListener("online",a),document.addEventListener("visibilitychange",a),()=>{e=!1,V.current=!1,s.abort(),clearTimeout(t),clearTimeout(r),window.clearInterval(m),window.removeEventListener("focus",a),window.removeEventListener("online",a),document.removeEventListener("visibilitychange",a)}},[v,Ce,P,le]);let Re=S(e=>{H.current!==e&&(H.current=e,Se(t=>t+1),P())},[P]),F=ie(()=>({async userId(){return O.current?.user.id??""},async discard(e){await C("attachments","POST",{action:"cancel",id:e.id},void 0,!0)},async send(e,t,r){let s=async()=>{let h=await C("attachments","POST",{action:"confirm",id:e.id});if(h.attachment?.id!==e.id||h.attachment.token!==e.id)throw new Error("The upload confirmation was incomplete. Please retry.");return e.id};if(t){if(!r())return"";try{return await s()}catch(h){if(![404,503].includes(h.status??0))throw h}}let a=await C("attachments","POST",{action:"prepare",id:e.id,name:e.name,mimeType:e.mimeType,size:e.size});if(a.attachment?.id===e.id&&a.attachment.token===e.id)return e.id;if(typeof a.url!="string"||typeof a.key!="string")throw new Error("The upload could not be started. Please retry.");if(!r())return"";if(!e.stored){let h=new FormData;h.append("cacheControl","3600"),h.append("",e.file);try{(await fetch(a.url,{method:"PUT",headers:{apikey:a.key,"x-upsert":"false"},body:h})).ok&&(e.stored=!0)}catch{}}return r()?s():""}}),[C]),de=ie(()=>function(t=!1,r=0){return je(t,r,F)},[F]),Q=S(async(e,t)=>{let r=await C(`attachments?id=${encodeURIComponent(e)}`,"GET",void 0,t);if(typeof r.url!="string")throw new Error("Attachment unavailable");return r.url},[C]),Z=S((e,t)=>C("project",e==="get"?"GET":"POST",e==="get"?void 0:{...t,action:e}),[C]),Ue=S((e,t)=>Be(t,F,r=>K.mutate({type:"snapshot",id:e,attachmentTokens:[r]})),[F,K]),Le=S(e=>Q(e,new AbortController().signal),[Q]);Y(()=>{E.current!==i&&(o.current="",E.current=i,u(null)),o.current=o.current||me(i);let e=!0,t=!1,r;f(!!o.current&&!O.current);async function s(){if(t||!o.current)return;clearTimeout(r),t=!0;let m=o.current;try{let c=await U("GET");if(!c.user?.id||c.siteId!==n||!["owner","reviewer"].includes(c.role))throw new Error("Could not verify your Chisel session. Please retry.");if(!e||m!==o.current)return;u(c),l(!1),x("");let j=new URL(window.location.href);j.searchParams.delete("invite"),window.history.replaceState(window.history.state,"",j)}catch(c){if(!e||m!==o.current)return;c.status===401?(o.current="",re(i),l(!!O.current)):r=setTimeout(()=>{document.visibilityState==="visible"&&s()},5e3),x(c instanceof Error?c.message:"Could not connect to Chisel.")}finally{t=!1,e&&f(!1)}}let a=()=>{document.visibilityState==="visible"&&s()},h=m=>{if(!(m.key!==i&&m.key!==null)){try{if(m.storageArea!==localStorage)return}catch{return}o.current=m.newValue&&/^[0-9a-f]{64}$/.test(m.newValue)?m.newValue:"",o.current||re(i),u(null),d([]),R([]),l(!1),x(""),k(c=>c+1)}};return o.current&&s(),window.addEventListener("online",a),window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),window.addEventListener("storage",h),()=>{e=!1,clearTimeout(r),window.removeEventListener("online",a),window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a),window.removeEventListener("storage",h)}},[i,n,U,I]),Y(()=>{let e=t=>{t.origin!==z||t.source!==$.current||t.data?.type!=="chisel:session"||t.data.state!==W.current||!/^[0-9a-f]{64}$/.test(t.data.token)||(o.current=t.data.token,ge(i,o.current),W.current="",$.current=null,x(""),k(r=>r+1))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[i]);function he(){let e=crypto.getRandomValues(new Uint8Array(32));W.current=Array.from(e,s=>s.toString(16).padStart(2,"0")).join("");let t=new URL("/chisel/connect",z);t.searchParams.set("site",n),t.searchParams.set("origin",window.location.origin),t.searchParams.set("state",W.current);let r=new URLSearchParams(window.location.search).get("invite");r&&t.searchParams.set("invite",r),$.current=window.open(t.toString(),"chisel-sign-in","popup,width=520,height=700"),$.current||x("Allow pop-ups for this site, then try again.")}return w?A("main",{className:"chisel-sign-in",children:[p(te,{}),p("section",{children:p("p",{children:"Connecting to Chisel\u2026"})})]}):!v&&o.current?A("main",{className:"chisel-sign-in",children:[p(te,{}),A("section",{children:[p("strong",{className:"chisel-sign-in-brand",children:"chisel"}),p("h1",{children:"Reconnecting to Chisel"}),p("p",{children:"Your sign-in is saved. Check your connection and try again."}),p("button",{onClick:()=>k(e=>e+1),children:"Retry connection"}),b&&p("p",{role:"alert",children:b})]})]}):v?A(He,{children:[A("style",{children:[pe,ue]}),p(Me,{user:v.user,commentStore:K,canManageComments:v.role==="owner",projectId:n,manageReview:Z,saveSnapshot:Ue,getAttachmentURL:Le,accountURL:`${z}/chisel/projects`,agentURL:`${z}/chisel/mcp`,commentUI:{className:"chisel-review",renderComposer:e=>{let t=g.find(r=>r.id===e.commentId);return p(_e,{...e,defaultBody:t?.body,existingAttachments:t?.attachments,useAttachments:de})},renderThread:e=>p(Oe,{...e,onRead:Te,useAttachments:de,loadMedia:Q},e.comment.id)},collaboration:{status:ke,participants:q,setPage:Re,markRead(){},unreadThreadIds:g.filter(e=>e.readActivity!==null&&e.readActivity<e.activity).map(e=>e.id)},getReviewLink:v.role==="owner"?async()=>{let e=await Z("get"),t=e.reviewURL??De(window.location.origin);if(!t)throw new Error("Open the deployed website\u2019s HTTPS /chisel page to copy a review link. Localhost links cannot be shared with clients.");e.reviewURL||await Z("settings",{reviewURL:t});let r=new URL(t);return r.searchParams.set("mode","comment"),r.toString()}:void 0,validateSession:async()=>!!o.current,signOut:async()=>{let e=await fetch(`${z}/chisel/api/hosted/logout`,{method:"DELETE",headers:{Authorization:`Bearer ${o.current}`,"X-Chisel-Protocol":"2"}});if(!e.ok&&e.status!==401)throw new Error("Sign out failed.");o.current="",re(i)}},v.user.id),_&&A("div",{role:"alert",style:{position:"fixed",bottom:16,right:16,zIndex:999999,background:"white",color:"black",padding:12,borderRadius:8,boxShadow:"0 2px 12px #0003"},children:["Your Chisel session expired. ",p("button",{type:"button",onClick:he,children:"Sign in again"})]})]}):A("main",{className:"chisel-sign-in",children:[p(te,{}),A("section",{children:[p("strong",{className:"chisel-sign-in-brand",children:"chisel"}),p("h1",{children:"Sign in to review"}),p("p",{children:"Connect this website to your Chisel account."}),p("button",{onClick:he,children:"Continue with Chisel"}),b&&p("p",{role:"alert",children:b})]})]})}import*as Ve from"react";import*as We from"react-dom";import*as Fe from"react/jsx-runtime";var we="https://chisel-review.vercel.app",fe="3e6200285ed58d94e323fa435669ab72baa281951566146b50deacc184bb8b1f";function Ge(n){let i=n;if(!i||i.protocol!==1||typeof i.version!="string"||!/^\d+\.\d+\.\d+(?:-[\w.-]+)?$/.test(i.version)||typeof i.build!="string"||!/^[a-f0-9]{64}$/.test(i.build)||typeof i.integrity!="string"||!/^sha384-[A-Za-z0-9+/]{64}$/.test(i.integrity))throw new Error("This Chisel update is incompatible.");return i}async function ae(){let n=new AbortController,i=setTimeout(()=>n.abort(),3e3);try{let o=await fetch(`${we}/chisel-ui/manifest.json`,{cache:"no-store",credentials:"omit",redirect:"error",signal:n.signal});if(!o.ok)throw new Error("Chisel updates are unavailable.");return Ge(await o.json())}finally{clearTimeout(i)}}var oe=new Map;function se(n){let i=window.__chiselUIV1??={react:Ve,dom:We,jsx:Fe,environment:process.env.NODE_ENV??"production",modules:{}},o=i.modules[n.build];if(o)return Promise.resolve(o);let E=oe.get(n.build);if(E)return E;let I=new Promise((k,v)=>{let u=document.createElement("script"),w=b=>{clearTimeout(f),u.remove(),u.onload=null,u.onerror=null;let x=i.modules[n.build];b||typeof x!="function"?v(b??new Error("Chisel could not load this update.")):k(x)},f=setTimeout(()=>w(new Error("The Chisel update timed out.")),5e3);u.src=`${we}/chisel-ui/${n.build}.js`,u.crossOrigin="anonymous",u.integrity=n.integrity,u.async=!0,u.onload=()=>w(),u.onerror=()=>w(new Error("Chisel could not download this update.")),document.head.append(u)});return oe.set(n.build,I),I.catch(()=>{oe.delete(n.build)}),I}import{Fragment as Ke,jsx as y,jsxs as ye}from"react/jsx-runtime";var xe={component:ne,build:fe},ce=class extends Ye{constructor(){super(...arguments);this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(){this.props.onFailure()}render(){return this.state.failed?y("main",{className:"chisel-sign-in",children:ye("section",{children:[y("p",{children:"Chisel couldn\u2019t start."}),y("button",{onClick:()=>window.location.reload(),children:"Reload Chisel"})]})}):this.props.children}};function mi({projectId:n}){let[i,o]=qe(null),E=D(i);E.current=i;let I=D(null),k=D(!1),v=D(!1),u=D(""),w=`chisel-updates:${n}`,f=`${w}:available`;be(()=>{k.current=!0;let l=!0;return ae().then(async g=>{if(!l)return;let d=await se(g);l&&o({component:d,build:g.build})}).catch(()=>{l&&o(xe)}),()=>{l=!1,k.current=!1,M.dismiss(f)}},[f]);function b(l,g="Update when you\u2019re ready. Your feedback stays saved."){M("A new version of Chisel is available",{id:f,toasterId:w,duration:1/0,description:g,closeButton:!0,action:{label:"Update",onClick:d=>{d.preventDefault(),x(l)}}})}async function x(l){if(v.current)return;let g=()=>document.dispatchEvent(new Event("chisel:before-ui-update",{cancelable:!0}));if(!g()){b(l,"Finish signing in or sending, save your draft, and allow browser storage before updating.");return}v.current=!0,M.loading("Updating Chisel\u2026",{id:f,toasterId:w,action:void 0,description:void 0});try{let d=await se(l);if(!k.current)return;if(!g()){b(l,"Save or close your draft before updating.");return}I.current=E.current,o({component:d,build:l.build}),M.success("Chisel is up to date",{id:f,toasterId:w,duration:3e3,action:void 0,description:void 0})}catch{k.current&&M.error("Chisel couldn\u2019t update",{id:f,toasterId:w,duration:1/0,description:"Your current version is still running.",action:{label:"Retry",onClick:d=>{d.preventDefault(),x(l)}}})}finally{v.current=!1}}be(()=>{if(!i)return;let l=!0,g=!1,d=async()=>{if(!(g||v.current||document.visibilityState!=="visible")){g=!0;try{let R=await ae();l&&R.build!==E.current?.build&&R.build!==u.current&&(u.current=R.build,b(R))}catch{}finally{g=!1}}},q=setInterval(()=>{d()},6e4);return window.addEventListener("focus",d),document.addEventListener("visibilitychange",d),()=>{l=!1,clearInterval(q),window.removeEventListener("focus",d),document.removeEventListener("visibilitychange",d)}},[i?.build,f]);let _=i?.component;return ye(Ke,{children:[y(Xe,{}),y("style",{children:'.chisel-updates [data-action]{position:relative}.chisel-updates [data-action]::after{content:"";position:absolute;inset:-6px 0}'}),_?y(ce,{onFailure:()=>{o(I.current??xe),I.current=null,M.error("This Chisel update couldn\u2019t start",{id:f,toasterId:w,description:"Your previous version is still available."})},children:y(_,{projectId:n})},`${n}:${i.build}:${_===ne?"bundled":"hosted"}`):y("main",{className:"chisel-sign-in",children:y("section",{children:y("p",{role:"status",children:"Loading Chisel\u2026"})})}),y(Je,{id:w,className:"chisel-updates",theme:"system",position:"bottom-right",offset:24,mobileOffset:16,style:{zIndex:1000002},toastOptions:{style:{fontFamily:"var(--chisel-ui-font)",background:"var(--chisel-ui-surface)",color:"var(--chisel-ui-text)",border:"none",borderRadius:12,boxShadow:"var(--chisel-ui-popover-shadow)"},actionButtonStyle:{height:32,minHeight:32,alignSelf:"center",background:"var(--chisel-ui-action)",color:"var(--chisel-ui-action-text)"}}})]})}export{mi as HostedChisel};
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use client";import*as p from"react";import{forwardRef as vt,createElement as Mt}from"react";var Fa=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Ba(e,a,t=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Fa(e),size:24,node:a,...t.length>0?{aliases:t}:{}}}var Da=e=>{let a="",t=!1;for(let o of e){if(o==="-"||o==="_"||o<=" "){t=a.length>0;continue}a.length===0?a+=o.toLowerCase():a+=t?o.toUpperCase():o,t=!1}return a};var Ta=e=>{let a=Da(e);return a.charAt(0).toUpperCase()+a.slice(1)};import{forwardRef as Pt,createElement as Ua}from"react";var Ge=(...e)=>e.filter((a,t,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===t).join(" ").trim();var Le={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 na(e){return e!=null}function qa(e,a={}){let t=a.attributeNames??{},o=B=>t[B]??B,r=e.size??e.width??Le.width,n=e.size??e.height??Le.height,i=e.aliases?.filter(B=>typeof B=="string"&&B.trim()!=="").map(B=>`lucide-${B}`)??[],c=[...e.name?[`lucide-${e.name}`]:[],...i],f=a.className?.split(" ").filter(Boolean)??[],I=a.includeDefaultClasses===!1?Ge(...f):Ge("lucide",...c,...f),S=a.absoluteStrokeWidth?Number(a.strokeWidth??Le["stroke-width"])*Number(e.size??e.width??Le.width)/Number(a.size??a.width??Le.width):a.strokeWidth??Le["stroke-width"];return["svg",{...Object.entries(Le).reduce((B,[A,b])=>(B[o(A)]=b,B),{}),..."color"in a&&a.color&&{[o("stroke")]:a.color},..."size"in a&&na(a.size)&&{[o("width")]:a.size,[o("height")]:a.size},..."width"in a&&na(a.width)&&{[o("width")]:a.width},..."height"in a&&na(a.height)&&{[o("height")]:a.height},[o("stroke-width")]:S,...I&&{[o("class")]:I},[o("viewBox")]:`0 0 ${r} ${n}`,...a.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(B=>{let[A,b,P]=B,T=a.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...b}:b;return P?[A,T,P]:[A,T]})]}function Ha(e,a={}){return qa(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Oa=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};import{createContext as bt,useContext as kt,useMemo as Xo,createElement as Ko}from"react";var yt=bt({});var Ea=()=>kt(yt);var Na=Pt(({color:e,size:a,width:t,height:o,strokeWidth:r,absoluteStrokeWidth:n,nonScalingStroke:i,className:c="",children:f,iconNode:I=[],icon:S={node:I,aliases:[],size:24},...v},B)=>{let{size:A=24,strokeWidth:b=2,absoluteStrokeWidth:P=!1,nonScalingStroke:T=!1,color:q="currentColor",className:E=""}=Ea()??{},ae=!!f||Oa(v),[M,H,R=[]]=Ha(S,{color:e??q,width:t??a??A,height:o??a??A,strokeWidth:r??b,absoluteStrokeWidth:n??P,nonScalingStroke:i??T,className:Ge(E,c),hasA11yProp:ae,attributes:v});return Ua(M,{ref:B,...H},[...R.map(([W,G])=>Ua(W,G)),...Array.isArray(f)?f:[f]])});function Pe(e,a=[],t=[]){let o=typeof e=="string"?Ba(e,a,t):e,r=vt(({className:n,...i},c)=>Mt(Na,{ref:c,icon:o,className:n,...i}));return o.name&&(r.displayName=Ta(o.name)),r}var At={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},ve=Pe(At);var Rt={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]},Ve=Pe(Rt);var Ft={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]},ze=Pe(Ft);var Ga=`: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}}
1
+ "use client";import*as p from"react";import{forwardRef as vt,createElement as Mt}from"react";var Fa=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Ba(e,a,t=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Fa(e),size:24,node:a,...t.length>0?{aliases:t}:{}}}var Da=e=>{let a="",t=!1;for(let o of e){if(o==="-"||o==="_"||o<=" "){t=a.length>0;continue}a.length===0?a+=o.toLowerCase():a+=t?o.toUpperCase():o,t=!1}return a};var Ta=e=>{let a=Da(e);return a.charAt(0).toUpperCase()+a.slice(1)};import{forwardRef as Pt,createElement as Ua}from"react";var Ge=(...e)=>e.filter((a,t,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===t).join(" ").trim();var Le={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 na(e){return e!=null}function qa(e,a={}){let t=a.attributeNames??{},o=B=>t[B]??B,r=e.size??e.width??Le.width,n=e.size??e.height??Le.height,i=e.aliases?.filter(B=>typeof B=="string"&&B.trim()!=="").map(B=>`lucide-${B}`)??[],c=[...e.name?[`lucide-${e.name}`]:[],...i],f=a.className?.split(" ").filter(Boolean)??[],I=a.includeDefaultClasses===!1?Ge(...f):Ge("lucide",...c,...f),S=a.absoluteStrokeWidth?Number(a.strokeWidth??Le["stroke-width"])*Number(e.size??e.width??Le.width)/Number(a.size??a.width??Le.width):a.strokeWidth??Le["stroke-width"];return["svg",{...Object.entries(Le).reduce((B,[A,b])=>(B[o(A)]=b,B),{}),..."color"in a&&a.color&&{[o("stroke")]:a.color},..."size"in a&&na(a.size)&&{[o("width")]:a.size,[o("height")]:a.size},..."width"in a&&na(a.width)&&{[o("width")]:a.width},..."height"in a&&na(a.height)&&{[o("height")]:a.height},[o("stroke-width")]:S,...I&&{[o("class")]:I},[o("viewBox")]:`0 0 ${r} ${n}`,...a.hasA11yProp===!1?{[o("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(B=>{let[A,b,P]=B,T=a.nonScalingStroke?{[o("vector-effect")]:"non-scaling-stroke",...b}:b;return P?[A,T,P]:[A,T]})]}function Ha(e,a={}){return qa(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Oa=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};import{createContext as bt,useContext as kt,useMemo as Xo,createElement as Ko}from"react";var yt=bt({});var Ea=()=>kt(yt);var Na=Pt(({color:e,size:a,width:t,height:o,strokeWidth:r,absoluteStrokeWidth:n,nonScalingStroke:i,className:c="",children:f,iconNode:I=[],icon:S={node:I,aliases:[],size:24},...v},B)=>{let{size:A=24,strokeWidth:b=2,absoluteStrokeWidth:P=!1,nonScalingStroke:T=!1,color:q="currentColor",className:E=""}=Ea()??{},ae=!!f||Oa(v),[M,H,R=[]]=Ha(S,{color:e??q,width:t??a??A,height:o??a??A,strokeWidth:r??b,absoluteStrokeWidth:n??P,nonScalingStroke:i??T,className:Ge(E,c),hasA11yProp:ae,attributes:v});return Ua(M,{ref:B,...H},[...R.map(([W,G])=>Ua(W,G)),...Array.isArray(f)?f:[f]])});function Pe(e,a=[],t=[]){let o=typeof e=="string"?Ba(e,a,t):e,r=vt(({className:n,...i},c)=>Mt(Na,{ref:c,icon:o,className:n,...i}));return o.name&&(r.displayName=Ta(o.name)),r}var At={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},ve=Pe(At);var Rt={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]},Ve=Pe(Rt);var Ft={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]},ze=Pe(Ft);var Ga=`:is(.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box,.chisel-project-directory) :focus{outline:none}.chisel-updates,.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-updates,.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-updates,.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-updates,.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
2
  `;function ca(e,a){return{schemaVersion:1,activeVersionId:e.some(o=>o.id===a)?a:e[0]?.id??a,versions:e}}function Va(e){if(e===null)return{migrated:!1};let a;try{a=JSON.parse(e)}catch{return{migrated:!1,warning:"Saved edits could not be read. Edits will be kept for this session."}}if(Array.isArray(a)){let t=a.filter(za);return a.length>0&&t.length===0?{migrated:!1,warning:"Saved edits are malformed. Edits will be kept for this session."}:{envelope:ca(t,t[0]?.id??"version-1"),migrated:t.length===a.length,warning:t.length<a.length?"Some malformed saved versions were skipped. Recovered edits will be kept for this session until you make a change.":void 0}}return Bt(a)?{envelope:a,migrated:!1}:{migrated:!1,warning:"Saved edits use an unsupported or malformed format. Edits will be kept for this session."}}function Bt(e){return!Me(e)||e.schemaVersion!==1||typeof e.activeVersionId!="string"||!Array.isArray(e.versions)||!e.versions.every(za)?!1:e.versions.length===0||e.versions.some(a=>a.id===e.activeVersionId)}function za(e){return!Me(e)||typeof e.id!="string"||typeof e.name!="string"||!Me(e.elements)?!1:Object.values(e.elements).every(Dt)}function Dt(e){return!(!Me(e)||typeof e.selector!="string"||!Me(e.styles)||e.sourceHint!==void 0&&typeof e.sourceHint!="string"||e.text!==void 0&&typeof e.text!="string"||!Object.values(e.styles).every(a=>typeof a=="string")||e.asset!==void 0&&!Tt(e.asset))}function Tt(e){return Me(e)&&typeof e.fileName=="string"&&typeof e.mimeType=="string"&&typeof e.size=="number"&&Number.isFinite(e.size)&&e.size>=0}function Me(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}import{Fragment as Xe,jsx as u,jsxs as w}from"react/jsx-runtime";var qt=["px","rem","em"],Ht=[{label:"Inter",value:'Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},{label:"System",value:'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif'},{label:"Arial",value:"Arial, Helvetica, sans-serif"},{label:"Georgia",value:'Georgia, "Times New Roman", serif'},{label:"Mono",value:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"}],Ot=["Hex","RGB","RGBA","HSL"],Et=["Solid","Gradient","Image"],Ut=[{label:"Font Size",property:"fontSize",cssProperty:"font-size",min:8,max:96,step:1,unit:"px"},{label:"Line",property:"lineHeight",cssProperty:"line-height",min:8,max:120,step:1,unit:"px"},{label:"Tracking",property:"letterSpacing",cssProperty:"letter-spacing",min:-2,max:12,step:.25,unit:"px"},{label:"Padding X",property:"paddingInline",cssProperty:"padding-inline",min:0,max:120,step:1,unit:"px"},{label:"Padding Y",property:"paddingBlock",cssProperty:"padding-block",min:0,max:120,step:1,unit:"px"},{label:"Margin X",property:"marginInline",cssProperty:"margin-inline",min:-80,max:160,step:1,unit:"px"},{label:"Margin Y",property:"marginBlock",cssProperty:"margin-block",min:-80,max:160,step:1,unit:"px"},{label:"Radius",property:"borderRadius",cssProperty:"border-radius",min:0,max:80,step:1,unit:"px"},{label:"Opacity",property:"opacity",cssProperty:"opacity",min:0,max:1,step:.01,unit:""},{label:"Width",property:"width",cssProperty:"width",min:0,max:1200,step:1,unit:"px"},{label:"Height",property:"height",cssProperty:"height",min:0,max:1200,step:1,unit:"px"}],Sa=["color","backgroundColor","backgroundImage","backgroundPosition","backgroundSize","fontFamily","fontSize","lineHeight","letterSpacing","paddingInline","paddingBlock","marginInline","marginBlock","borderRadius","opacity","width","height"],Nt=new Set(["area","audio","base","br","button","canvas","col","embed","hr","iframe","img","input","link","meta","object","param","picture","portal","select","source","textarea","track","video","wbr"]),La="chisel:locationchange",ea=0,la,Ke=!1,Wa=0,xa=new Map,We=new WeakMap;function Cr({id:e,as:a,children:t,...o}){return u(a??"span",{"data-chisel-id":e,...o,children:t})}function Sr({enabled:e=process.env.NODE_ENV!=="production",position:a="right",projectName:t="Next.js app",embedded:o=!1}){let[r,n]=p.useState(null),[i,c]=p.useState(null),[f,I]=p.useState(null),[S,v]=p.useState([]),[B,A]=p.useState(null),[b,P]=p.useState([]),[T,q]=p.useState(!1),[E,ae]=p.useState(""),[M,H]=p.useState(()=>[pa(1)]),[R,W]=p.useState("version-1"),[G,K]=p.useState(!1),[te,U]=p.useState(""),[fe,oe]=p.useState(""),[re,le]=p.useState(!1),[$,ee]=p.useState([]),[m,g]=p.useState(0),[Z,j]=p.useState(""),se=p.useRef(new WeakMap),O=p.useRef(new Map),N=p.useRef(new Map),xe=p.useRef(""),V=p.useRef(null),ne=p.useRef(null),X=p.useRef([]),Je=p.useRef(null),Qe=p.useRef([]),me=p.useRef(null),ge=p.useRef(null),ye=p.useRef(null),He=p.useRef(!1),Ie=p.useRef(null),s=p.useRef(null),L=p.useRef(null),k=p.useRef(!0),D=r?new URLSearchParams(r.search).has("editor"):!1,Q=e&&process.env.NEXT_PUBLIC_CHISEL_ENABLED!=="0"&&(o||D),ya=r?rt(r.pathname,r.search):"";if(p.useEffect(()=>()=>ha(N.current),[]),p.useEffect(()=>{let l=()=>n(Kt());return l(),$t(l)},[]),p.useEffect(()=>{if(Q){He.current=!0;return}if(!He.current||(He.current=!1,o))return;let l=M.find(d=>d.id===R)??M[0];l&&Za(l,O.current,N.current),ha(N.current),V.current=null,ne.current=null,X.current=[],c(null),I(null),v([]),A(null),P([]),q(!1)},[R,Q,o,M]),p.useEffect(()=>{if(!Q||!o)return;let l=()=>{let d=document.documentElement?.dataset.chiselSelection,x=d?document.querySelector(d):null;x instanceof HTMLElement&&!Re(x)&&Ye([x])};return window.addEventListener("chisel:select",l),()=>window.removeEventListener("chisel:select",l)},[Q,o]),p.useEffect(()=>{if(!Q){Ke=!1;return}let l=()=>{Ie.current===null&&(Ie.current=window.requestAnimationFrame(()=>{Ie.current=null;let x=V.current,h=X.current;A(C=>x?ie(x.getBoundingClientRect()):C),P(h.map(C=>ie(C.getBoundingClientRect())))}))},d=x=>{let h=x.target;h instanceof HTMLElement&&Re(h)||x.key==="Escape"&&(ne.current=null,X.current=[],I(null),v([]),P([]))};return document.addEventListener("keydown",d),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{Ie.current!==null&&window.cancelAnimationFrame(Ie.current),s.current!==null&&window.cancelAnimationFrame(s.current),document.removeEventListener("keydown",d),window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0)}},[Q]),p.useEffect(()=>{ne.current=f},[f]),p.useEffect(()=>{X.current=S},[S]),p.useEffect(()=>{if(!S.length)return;let l=null,d=()=>{l===null&&(l=window.requestAnimationFrame(()=>{l=null,P(S.map(h=>ie(h.getBoundingClientRect())))}))};if(typeof ResizeObserver>"u"){let h=window.setInterval(d,750);return()=>{l!==null&&window.cancelAnimationFrame(l),window.clearInterval(h)}}let x=new ResizeObserver(d);for(let h of S)x.observe(h);return()=>{l!==null&&window.cancelAnimationFrame(l),x.disconnect()}},[f,S]),p.useEffect(()=>{if(!Q)return;let l=jt(ya);xe.current=l,oe(""),V.current=null,ne.current=null,X.current=[],c(null),I(null),v([]),A(null),P([]);let d=M.find(_=>_.id===R)??M[0];d&&Za(d,O.current,N.current),O.current.clear(),ha(N.current);let x=Jt(r?.pathname??window.location.pathname,r?.search??window.location.search),h=Qt(l,x);k.current=!h.warning,U(h.warning??"");let C=h.envelope?.versions.length?h.envelope.versions:[pa(1)],y=h.envelope?.activeVersionId??C[0].id;H(C),W(y),oe(l);let F=C.find(_=>_.id===y)??C[0],z=window.setTimeout(()=>aa(F,C,O.current,N.current),0);if(h.migrated&&h.envelope){let _=$a(l,C,y);_&&U(_)}return Ke=!1,()=>window.clearTimeout(z)},[ya,Q]),p.useEffect(()=>{if(!Q||!k.current||!xe.current||fe!==xe.current)return;let l=$a(xe.current,M,R);l&&U(l)},[R,Q,fe,M]),p.useEffect(()=>{if(!Q||typeof MutationObserver>"u"||!document.body)return;let l=null,d=()=>{l=null;let h=M.find(y=>y.id===R)??M[0];h&&aa(h,M,O.current,N.current,!1),V.current&&!V.current.isConnected&&(V.current=null,c(null),A(null));let C=X.current.filter(y=>y.isConnected);if(C.length!==X.current.length){let y=C[C.length-1]??null;X.current=C,ne.current=y,v(C),I(y),P(C.map(F=>ie(F.getBoundingClientRect())))}},x=new MutationObserver(h=>{if(Ke)return;let C=h.some(F=>{let z=F.target instanceof HTMLElement?F.target:F.target.parentElement;return z&&We.has(z)?!1:z&&!Re(z)?!0:Array.from(F.addedNodes).some(_=>{let Ra=_ instanceof HTMLElement?_:_.parentElement;return!!(Ra&&!Re(Ra))})}),y=h.some(F=>Array.from(F.removedNodes).some(z=>z instanceof HTMLElement&&((V.current?z===V.current||z.contains(V.current):!1)||X.current.some(_=>z===_||z.contains(_)))));!C&&!y||l===null&&(l=window.requestAnimationFrame(d))});return x.observe(document.body,{attributes:!0,attributeFilter:["style"],characterData:!0,childList:!0,subtree:!0}),()=>{x.disconnect(),l!==null&&window.cancelAnimationFrame(l)}},[R,Q,M]),p.useEffect(()=>{if(!re)return;let l=h=>{let C=Y(h,0,Math.max(0,$.length-1)),y=$[C];g(C),y&&(V.current=y,c(y),A(ie(y.getBoundingClientRect())),j(_a(y)))},d=()=>{Ye(Qe.current.filter(h=>h.isConnected)),le(!1),window.requestAnimationFrame(()=>Je.current?.focus())},x=h=>{let C=$[m],y=m;if(h.key==="ArrowDown")y=m+1;else if(h.key==="ArrowUp")y=m-1;else if(h.key==="Home")y=0;else if(h.key==="End")y=$.length-1;else if(h.key==="ArrowRight"&&C){let F=$.find(z=>z.parentElement===C);F&&(y=$.indexOf(F))}else if(h.key==="ArrowLeft"&&C){let F=C.parentElement;for(;F&&!$.includes(F);)F=F.parentElement;F&&(y=$.indexOf(F))}else if(h.key==="Enter"&&C){Ye(h.shiftKey?Ja(X.current,C):[C]),h.shiftKey||le(!1),h.preventDefault();return}else if(h.key==="Escape"){d(),h.preventDefault();return}else return;l(y),h.preventDefault()};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[re,$,m]),p.useEffect(()=>{E&&(me.current?.focus(),me.current?.select())},[E]),p.useEffect(()=>{if(!G)return;let l=h=>{K(!1),h&&window.requestAnimationFrame(()=>ye.current?.focus())},d=h=>{h.target instanceof Node&&ge.current?.contains(h.target)||l(!0)},x=h=>{h.key==="Escape"&&(l(!0),h.preventDefault())};return document.addEventListener("pointerdown",d,!0),document.addEventListener("keydown",x),()=>{document.removeEventListener("pointerdown",d,!0),document.removeEventListener("keydown",x)}},[G]),!Q)return null;let he=S.length,Oe=f?se.current.get(f):void 0,fa=!!(he<=1&&f&&Ya(f)),Ee=f?De(f):void 0,Pa=f?$e(f):"",ue=M.find(l=>l.id===R)??M[0]??pa(1),_e=he>1?S.flatMap(l=>ao(ue.elements[de(l)])):f&&Oe?eo(f,Oe):[],Ce=f?getComputedStyle(f):null,Ue=l=>he>1&&new Set(S.map(d=>getComputedStyle(d)[l])).size>1,Ne=()=>S.length?S:f?[f]:[];function Ye(l){for(let x of l)Wt(x,se.current);let d=l[l.length-1]??null;if(X.current=l,ne.current=d,v(l),I(d),P(l.map(x=>ie(x.getBoundingClientRect()))),o&&d){let x=d.getBoundingClientRect();window.dispatchEvent(new CustomEvent("chisel:selection",{detail:{selector:$e(d),tag:d.tagName.toLowerCase(),x:x.left+x.width/2+window.scrollX,y:x.top+x.height/2+window.scrollY,offsetX:.5,offsetY:.5}}))}}let Se=()=>{P(S.map(l=>ie(l.getBoundingClientRect())))},va=(l,d)=>{let x=document.elementsFromPoint(l,d).find(h=>h instanceof HTMLElement&&!Re(h));return x instanceof HTMLElement?lo(x):null},nt=l=>{L.current={x:l.clientX,y:l.clientY},s.current===null&&(s.current=window.requestAnimationFrame(()=>{s.current=null;let d=L.current;if(!d)return;let x=va(d.x,d.y);if(!x){V.current=null,c(null),A(null);return}x!==V.current&&(V.current=x,c(x),A(ie(x.getBoundingClientRect())))}))},ct=l=>{l.preventDefault(),l.stopPropagation();let d=va(l.clientX,l.clientY);d&&(le(!1),Ye(l.shiftKey?Ja(X.current,d):[d]))},pt=()=>{let l=so();Qe.current=X.current,ee(l),g(0),le(!0);let d=l[0];d?(V.current=d,c(d),A(ie(d.getBoundingClientRect())),j(_a(d))):j("No visible elements available")},mt=()=>{let l={id:`version-${Date.now()}`,name:`Version ${M.length+1}`,elements:Xt(ue.elements)};ia(d=>[...d,l]),W(l.id),K(!1);for(let[d,x]of Object.entries(ue.elements)){if(!x.asset)continue;let h=N.current.get(ke(ue.id,d));h&&N.current.set(ke(l.id,d),h)}aa(l,[...M,l],O.current,N.current),Se()},ht=l=>{W(l.id),K(!1),aa(l,M,O.current,N.current),Se(),window.requestAnimationFrame(()=>ye.current?.focus())},Lt=(l,d)=>{let x=l.unit==="px"?`${d}px`:String(d);Ma(l,x)},Ma=(l,d)=>{let x=Ne();if(x.length){for(let h of x)be(h,de(h),O.current),ce(h),h.style[l.property]=d,we(h,{styles:{[l.property]:d}});Se()}},Aa=(l,d,x)=>{let h=Ne();if(h.length){for(let C of h){let y=de(C);if(be(C,de(C),O.current),ce(C),l==="backgroundColor"&&ho(d)){if(C.style.backgroundImage=d,d.startsWith("url(")){let F=Ia(d),z=ke(R,y);x&&F?_t(N.current,z,F):ma(N.current,z),C.style.backgroundPosition="center",C.style.backgroundSize="cover",we(C,{styles:{backgroundImage:x?"":d,backgroundPosition:"center",backgroundSize:"cover"},asset:x??null})}else we(C,{styles:{backgroundImage:d},asset:null});continue}if(C.style[l]=d,l==="backgroundColor"){ma(N.current,ke(R,y)),C.style.backgroundImage="",C.style.backgroundPosition="",C.style.backgroundSize="",we(C,{styles:{backgroundColor:d,backgroundImage:"",backgroundPosition:"",backgroundSize:""},asset:null});continue}we(C,{styles:{[l]:d}})}Se()}},xt=l=>{let d=Ne();if(d.length){for(let x of d)be(x,de(x),O.current),ce(x),x.style.fontFamily=l,we(x,{styles:{fontFamily:l}});Se()}},gt=l=>{let d=Ne();if(d.length)for(let x of d)be(x,de(x),O.current),ce(x),x.style.fontFamily=l},It=l=>{!f||!fa||(be(f,de(f),O.current),ce(f),f.textContent=l,we(f,{text:l}),Se())},Ct=()=>{let l=Ne();if(l.length){for(let d of l){let x=se.current.get(d),h=de(d),C=O.current.get(h),y=ue.elements[h];if(y){ce(d);for(let F of Object.keys(y.styles))d.style[F]=C?.styles[F]??"";typeof y.text=="string"&&Ya(d)&&(d.textContent=C?.text??x?.text??""),St(d),y.asset&&ma(N.current,ke(R,h))}}Se()}};function we(l,d){let x=de(l);be(l,x,O.current),ia(h=>h.map(C=>{if(C.id!==R)return C;let y=C.elements[x];return{...C,elements:{...C.elements,[x]:{selector:$e(l),sourceHint:De(l),text:d.text??y?.text,asset:d.asset===null?void 0:d.asset??y?.asset,styles:{...y?.styles??{},...d.styles??{}}}}}}))}function St(l){let d=de(l),x=M.some(h=>h.id!==R&&!!h.elements[d]);ia(h=>h.map(C=>{if(C.id!==R)return C;let{[d]:y,...F}=C.elements;return{...C,elements:F}})),x||O.current.delete(d)}function ia(l){k.current=!0,H(l)}let wt=async()=>{let l=f?ie(f.getBoundingClientRect()):void 0,d=Object.keys(ue.elements).length?oo({projectName:t,version:ue,baselines:O.current}):f&&Oe&&l?to({projectName:t,element:f,snapshot:Oe,rect:l,selector:Pa,sourceHint:Ee,changes:_e}):void 0;if(d)try{if(!navigator.clipboard?.writeText)throw new Error("Clipboard unavailable");await navigator.clipboard.writeText(d),ae(""),q(!0),window.setTimeout(()=>q(!1),1600)}catch{q(!1),ae(d)}};return w("div",{"data-chisel-root":"true",className:"chisel-root",children:[u(zt,{}),u("div",{className:"chisel-visually-hidden","aria-live":"polite",children:Z}),u("div",{className:"chisel-inspection-layer","aria-hidden":"true",onPointerMove:nt,onPointerLeave:()=>{L.current=null,s.current!==null&&window.cancelAnimationFrame(s.current),s.current=null,V.current=null,c(null),A(null)},onClick:ct}),B&&i&&!S.includes(i)?u(Xa,{rect:B,tone:"hover"}):null,b.map((l,d)=>u(Xa,{rect:l,tone:"selected"},`${l.left}-${l.top}-${d}`)),u("aside",{className:`chisel-panel chisel-panel-${a}`,"aria-label":"Chisel editor",children:u("div",{className:"chisel-panel-wrapper",children:u("div",{className:"chisel-panel-inner",children:w("div",{className:"chisel-folder chisel-folder-root",children:[u("header",{className:"chisel-folder-header chisel-panel-header",children:w("div",{className:"chisel-panel-toolbar",children:[u("button",{className:"chisel-toolbar-add",type:"button","aria-label":"Add version",onClick:mt,children:u(Ve,{size:16,strokeWidth:1.75,"aria-hidden":"true"})}),w("div",{className:"chisel-preset-manager",ref:ge,children:[w("button",{className:"chisel-preset-trigger",type:"button","aria-expanded":G,"aria-haspopup":"listbox",ref:ye,onClick:()=>K(l=>{let d=!l;return d&&window.requestAnimationFrame(()=>ge.current?.querySelector('[role="option"][aria-selected="true"]')?.focus()),d}),children:[u("span",{className:"chisel-preset-trigger-label",children:ue.name}),u(ve,{className:"chisel-chevron",size:16,strokeWidth:1.75,"aria-hidden":"true"})]}),G?u("div",{className:"chisel-preset-dropdown",role:"listbox","aria-label":"Page versions",onKeyDown:ba,children:u("div",{className:"chisel-preset-list",children:M.map(l=>w("button",{className:"chisel-preset-item",type:"button",role:"option","aria-selected":l.id===ue.id,"data-active":l.id===ue.id,onClick:()=>ht(l),children:[u("span",{className:"chisel-preset-name",children:l.name}),u("span",{className:"chisel-preset-count",children:Object.keys(l.elements).length})]},l.id))})}):null]}),u("button",{className:"chisel-toolbar-add",type:"button",onClick:()=>{ne.current=null,X.current=[],I(null),v([]),P([])},"aria-label":"Clear selection",children:u(ze,{size:16,strokeWidth:1.75,"aria-hidden":"true"})})]})}),te?u("div",{className:"chisel-note-row chisel-warning",role:"alert",children:te}):null,f&&Oe?w("div",{className:"chisel-content",children:[w("div",{className:"chisel-text-control chisel-context-row",children:[u("span",{className:"chisel-text-label",children:he>1?"Selection":"Element"}),u("code",{className:"chisel-text-code",children:he>1?`${he} elements`:f.tagName.toLowerCase()})]}),he===1?w(Xe,{children:[w("div",{className:"chisel-text-control chisel-context-row chisel-selector-row",children:[u("span",{className:"chisel-text-label",children:"Selector"}),u("code",{className:"chisel-selector",children:Pa})]}),w("div",{className:Ee?"chisel-text-control chisel-context-row":"chisel-text-control chisel-context-row chisel-warning-row",children:[u("span",{className:"chisel-text-label",children:"Source"}),u("span",{className:Ee?"chisel-text-value":"chisel-warning",children:Ee?`Source hint: ${Ee}`:"Low-confidence source mapping"})]})]}):null,w("div",{className:"chisel-folder",children:[u("div",{className:"chisel-folder-header",children:u("div",{className:"chisel-folder-header-top",children:u("div",{className:"chisel-folder-title-row",children:u("span",{className:"chisel-folder-title",children:"Content"})})})}),u("div",{className:"chisel-folder-content",children:w("div",{className:"chisel-folder-inner",children:[w("label",{className:"chisel-text-control chisel-textarea-control",children:[u("span",{className:"chisel-text-label",children:"Text"}),u("textarea",{className:"chisel-text-input",value:f.textContent??"",onChange:l=>It(l.target.value),disabled:!fa,rows:3})]}),fa?null:u("div",{className:"chisel-note-row",children:he>1?"Text editing is enabled for one element at a time.":"Text editing is enabled for simple text elements."})]})})]}),w("div",{className:"chisel-folder",children:[u("div",{className:"chisel-folder-header",children:u("div",{className:"chisel-folder-header-top",children:u("div",{className:"chisel-folder-title-row",children:u("span",{className:"chisel-folder-title",children:"Color"})})})}),u("div",{className:"chisel-folder-content",children:w("div",{className:"chisel-folder-inner",children:[u(Ka,{label:"Text",value:f.style.color||Be(Ce?.color??"#000000"),onChange:l=>Aa("color",l),mixed:Ue("color")}),u(Ka,{label:"Fill",value:f.style.backgroundImage||(Ce?.backgroundImage&&Ce.backgroundImage!=="none"?Ce.backgroundImage:f.style.backgroundColor||Be(Ce?.backgroundColor??"#ffffff")),onChange:(l,d)=>Aa("backgroundColor",l,d),supportsBackgroundImages:!0,unavailableAsset:ue.elements[de(f)]?.asset,mixed:Ue("backgroundColor")||Ue("backgroundImage")})]})})]}),w("div",{className:"chisel-folder",children:[u("div",{className:"chisel-folder-header",children:u("div",{className:"chisel-folder-header-top",children:u("div",{className:"chisel-folder-title-row",children:u("span",{className:"chisel-folder-title",children:"Style"})})})}),u("div",{className:"chisel-folder-content",children:w("div",{className:"chisel-folder-inner",children:[u(Gt,{value:Ce?.fontFamily??"",onChange:xt,onPreview:gt,mixed:Ue("fontFamily")}),Ut.map(l=>u(Vt,{control:l,computedStyle:Ce,element:f,mixed:Ue(l.property),onSlide:d=>Lt(l,d),onValueChange:d=>Ma(l,d)},l.cssProperty))]})})]}),w("div",{className:"chisel-folder",children:[u("div",{className:"chisel-folder-header",children:w("div",{className:"chisel-folder-header-top",children:[u("div",{className:"chisel-folder-title-row",children:u("span",{className:"chisel-folder-title",children:"Changes"})}),u("span",{className:"chisel-folder-count",children:_e.length})]})}),u("div",{className:"chisel-folder-content",children:u("div",{className:"chisel-folder-inner",children:_e.length?_e.map((l,d)=>w("div",{className:"chisel-text-control",children:[u("span",{className:"chisel-text-label",children:l.property}),u("strong",{className:"chisel-text-value",children:String(l.after)})]},`${l.property}-${d}`)):u("div",{className:"chisel-note-row",children:"No preview changes yet."})})})]}),w("div",{className:"chisel-actions",children:[u("button",{className:"chisel-button",type:"button",onClick:Ct,children:"Reset"}),u("button",{className:"chisel-button chisel-button-primary",type:"button",onClick:wt,children:T?"Copied":"Copy agent prompt"})]}),T?u("div",{className:"chisel-note-row",role:"status",children:"Prompt copied"}):null,E?w("div",{className:"chisel-note-row",role:"alert",children:["Press Cmd+C/Ctrl+C",u("textarea",{ref:me,readOnly:!0,value:E,"aria-label":"Agent prompt copy fallback"})]}):null]}):w("div",{className:"chisel-empty",children:[u("div",{className:"chisel-note-row",children:"Select any visible element to edit its text and style preview."}),u("button",{className:"chisel-button",type:"button",ref:Je,onClick:pt,"aria-pressed":re,children:"Pick element"})]})]})})})})]})}function Xa({rect:e,tone:a}){return u("div",{className:`chisel-box chisel-box-${a}`,style:{transform:`translate3d(${e.left}px, ${e.top}px, 0)`,width:e.width,height:e.height}})}function Gt({value:e,onChange:a,onPreview:t,mixed:o=!1}){let[r,n]=p.useState(!1),i=p.useRef(null),c=p.useRef(null),f=p.useRef(e),I=p.useMemo(()=>io(e),[e]),S=no(e,I),v=o?"Mixed":S?.label??Ze(e)??"Font";p.useEffect(()=>{r||(f.current=e)},[r,e]),p.useEffect(()=>{if(!r)return;let b=T=>{let q=T.target;q instanceof Node&&i.current?.contains(q)||(t(f.current),n(!1),window.requestAnimationFrame(()=>c.current?.focus()))},P=T=>{T.key==="Escape"&&(t(f.current),n(!1),window.requestAnimationFrame(()=>c.current?.focus()))};return document.addEventListener("pointerdown",b,!0),document.addEventListener("keydown",P),()=>{document.removeEventListener("pointerdown",b,!0),document.removeEventListener("keydown",P)}},[r,t]);let B=()=>{if(r){t(f.current),n(!1);return}f.current=e,n(!0),window.requestAnimationFrame(()=>i.current?.querySelector('[role="option"][aria-selected="true"]')?.focus())},A=b=>{f.current=b.value,a(b.value),n(!1),window.requestAnimationFrame(()=>c.current?.focus())};return w("div",{className:"chisel-font-control",ref:i,children:[u("span",{className:"chisel-font-label",children:"Font"}),w("div",{className:"chisel-font-picker",children:[w("button",{className:"chisel-font-trigger",ref:c,type:"button","aria-expanded":r,"aria-haspopup":"listbox",onClick:B,children:[u("span",{className:"chisel-font-trigger-label",children:v}),u(ve,{className:"chisel-chevron",size:16,strokeWidth:1.75,"aria-hidden":"true"})]}),r?u("div",{className:"chisel-preset-dropdown chisel-font-dropdown",role:"listbox","aria-label":"Font family",onKeyDown:ba,children:u("div",{className:"chisel-preset-list chisel-font-list",children:I.map(b=>u("button",{className:"chisel-preset-item chisel-font-item","data-active":ua(e,b.value),"aria-selected":ua(e,b.value),onClick:()=>A(b),onFocus:()=>t(b.value),onPointerEnter:()=>t(b.value),role:"option",style:{fontFamily:b.value},type:"button",children:u("span",{className:"chisel-preset-name",children:b.label})},b.value))})}):null]})]})}function Ka({label:e,value:a,onChange:t,supportsBackgroundImages:o=!1,unavailableAsset:r,mixed:n=!1}){let i=tt(a),c=Ia(a),f=o&&i?"Gradient":o&&(c!==void 0||r)?"Image":"Solid",I=i?.start??(c!==void 0?"#FFFFFF":at(a)),[S,v]=p.useState(f),[B,A]=p.useState(()=>Ae(I)),[b,P]=p.useState(I),[T,q]=p.useState(i?.start??I),[E,ae]=p.useState(i?.end??"#FFFFFF"),[M,H]=p.useState("start"),[R,W]=p.useState(c??""),[G,K]=p.useState(""),[te,U]=p.useState(!1),[fe,oe]=p.useState(!1),re=p.useRef(null),le=p.useRef(null),$=S==="Gradient"?M==="start"?T:E:b,ee=Be($).toUpperCase(),m=mo($),g=p.useMemo(()=>uo(ka(ee)),[ee]),Z=n?"Mixed":S==="Gradient"?"Gradient":S==="Image"?"Image":b;p.useEffect(()=>{let s=tt(a),L=Ia(a);if(o&&s){let D=M==="end"?s.end:s.start;v("Gradient"),q(s.start),ae(s.end),P(D),A(Ae(D)),U(!1);return}if(o&&L!==void 0){v("Image"),W(L),P("#FFFFFF"),U(!1);return}if(o&&r){v("Image"),W(""),K(""),U(!1);return}let k=at(a);v("Solid"),P(D=>D&&Be(D)===Be(k)?D:k),A(Ae(k)),U(!1)},[M,o,r,a]),p.useEffect(()=>{if(!fe)return;let s=k=>{let D=k.target;D instanceof Node&&re.current?.contains(D)||(oe(!1),window.requestAnimationFrame(()=>le.current?.focus()))},L=k=>{k.key==="Escape"&&(oe(!1),window.requestAnimationFrame(()=>le.current?.focus()),k.preventDefault())};return document.addEventListener("pointerdown",s,!0),document.addEventListener("keydown",L),()=>{document.removeEventListener("pointerdown",s,!0),document.removeEventListener("keydown",L)}},[fe]);let j=s=>{let L=et(s);if(!L){U(s.trim().length>0);return}let k=Te(L)??L;if(A(Ae(k)),P(k),U(!1),S==="Gradient"){ge(M,k);return}t(k)},se=(s,L=m,k=B)=>{let D=po(s,L,k);if(P(D),U(!1),S==="Gradient"){ge(M,D);return}t(D)},O=(s,L)=>{let k=Y((s.clientX-L.left)/L.width*100,0,100),D=Y((1-(s.clientY-L.top)/L.height)*100,0,100);se(ta(g.h,k,D))},N=(s,L)=>{let k=Y((s.clientX-L.left)/L.width*360,0,360);se(ta(k,g.s,g.v))},xe=(s,L)=>{let k=Y((s.clientX-L.left)/L.width,0,1);se(ee,k)},V=s=>{if(!ra(s.key))return;let L=s.shiftKey?10:1,k=Y(g.s+(s.key==="ArrowRight"?L:s.key==="ArrowLeft"?-L:0),0,100),D=Y(g.v+(s.key==="ArrowUp"?L:s.key==="ArrowDown"?-L:0),0,100);se(ta(g.h,k,D)),s.preventDefault()},ne=s=>{if(!ra(s.key))return;let L=s.shiftKey?10:1,k=Y(g.h+(Ca(s.key)?L:-L),0,360);se(ta(k,g.s,g.v)),s.preventDefault()},X=s=>{if(!ra(s.key))return;let L=s.shiftKey?.1:.01;se(ee,Y(m+(Ca(s.key)?L:-L),0,1)),s.preventDefault()},Je=s=>{A(s),se(ee,m,s)},Qe=s=>{if(!(s!=="Solid"&&!o)){if(v(s),s==="Solid"&&t(b),s==="Gradient"){let L=T||b;q(L),H("start"),P(L),t(oa(L,E))}s==="Image"&&R.trim()&&t(Fe(R))}},me=s=>{let L=s==="start"?T:E;H(s),P(L),A(Ae(L)),U(!1)},ge=(s,L)=>{let k=s==="start"?L:T,D=s==="end"?L:E;q(k),ae(D),t(oa(k,D))},ye=(s,L)=>{let k=et(L);if(s==="start"?q(L):ae(L),H(s),P(L),!k){U(L.trim().length>0);return}let D=Te(k)??k;A(Ae(D)),P(D),U(!1),ge(s,D)},He=s=>{W(s),K(""),t(s.trim()?Fe(s):"")},Ie=s=>{let L=s.currentTarget.files?.[0];if(!L)return;let k=URL.createObjectURL(L);K(L.name),W(k),t(Fe(k),{fileName:L.name,mimeType:L.type,size:L.size})};return w("div",{className:"chisel-color-control","data-picker-open":fe,ref:re,children:[u("span",{className:"chisel-color-label",children:e}),w("span",{className:"chisel-color-inputs",children:[u("button",{className:"chisel-color-swatch",ref:le,"aria-expanded":fe,"aria-label":`${e} color picker`,onClick:()=>oe(s=>!s),style:{background:S==="Gradient"?oa(T,E):S==="Image"&&R?Fe(R):b},type:"button"}),u("input",{className:"chisel-color-value-input","aria-label":`${e} color value`,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off","data-invalid":te,readOnly:S!=="Solid",spellCheck:!1,style:{width:`${Math.max(7.5,Math.min(Z.length+.5,18))}ch`},value:Z,onBlur:()=>{S==="Solid"&&j(b)},onChange:s=>{if(S!=="Solid")return;let L=s.target.value;P(L),j(L)},onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),j(b),s.currentTarget.blur()),s.key==="Escape"&&(s.preventDefault(),P(I),U(!1),oe(!1),s.currentTarget.blur())}})]}),fe?w("div",{className:"chisel-color-popover",role:"dialog","aria-label":`${e} custom color picker`,children:[w("div",{className:"chisel-color-tabs",children:[Et.map(s=>u("button",{className:"chisel-color-tab","data-active":S===s,"aria-disabled":s!=="Solid"&&!o,onClick:()=>Qe(s),type:"button",children:s},s)),u("button",{className:"chisel-color-close","aria-label":"Close color picker",onClick:()=>oe(!1),type:"button",children:"\xD7"})]}),S!=="Image"?w(Xe,{children:[S==="Gradient"?w(Xe,{children:[u("div",{className:"chisel-color-gradient-preview",style:{backgroundImage:oa(T,E)}}),w("div",{className:"chisel-color-stop-buttons",role:"group","aria-label":`${e} gradient endpoints`,children:[w("button",{className:"chisel-color-stop-button","data-active":M==="start","aria-label":`${e} gradient From`,onClick:()=>me("start"),type:"button",children:[u("span",{className:"chisel-color-stop-swatch",style:{background:T}}),u("span",{children:"From"})]}),w("button",{className:"chisel-color-stop-button","data-active":M==="end","aria-label":`${e} gradient To`,onClick:()=>me("end"),type:"button",children:[u("span",{className:"chisel-color-stop-swatch",style:{background:E}}),u("span",{children:"To"})]})]})]}):null,u("div",{className:"chisel-color-field",role:"slider",tabIndex:0,"aria-label":`${e} saturation and brightness`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":g.s,"aria-valuetext":`Saturation ${g.s}%, brightness ${g.v}%`,onKeyDown:V,onPointerDown:s=>{let L=s.currentTarget.getBoundingClientRect();O(s,L),s.currentTarget.setPointerCapture(s.pointerId)},onPointerMove:s=>{s.buttons&1&&O(s,s.currentTarget.getBoundingClientRect())},style:{backgroundColor:`hsl(${g.h} 100% 50%)`},children:u("span",{className:"chisel-color-field-cursor",style:{left:`clamp(10px, ${g.s}%, calc(100% - 10px))`,top:`clamp(10px, ${100-g.v}%, calc(100% - 10px))`,backgroundColor:ee}})}),u("div",{className:"chisel-color-hue",role:"slider",tabIndex:0,"aria-label":`${e} hue`,"aria-valuemin":0,"aria-valuemax":360,"aria-valuenow":g.h,onKeyDown:ne,onPointerDown:s=>{let L=s.currentTarget.getBoundingClientRect();N(s,L),s.currentTarget.setPointerCapture(s.pointerId)},onPointerMove:s=>{s.buttons&1&&N(s,s.currentTarget.getBoundingClientRect())},children:u("span",{className:"chisel-color-hue-cursor",style:{left:`clamp(8px, ${g.h/360*100}%, calc(100% - 8px))`}})}),w("div",{className:"chisel-color-alpha",role:"slider",tabIndex:0,"aria-label":`${e} alpha`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(m*100),"aria-valuetext":`${Math.round(m*100)}%`,onKeyDown:X,onPointerDown:s=>{let L=s.currentTarget.getBoundingClientRect();xe(s,L),s.currentTarget.setPointerCapture(s.pointerId)},onPointerMove:s=>{s.buttons&1&&xe(s,s.currentTarget.getBoundingClientRect())},style:{"--chisel-alpha-color":ee},children:[u("span",{className:"chisel-color-alpha-fill",style:{width:`${m*100}%`}}),u("span",{className:"chisel-color-alpha-cursor",style:{left:`clamp(12px, ${m*100}%, calc(100% - 12px))`,backgroundColor:ft(ee,m)}})]}),w("div",{className:"chisel-color-format-row",children:[u("select",{className:"chisel-color-format-select","aria-label":`${e} color format`,value:B,onChange:s=>Je(s.target.value),children:Ot.map(s=>u("option",{value:s,children:s},s))}),u("input",{className:"chisel-color-format-input","aria-label":`${e} formatted color value`,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off","data-invalid":te,spellCheck:!1,value:b,onBlur:()=>j(b),onChange:s=>{let L=s.target.value;P(L),j(L)}})]})]}):null,S==="Gradient"?w(Xe,{children:[w("label",{className:"chisel-color-extra-row",children:[u("span",{children:"From"}),u("input",{"aria-label":`${e} gradient From value`,value:T,onFocus:()=>me("start"),onChange:s=>ye("start",s.target.value)})]}),w("label",{className:"chisel-color-extra-row",children:[u("span",{children:"To"}),u("input",{"aria-label":`${e} gradient To value`,value:E,onFocus:()=>me("end"),onChange:s=>ye("end",s.target.value)})]})]}):null,S==="Image"?w(Xe,{children:[w("label",{className:"chisel-color-extra-row",children:[u("span",{children:"URL"}),u("input",{"aria-label":`${e} image URL`,value:R,onChange:s=>He(s.target.value),placeholder:"https://..."})]}),w("label",{className:"chisel-color-upload-row",children:[u("span",{children:"Upload"}),u("span",{className:"chisel-color-upload-name",children:G||"Choose image"}),u("input",{"aria-label":`${e} image upload`,accept:"image/*",type:"file",onChange:Ie})]}),r&&!R.startsWith("blob:")?w("div",{className:"chisel-note-row",role:"status",children:["Re-select this asset: ",r.fileName]}):null]}):null]}):null]})}function Vt({control:e,computedStyle:a,element:t,onSlide:o,onValueChange:r,mixed:n=!1}){let c=(a??getComputedStyle(t))[e.property],f=parseFloat(c),I=e.property==="width"?t.getBoundingClientRect().width:e.property==="height"?t.getBoundingClientRect().height:e.min,S=Number.isFinite(f)?f:I,v=Y(S,e.min,e.max),B=vo(v,e.min,e.max),A=t.style[e.property],b=n?"Mixed":A||`${pe(S)}${e.unit}`,P=yo(b,e),[T,q]=p.useState(b),[E,ae]=p.useState(!1),[M,H]=p.useState(!1),[R,W]=p.useState(!1),G=p.useRef(null),K=p.useRef(null),te=p.useRef(!1),U=p.useMemo(()=>xo(e),[e]),fe={left:`max(5px, ${B}% - 9px)`,"--chisel-handle-opacity":B<18?"0.18":"1","--chisel-handle-scale":B<18?"0.25":"1"};p.useEffect(()=>{E||(q(b),H(!1))},[b,E]),p.useEffect(()=>{if(!R)return;let m=()=>{W(!1),window.requestAnimationFrame(()=>G.current?.focus())},g=j=>{j.target instanceof Node&&G.current?.parentElement?.contains(j.target)||m()},Z=j=>{j.key==="Escape"&&(m(),j.preventDefault())};return document.addEventListener("pointerdown",g,!0),document.addEventListener("keydown",Z),()=>{document.removeEventListener("pointerdown",g,!0),document.removeEventListener("keydown",Z)}},[R]);let oe=(m=T)=>{let g=da(m,e,t,P);if(!g){H(!0);return}q(g),H(!1),r(g)},re=()=>{G.current?.focus(),G.current?.select()},le=(m,g)=>{let Z=Mo(m,g,e);q(`${pe(Z)}${e.unit}`),H(!1),o(Z)},$=()=>{U.length<=1||(W(!0),window.requestAnimationFrame(()=>G.current?.parentElement?.querySelector('[role="option"][aria-selected="true"]')?.focus()))},ee=m=>{let g=go(T,m,e,t,P);if(!g){H(!0);return}q(g),H(!1),r(g),W(!1),G.current?.focus()};return w("div",{className:"chisel-slider","data-units-open":R,onDoubleClick:m=>{m.preventDefault(),m.stopPropagation(),$()},onClick:()=>{if(te.current){te.current=!1;return}window.setTimeout(re,0)},onMouseUp:()=>{te.current||window.setTimeout(re,0)},onPointerCancel:m=>{K.current?.pointerId===m.pointerId&&(K.current=null)},onPointerDown:m=>{m.preventDefault(),K.current={pointerId:m.pointerId,startX:m.clientX,rect:m.currentTarget.getBoundingClientRect(),dragging:!1},m.currentTarget.setPointerCapture(m.pointerId),window.setTimeout(re,0)},onPointerMove:m=>{let g=K.current;!g||g.pointerId!==m.pointerId||!g.dragging&&Math.abs(m.clientX-g.startX)<4||(g.dragging=!0,G.current?.blur(),m.preventDefault(),le(m.clientX,g.rect))},onPointerUp:m=>{let g=K.current;!g||g.pointerId!==m.pointerId||(g.dragging&&(te.current=!0,window.setTimeout(()=>{te.current=!1},250),le(m.clientX,g.rect)),g.dragging||window.setTimeout(re,0),K.current=null)},children:[u("span",{className:"chisel-slider-label",children:e.label}),u("span",{className:"chisel-slider-hashmarks","aria-hidden":"true",children:Array.from({length:9},(m,g)=>u("span",{className:"chisel-slider-hashmark",style:{left:`${(g+1)*10}%`}},g))}),u("span",{className:"chisel-slider-fill",style:{width:`${B}%`}}),u("span",{className:"chisel-slider-handle",style:fe}),u("input",{type:"range",tabIndex:-1,"aria-hidden":"true",min:e.min,max:e.max,step:e.step,value:v,onChange:m=>o(Number(m.target.value))}),u("input",{ref:G,className:"chisel-slider-value-input","aria-label":`${e.label} value`,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off","data-invalid":M,spellCheck:!1,value:T,onBlur:m=>{oe(),ae(!1),m.relatedTarget instanceof HTMLElement&&m.currentTarget.parentElement?.contains(m.relatedTarget)||W(!1)},onChange:m=>{let g=m.target.value;q(g);let Z=da(g,e,t,P);if(!Z){H(g.trim().length>0);return}H(!1),r(Z),Z!==g&&Lo(g)&&q(Z)},onFocus:m=>{ae(!0),m.currentTarget.select()},onMouseDown:m=>{window.setTimeout(()=>{m.currentTarget.focus(),m.currentTarget.select()},0)},onMouseUp:m=>{window.setTimeout(()=>{m.currentTarget.focus(),m.currentTarget.select()},0)},onDoubleClick:m=>{m.preventDefault(),m.stopPropagation(),$()},onKeyDown:m=>{if(m.key==="Enter"&&(m.preventDefault(),oe(),m.currentTarget.blur()),ra(m.key)){let g=Po(T,e,t,P,m.shiftKey?10:1,Ca(m.key));if(!g)return;m.preventDefault(),q(g),H(!1),r(g)}m.key==="Escape"&&(m.preventDefault(),q(b),H(!1),W(!1),m.currentTarget.blur())}}),R?u("div",{className:"chisel-unit-menu",role:"listbox","aria-label":`${e.label} units`,onKeyDown:ba,children:U.map(m=>u("button",{className:"chisel-unit-option","data-active":m===P,"aria-selected":m===P,onClick:g=>{g.preventDefault(),ee(m)},onPointerDown:g=>{g.preventDefault(),g.stopPropagation()},role:"option",type:"button",children:m||"unitless"},m||"unitless"))}):null]})}function zt(){return u("style",{children:""+Ga+`.chisel-root,.chisel-root *{box-sizing:border-box}.chisel-root :where(button,input,textarea,select){margin:0;font:inherit;color:inherit;text-transform:none}.chisel-root button{appearance:none;min-width:var(--chisel-ui-control);min-height:var(--chisel-ui-control)}.chisel-root{--chisel-surface: rgba(0, 0, 0, .04);--chisel-surface-hover: rgba(0, 0, 0, .08);--chisel-surface-active: rgba(0, 0, 0, .1);--chisel-surface-subtle: rgba(0, 0, 0, .06);--chisel-text-root: #000;--chisel-text-section: rgba(0, 0, 0, .65);--chisel-text-label: rgba(0, 0, 0, .6);--chisel-text-focus: #000;--chisel-text-primary: rgba(0, 0, 0, .9);--chisel-text-secondary: rgba(0, 0, 0, .55);--chisel-text-tertiary: rgba(0, 0, 0, .55);--chisel-border: rgba(0, 0, 0, .1);--chisel-border-hover: rgba(0, 0, 0, .15);--chisel-glass-bg: rgba(250, 250, 250, .88);--chisel-radius: 8px;--chisel-row-height: 40px;--chisel-shadow: 0 4px 20px rgba(0, 0, 0, .08);--chisel-motion: .15s cubic-bezier(.2, .8, .2, 1);position:fixed;inset:0;height:100dvh;z-index:2147483647;pointer-events:none;font-family:var(--chisel-ui-font);color:var(--chisel-text-primary);letter-spacing:0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.chisel-root{color-scheme:light;--chisel-warning-color: #805b12;--chisel-danger-color: #8a1f1f}@media(prefers-color-scheme:dark){.chisel-root{color-scheme:dark;--chisel-warning-color: #e2c78c;--chisel-danger-color: #ffa5a5;--chisel-surface: #303030;--chisel-surface-hover: #393939;--chisel-surface-active: #41413e;--chisel-surface-subtle: #383838;--chisel-text-root: #e8e8e5;--chisel-text-section: #b4b4ae;--chisel-text-label: #b4b4ae;--chisel-text-focus: #efeee9;--chisel-text-primary: #e8e8e5;--chisel-text-secondary: #b4b4ae;--chisel-text-tertiary: #9b9b93;--chisel-border: #41413e;--chisel-border-hover: #62625b;--chisel-glass-bg: #262626;--chisel-shadow: 0 4px 20px #0003}}.chisel-root{--chisel-surface:var(--chisel-ui-raised);--chisel-surface-hover:var(--chisel-ui-hover);--chisel-surface-active:var(--chisel-ui-selected);--chisel-surface-subtle:var(--chisel-ui-border);--chisel-text-root:var(--chisel-ui-text);--chisel-text-section:var(--chisel-ui-secondary);--chisel-text-label:var(--chisel-ui-secondary);--chisel-text-focus:var(--chisel-ui-text);--chisel-text-primary:var(--chisel-ui-text);--chisel-text-secondary:var(--chisel-ui-secondary);--chisel-text-tertiary:var(--chisel-ui-muted);--chisel-border:var(--chisel-ui-border);--chisel-border-hover:var(--chisel-ui-border-strong);--chisel-glass-bg:var(--chisel-ui-surface);--chisel-radius:var(--chisel-ui-radius);--chisel-row-height:var(--chisel-ui-control);--chisel-shadow:var(--chisel-ui-panel-shadow);--chisel-motion:var(--chisel-ui-motion)}.chisel-inspection-layer{position:fixed;inset:0;pointer-events:auto;touch-action:pan-y pinch-zoom}.chisel-visually-hidden{position:fixed;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}.chisel-box{position:fixed;left:0;top:0;border-radius:0;pointer-events:none;transition:none}.chisel-box-hover{border:1px solid var(--chisel-ui-focus);background:color-mix(in srgb,var(--chisel-ui-focus) 8%,transparent)}.chisel-box-selected{border:2px solid var(--chisel-ui-focus);box-shadow:0 0 0 1px #ffffffeb,0 0 0 4px color-mix(in srgb,var(--chisel-ui-focus) 18%,transparent)}.chisel-panel{position:fixed;top:max(16px,env(safe-area-inset-top));max-height:calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));width:280px;pointer-events:auto;overflow:visible}.chisel-panel-right{right:16px}.chisel-panel-left{left:16px}.chisel-panel-wrapper{display:inline-flex;flex-direction:column;width:100%}.chisel-panel-inner{width:280px;max-height:calc(100vh - 32px);overflow-y:auto;padding:12px 16px 0;border:0;border-radius:16px;background:var(--chisel-glass-bg);box-shadow:var(--chisel-ui-popover-shadow);transform:translateZ(0);-ms-overflow-style:none;scrollbar-width:none}.chisel-panel-inner::-webkit-scrollbar{display:none}.chisel-folder{border:0;margin-bottom:16px;padding-bottom:0}.chisel-folder-root{border-bottom:none;margin-bottom:0;padding-bottom:0}.chisel-panel-header{border:0;margin-bottom:16px;padding-bottom:0}.chisel-folder-header{user-select:none}.chisel-folder-header-top{display:flex;align-items:center;justify-content:space-between;height:var(--chisel-row-height);padding:0}.chisel-folder-title-row{display:flex;align-items:center;gap:6px;min-width:0;flex:1;overflow:hidden;white-space:nowrap}.chisel-folder-title{color:var(--chisel-text-section);font-size:13px;font-weight:600;letter-spacing:-.01em;transform:translateY(-.5px)}.chisel-folder-title-root{color:var(--chisel-text-root);font-size:15px;font-weight:600;transform:translateZ(0)}.chisel-folder-count{color:var(--chisel-text-tertiary);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:12px;font-weight:500}.chisel-folder-content{position:relative}.chisel-folder-inner,.chisel-content,.chisel-empty{display:flex;flex-direction:column;gap:6px;padding-bottom:10px}.chisel-folder:not(.chisel-folder-root){border:0;margin-top:16px;margin-bottom:0;padding-bottom:0}.chisel-folder:not(.chisel-folder-root)+.chisel-folder:not(.chisel-folder-root){margin-top:16px}.chisel-panel-toolbar{display:flex;align-items:center;gap:6px;height:var(--chisel-row-height);min-width:0;margin-bottom:6px;overflow:visible}.chisel-toolbar-add{width:var(--chisel-row-height);height:var(--chisel-row-height);flex-shrink:0;display:flex;align-items:center;justify-content:center;padding:0;border:none;border-radius:var(--chisel-radius);background:var(--chisel-surface);color:var(--chisel-text-label);font:inherit;font-size:16px;font-weight:500;cursor:pointer;transition:background var(--chisel-motion),color var(--chisel-motion),transform var(--chisel-motion)}.chisel-toolbar-add:hover,.chisel-preset-trigger:hover,.chisel-button:hover{background:var(--chisel-surface-hover);color:var(--chisel-text-primary)}.chisel-toolbar-add:active,.chisel-preset-trigger:active,.chisel-button:active{transform:scale(.96)}.chisel-preset-manager{position:relative;flex:1;min-width:0}.chisel-preset-trigger{width:100%;min-width:0;height:var(--chisel-row-height);display:flex;align-items:center;justify-content:space-between;padding:0 12px;border:none;border-radius:var(--chisel-radius);background:var(--chisel-surface);color:var(--chisel-text-label);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background var(--chisel-motion),color var(--chisel-motion),transform var(--chisel-motion);overflow:hidden}.chisel-preset-trigger[aria-expanded=true]{background:var(--chisel-surface-active)}.chisel-preset-trigger-label,.chisel-font-trigger-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chisel-chevron{width:16px;height:16px;flex-shrink:0;margin-left:8px;opacity:.72;transition:transform var(--chisel-motion),opacity var(--chisel-motion)}.chisel-preset-trigger[aria-expanded=true] .chisel-chevron,.chisel-font-trigger[aria-expanded=true] .chisel-chevron{opacity:1;transform:rotate(180deg)}.chisel-preset-dropdown{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:2147483647;padding:4px;border:0;border-radius:12px;background:var(--chisel-glass-bg);box-shadow:0 4px 16px #00000014;animation:chisel-pop-in var(--chisel-motion);transform-origin:top center}.chisel-preset-list{display:flex;flex-direction:column;gap:2px}.chisel-preset-item{width:100%;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 10px;border:none;border-radius:8px;background:transparent;color:var(--chisel-text-label);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background var(--chisel-motion),color var(--chisel-motion),transform var(--chisel-motion)}.chisel-preset-item:hover{background:var(--chisel-surface-hover)}.chisel-preset-item[data-active=true]{background:var(--chisel-surface-active);color:var(--chisel-text-primary)}.chisel-preset-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chisel-preset-count{color:var(--chisel-text-tertiary);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:11px}.chisel-text-control,.chisel-color-control,.chisel-font-control{min-height:var(--chisel-row-height);display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 12px;border-radius:var(--chisel-radius);background:var(--chisel-surface)}.chisel-text-label,.chisel-color-label,.chisel-font-label,.chisel-slider-label{color:var(--chisel-text-label);flex-shrink:0;font-size:13px;font-weight:500;line-height:17px;transform:translateY(-.5px)}.chisel-text-code,.chisel-text-value,.chisel-selector,.chisel-warning,.chisel-color-value-input,.chisel-slider-value-input{min-width:0;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--chisel-text-label);font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:13px;font-weight:500;text-align:right}.chisel-context-row{background:transparent;padding-inline:0}.chisel-selector-row{min-height:var(--chisel-row-height)}.chisel-selector{max-width:168px;line-height:1.25}.chisel-warning{color:var(--chisel-warning-color);font-family:inherit}.chisel-textarea-control{height:auto;align-items:flex-start;padding-top:10px;padding-bottom:10px}.chisel-text-input{min-width:0;width:100%;flex:1;resize:vertical;border:none;outline:none;background:transparent;color:var(--chisel-text-label);text-align:right;font:inherit;font-size:13px;font-weight:500;line-height:1.35}.chisel-text-input::selection,.chisel-color-value-input::selection,.chisel-slider-value-input::selection{background:color-mix(in srgb,var(--chisel-ui-focus) 22%,transparent);color:var(--chisel-text-focus)}.chisel-text-input:disabled{color:var(--chisel-text-tertiary);cursor:not-allowed}.chisel-note-row{min-height:var(--chisel-row-height);display:flex;align-items:center;padding:8px 0;border-radius:var(--chisel-radius);background:transparent;color:var(--chisel-text-tertiary);font-size:12px;font-weight:400;line-height:1.5}.chisel-toolbar-add,.chisel-actions .chisel-button{background:transparent}.chisel-actions .chisel-button-primary{background:var(--chisel-ui-action);color:var(--chisel-ui-action-text)}.chisel-actions .chisel-button-primary:hover{background:var(--chisel-ui-action);opacity:.9}.chisel-button:disabled{color:var(--chisel-text-tertiary);cursor:not-allowed;transform:none}.chisel-font-control{position:relative;overflow:visible;cursor:default}.chisel-font-picker{min-width:0;flex:0 1 150px}.chisel-font-trigger{width:100%;min-width:0;height:28px;display:flex;align-items:center;justify-content:flex-end;padding:0;border:none;border-radius:0;background:transparent;color:var(--chisel-text-label);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:color var(--chisel-motion)}.chisel-font-trigger:hover,.chisel-font-trigger[aria-expanded=true]{color:var(--chisel-text-primary)}.chisel-font-dropdown{left:0;right:0;width:100%;max-height:262px;overflow:hidden}.chisel-font-list{max-height:252px;overflow-y:auto;padding-right:1px;-ms-overflow-style:none;scrollbar-width:none}.chisel-font-list::-webkit-scrollbar{display:none}.chisel-font-item{justify-content:flex-start;text-align:left;font-size:14px}.chisel-color-control{position:relative;overflow:visible;flex-wrap:wrap}.chisel-color-control[data-picker-open=true]{z-index:25;padding-bottom:0}.chisel-color-inputs{display:inline-flex;align-items:center;gap:10px;min-width:0;flex:0 0 auto;justify-content:flex-end}.chisel-root .chisel-color-swatch{position:relative;width:24px;height:24px;min-width:24px;min-height:24px;flex-shrink:0;padding:0;border:0;border-radius:4.5px;box-shadow:inset 0 0 0 1px var(--chisel-border);cursor:pointer;transition:transform var(--chisel-motion),box-shadow var(--chisel-motion)}.chisel-color-swatch:after{content:"";position:absolute;inset:-8px;border-radius:inherit}@media(pointer:coarse){.chisel-color-swatch:after{inset:-10px}}.chisel-color-control:hover .chisel-color-swatch{box-shadow:0 0 0 2px var(--chisel-surface-hover)}.chisel-color-swatch:active{transform:scale(.96)}.chisel-color-value-input{width:7.5ch;max-width:150px;padding:0;border:0;outline:none;background:transparent;font-variant-numeric:tabular-nums;text-align:right}.chisel-color-value-input[data-invalid=true]{color:var(--chisel-danger-color)}.chisel-color-popover{flex:0 0 calc(100% + 24px);width:calc(100% + 24px);display:flex;flex-direction:column;gap:8px;margin:4px -12px 0;padding:8px 12px 0;border-top:1px solid var(--chisel-surface-subtle);animation:chisel-pop-in var(--chisel-motion)}.chisel-color-tabs{min-height:40px;height:32px;display:flex;align-items:flex-start;gap:14px;border-bottom:1px solid var(--chisel-surface-subtle)}.chisel-color-tab,.chisel-color-close,.chisel-color-saved-row button{border:none;background:transparent;color:var(--chisel-text-label);font:inherit;font-size:13px;font-weight:600;cursor:pointer}.chisel-color-tab{height:32px;padding:0;border-bottom:2px solid transparent}.chisel-color-tab[data-active=true]{color:var(--chisel-text-primary);border-bottom-color:var(--chisel-text-primary)}.chisel-color-tab[aria-disabled=true]{color:var(--chisel-text-tertiary);cursor:default}.chisel-color-close{margin-left:auto;font-size:18px;line-height:1;color:var(--chisel-text-tertiary)}.chisel-color-close:hover,.chisel-color-saved-row button:hover{color:var(--chisel-text-primary)}.chisel-color-field{position:relative;height:132px;overflow:hidden;border-radius:9px;cursor:crosshair;touch-action:none;background-image:linear-gradient(90deg,#fff,#fff0),linear-gradient(0deg,#000,#0000)}.chisel-color-field-cursor{position:absolute;width:12px;height:12px;border:2px solid #fff;border-radius:999px;box-shadow:0 0 0 1px #00000059;transform:translate(-50%,-50%);pointer-events:none}.chisel-color-hue{position:relative;height:12px;border-radius:999px;background:linear-gradient(90deg,red,#ff0,#0f0,#0ff,#00f,#f0f,red);cursor:pointer;touch-action:none}.chisel-color-hue-cursor{position:absolute;top:50%;width:8px;height:16px;border:2px solid #fff;border-radius:999px;box-shadow:0 0 0 1px #00000047;transform:translate(-50%,-50%);pointer-events:none}.chisel-color-alpha{position:relative;height:12px;overflow:visible;border-radius:999px;background-color:#fff;background-image:linear-gradient(45deg,rgba(0,0,0,.12) 25%,transparent 25%),linear-gradient(-45deg,rgba(0,0,0,.12) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,rgba(0,0,0,.12) 75%),linear-gradient(-45deg,transparent 75%,rgba(0,0,0,.12) 75%);background-size:8px 8px;background-position:0 0,0 4px,4px -4px,-4px 0;cursor:pointer;touch-action:none}.chisel-color-alpha:after{content:"";position:absolute;inset:0;border-radius:inherit;background:linear-gradient(90deg,transparent,var(--chisel-alpha-color));pointer-events:none}.chisel-color-alpha-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:color-mix(in srgb,var(--chisel-alpha-color),transparent 18%);pointer-events:none}.chisel-color-alpha-cursor{position:absolute;top:50%;z-index:2;width:16px;height:16px;border:2px solid #fff;border-radius:999px;box-shadow:0 0 0 1px #00000038;transform:translate(-50%,-50%);pointer-events:none}.chisel-color-gradient-preview{height:28px;border:1px solid var(--chisel-border);border-radius:var(--chisel-radius);box-shadow:inset 0 0 0 1px #ffffff47}.chisel-color-stop-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.chisel-color-stop-button{min-width:0;height:32px;display:flex;align-items:center;justify-content:center;gap:7px;padding:0 9px;border:none;border-radius:var(--chisel-radius);background:var(--chisel-surface);color:var(--chisel-text-label);font:inherit;font-size:13px;font-weight:600;cursor:pointer;transition:background var(--chisel-motion),color var(--chisel-motion),transform var(--chisel-motion)}.chisel-color-stop-button:hover{background:var(--chisel-surface-hover);color:var(--chisel-text-primary)}.chisel-color-stop-button[data-active=true]{background:var(--chisel-surface-active);color:var(--chisel-text-primary)}.chisel-color-stop-swatch{width:10.5px;height:10.5px;flex-shrink:0;overflow:hidden;border:1px solid var(--chisel-border-hover);border-radius:3px;box-shadow:inset 0 0 0 1px #ffffff47}.chisel-color-format-row{display:grid;grid-template-columns:76px minmax(0,1fr);gap:6px}.chisel-color-format-select,.chisel-color-format-input{height:40px;min-width:0;border:none;border-radius:var(--chisel-radius);outline:none;background:var(--chisel-surface);color:var(--chisel-text-label);font:inherit;font-size:13px;font-weight:500}.chisel-color-format-select{padding:0 8px;cursor:pointer}.chisel-color-format-input{padding:0 9px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}.chisel-color-format-input[data-invalid=true]{color:var(--chisel-danger-color)}.chisel-color-extra-row,.chisel-color-upload-row{position:relative;min-height:32px;display:flex;align-items:center;justify-content:space-between;gap:8px;padding:0 9px;border-radius:var(--chisel-radius);background:var(--chisel-surface);color:var(--chisel-text-label);font-size:13px;font-weight:500}.chisel-color-extra-row span,.chisel-color-upload-row span:first-child{flex-shrink:0}.chisel-color-extra-row input{min-width:0;flex:1;border:none;outline:none;background:transparent;color:var(--chisel-text-label);font:inherit;text-align:right}.chisel-color-upload-row{cursor:pointer;transition:background var(--chisel-motion),color var(--chisel-motion),transform var(--chisel-motion)}.chisel-color-upload-row:hover{background:var(--chisel-surface-hover);color:var(--chisel-text-primary)}.chisel-color-upload-row input{position:absolute;inset:0;opacity:0;cursor:pointer}.chisel-color-upload-name{min-width:0;overflow:hidden;text-align:right;text-overflow:ellipsis;white-space:nowrap;color:var(--chisel-text-tertiary)}.chisel-slider{position:relative;height:var(--chisel-row-height);display:block;overflow:hidden;border-radius:var(--chisel-radius);background:var(--chisel-surface);cursor:pointer;user-select:none;touch-action:none}.chisel-slider[data-units-open=true]{z-index:20;overflow:visible}.chisel-slider input[type=range]{position:absolute;inset:0;z-index:3;width:100%;height:100%;opacity:0;pointer-events:none;cursor:pointer}.chisel-slider-label{position:absolute;top:50%;left:10px;pointer-events:none;transform:translateY(calc(-50% - .5px));z-index:2}.chisel-slider-value-input{position:absolute;inset:0;z-index:4;width:100%;max-width:none;height:100%;padding:0 10px 0 92px;border:1px solid transparent;border-radius:var(--chisel-radius);outline:none;background:transparent;font-variant-numeric:tabular-nums;cursor:pointer}.chisel-root .chisel-slider-value-input:focus{cursor:text}.chisel-slider-value-input[data-invalid=true]{border-color:#aa303061;background:#aa303014;color:var(--chisel-danger-color)}.chisel-slider-hashmarks{position:absolute;inset:0;pointer-events:none}.chisel-slider-hashmark{position:absolute;top:50%;width:1px;height:8px;border-radius:999px;background:transparent;transform:translate(-50%,-50%);transition:background .2s}.chisel-slider:hover .chisel-slider-hashmark{background:var(--chisel-surface-hover)}.chisel-slider-fill{position:absolute;top:0;bottom:0;left:0;background:var(--chisel-surface-active);pointer-events:none;transition:background .15s}.chisel-slider-handle{position:absolute;top:50%;z-index:2;width:3px;height:20px;border-radius:999px;background:var(--chisel-text-primary);pointer-events:none;opacity:0;transform:translateY(-50%) scaleX(var(--chisel-handle-scale, 1));transition:opacity .15s,transform .15s}.chisel-slider:hover .chisel-slider-handle{opacity:var(--chisel-handle-opacity, 1)}.chisel-unit-menu{position:absolute;top:calc(100% + 4px);right:6px;z-index:30;display:grid;grid-template-columns:repeat(4,minmax(40px,1fr));gap:2px;width:186px;padding:4px;border:1px solid var(--chisel-border);border-radius:10px;background:var(--chisel-glass-bg);box-shadow:0 6px 18px #0000001a;animation:chisel-pop-in var(--chisel-motion);cursor:default}.chisel-unit-option{min-width:0;height:26px;border:none;border-radius:7px;background:transparent;color:var(--chisel-text-label);font:inherit;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:11px;font-weight:600;cursor:pointer;transition:background var(--chisel-motion),color var(--chisel-motion),transform var(--chisel-motion)}.chisel-unit-option:hover{background:var(--chisel-surface-hover);color:var(--chisel-text-primary)}.chisel-unit-option[data-active=true]{background:var(--chisel-surface-active);color:var(--chisel-text-primary)}.chisel-actions{display:flex;flex-direction:column;gap:6px;padding-bottom:10px}.chisel-button{width:100%;min-height:var(--chisel-row-height);border:none;border-radius:var(--chisel-radius);background:var(--chisel-surface);color:var(--chisel-text-secondary);font:inherit;font-size:13px;font-weight:500;cursor:pointer;transition:background var(--chisel-motion),color var(--chisel-motion),transform var(--chisel-motion)}@keyframes chisel-pop-in{0%{opacity:0;transform:translateY(-3px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(prefers-reduced-motion:reduce){.chisel-root,.chisel-root *{animation-duration:.01ms!important;transition-duration:.01ms!important}}@media(max-width:760px){.chisel-root{--chisel-row-height: 44px}.chisel-panel{top:auto;left:max(10px,env(safe-area-inset-left));right:max(10px,env(safe-area-inset-right));bottom:max(10px,env(safe-area-inset-bottom));width:auto;max-height:58dvh;touch-action:pan-y}.chisel-panel-inner{width:100%;max-height:58dvh}.chisel-color-tab,.chisel-color-close,.chisel-color-stop-button,.chisel-color-format-select,.chisel-color-format-input,.chisel-color-extra-row,.chisel-color-upload-row,.chisel-unit-option{min-width:44px;min-height:44px}.chisel-color-tabs{min-height:40px;height:44px}.chisel-color-hue,.chisel-color-alpha{height:44px}.chisel-unit-menu{grid-template-columns:repeat(4,minmax(44px,1fr));width:206px}}@media(forced-colors:active){.chisel-panel-inner,.chisel-preset-dropdown,.chisel-color-popover{forced-color-adjust:auto;border:1px solid CanvasText;background:Canvas}.chisel-box{border-color:Highlight}}
3
3
  `})}function Wt(e,a){if(a.has(e))return;let t=getComputedStyle(e),o={};for(let r of Sa)o[r]=t[r];a.set(e,{text:e.textContent??"",styles:o})}function pa(e){return{id:`version-${e}`,name:`Version ${e}`,elements:{}}}function Xt(e){return Object.fromEntries(Object.entries(e).map(([a,t])=>[a,{...t,styles:{...t.styles}}]))}function Kt(){return{pathname:window.location.pathname,search:window.location.search}}function $t(e){Zt(),ea+=1;let a=()=>{ot(),e()};return window.addEventListener(La,a),window.addEventListener("popstate",a),()=>{window.removeEventListener(La,a),window.removeEventListener("popstate",a),ea-=1,ea<=0&&(ea=0,la?.(),la=void 0)}}function Zt(){if(la)return;let e=window.history.pushState,a=window.history.replaceState,t=()=>{ot(),window.setTimeout(()=>window.dispatchEvent(new Event(La)),0)},o=function(...i){let c=e.apply(this,i);return t(),c},r=function(...i){let c=a.apply(this,i);return t(),c};window.history.pushState=o,window.history.replaceState=r,la=()=>{window.history.pushState===o&&(window.history.pushState=e),window.history.replaceState===r&&(window.history.replaceState=a)}}function ot(){let e=++Wa;Ke=!0,window.setTimeout(()=>{Wa===e&&(Ke=!1)},0)}function jt(e=rt(window.location.pathname,window.location.search)){return`vse:versions:${e}`}function Jt(e,a){return`vse:versions:${e}${a}`}function rt(e,a){let t=new URLSearchParams(a);t.delete("editor");let o=Array.from(t.entries()).sort(([n,i],[c,f])=>n===c?i.localeCompare(f):n.localeCompare(c)),r=new URLSearchParams(o).toString();return r?`${e}?${r}`:e}function Qt(e,a=e){try{let t=window.localStorage.getItem(e),o=t??(a===e?null:window.localStorage.getItem(a)),r=Va(o);return r.envelope&&xa.set(e,r.envelope),t===null&&o!==null?{...r,migrated:!r.warning}:r}catch{return{envelope:xa.get(e),migrated:!1,warning:"Browser storage is unavailable. Edits will be kept for this session."}}}function $a(e,a,t){let o=ca(a,t);xa.set(e,o);try{window.localStorage.setItem(e,JSON.stringify(o));return}catch{return"Browser storage is unavailable or full. Edits will be kept for this session."}}function de(e){return De(e)??$e(e)}function be(e,a,t){let o=t.get(a);if(o?.element===e||o?.element.isConnected)return;let r={};for(let n of Sa)r[n]=e.style[n]??"";t.set(a,{element:e,selector:$e(e),sourceHint:De(e),text:e.textContent??"",styles:r})}function ce(e){let a=(We.get(e)??0)+1;We.set(e,a),window.setTimeout(()=>{We.get(e)===a&&We.delete(e)},0)}function aa(e,a,t,o,r=!0){if(r)for(let[n,i]of t){let c=i.element.isConnected?i.element:null;if(!c)continue;let f=a.map(S=>S.elements[n]).filter(Boolean);if(!f.length)continue;ce(c),f.some(S=>typeof S.text=="string")&&c.textContent!==i.text&&(c.textContent=i.text);let I=new Set(f.flatMap(S=>Object.keys(S.styles)));f.some(S=>S.asset)&&I.add("backgroundImage");for(let S of I){let v=i.styles[S]??"";c.style[S]!==v&&(c.style[S]=v)}}for(let[n,i]of Object.entries(e.elements)){let c=lt(i);if(c){be(c,n,t),ce(c),typeof i.text=="string"&&c.textContent!==i.text&&(c.textContent=i.text);for(let[f,I]of Object.entries(i.styles))c.style[f]!==I&&(c.style[f]=I);if(i.asset){let f=o.get(ke(e.id,n)),I=f?Fe(f):"";c.style.backgroundImage!==I&&(c.style.backgroundImage=I)}}}}function _t(e,a,t){let o=e.get(a);e.set(a,t),o&&o!==t&&!Array.from(e.values()).includes(o)&&URL.revokeObjectURL(o)}function ma(e,a){let t=e.get(a);e.delete(a),t&&!Array.from(e.values()).includes(t)&&URL.revokeObjectURL(t)}function ha(e){for(let a of new Set(e.values()))URL.revokeObjectURL(a);e.clear()}function ke(e,a){return`${e}:${a}`}function Za(e,a,t){for(let[o,r]of Object.entries(e.elements)){let n=a.get(o);if(!n)continue;let i=n.element.isConnected?n.element:null;if(i){ce(i),typeof r.text=="string"&&i.textContent===r.text&&(i.textContent=n.text);for(let[c,f]of Object.entries(r.styles)){if(c==="backgroundImage"&&r.asset)continue;let I=n.styles[c]??"";Yt(c,i.style[c],f)&&(i.style[c]=I)}if(r.asset){let c=t.get(ke(e.id,o));c&&i.style.backgroundImage===Fe(c)&&(i.style.backgroundImage=n.styles.backgroundImage??"")}}}}function Yt(e,a,t){if(a===t)return!0;let o=document.createElement("div").style;return o[e]=t,o[e]===a}function lt(e){let a=e.sourceHint?wa(e.sourceHint):void 0;return ja(a)??ja(e.selector)}function ja(e){if(e)try{let a=document.querySelector(e);return a instanceof HTMLElement?a:void 0}catch{return}}function Ja(e,a){return e.includes(a)?e.filter(t=>t!==a):[...e,a]}function eo(e,a){let t=getComputedStyle(e),o=[],r=e.textContent??"";r!==a.text&&o.push({property:"textContent",before:a.text,after:r});for(let n of Sa){let i=a.styles[n],f=(e.style[n]??"")||t[n];sa(i)!==sa(f)&&o.push({property:n,before:i,after:f})}return o}function ao(e){if(!e)return[];let a=[];e.text!==void 0&&a.push({property:"textContent",before:null,after:e.text});for(let[t,o]of Object.entries(e.styles))a.push({property:t,before:null,after:o??""});return e.asset&&a.push({property:"localAsset",before:null,after:e.asset.fileName}),a}function to({projectName:e,element:a,snapshot:t,rect:o,selector:r,sourceHint:n,changes:i}){let c={route:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight},element:{tagName:a.tagName.toLowerCase(),selector:r,ancestry:ut(a),boundingRect:o,textBefore:t.text,textAfter:a.textContent??"",sourceHint:n},changes:i},f=!n&&!r.includes("[data-chisel-id")&&!r.includes("#");return[`You are editing ${e}. Update the source files for this Next.js app to match the visual edit intent below.`,"","Do not ship a broad global CSS override. Find the component, JSX, CSS module, Tailwind classes, or style object that owns the selected element and make the smallest source-level change.",f?"Selector confidence is low. Use the route, visible text, DOM ancestry, and nearby structure to find the matching source component before editing.":"A source hint is available. Prefer it when locating the component.","","Edit intent:","```json",JSON.stringify(c,null,2),"```","","Acceptance criteria:","- The selected element visually matches the requested text/style changes on the same route.","- Existing responsive behavior is preserved.","- No editor-only attributes or temporary inline preview styles are added unless they already belong to the app source."].join(`
4
4
  `)}function oo({projectName:e,version:a,baselines:t}){let o=Object.entries(a.elements).sort(([r],[n])=>r.localeCompare(n)).map(([r,n])=>{let i=t.get(r),c=lt(n);return{selector:n.selector,sourceHint:n.sourceHint,tagName:c?.tagName.toLowerCase(),ancestry:c?ut(c):void 0,textBefore:i?.text,textAfter:n.text,asset:n.asset,styleChanges:Object.fromEntries(Object.entries(n.styles).map(([f,I])=>[f,{before:i?.styles[f]??null,after:I}]))}});return[`You are editing ${e}. Update the source files for this Next.js app to match all page-level visual edit intents below.`,"","Do not ship broad global CSS overrides. Find the owning components, JSX, CSS modules, Tailwind classes, or style objects and make the smallest source-level changes.","","Edit intent:","```json",JSON.stringify({route:window.location.href,viewport:{width:window.innerWidth,height:window.innerHeight},elements:o},null,2),"```","","Acceptance criteria:","- All changed elements visually match the requested page edits on the same route.","- Existing responsive behavior is preserved.","- No editor-only attributes or temporary inline preview styles are added unless they already belong to the app source."].join(`
@@ -1,13 +1,13 @@
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
1
+ "use client";import{useEffect as oe,useLayoutEffect as ft,useRef as q,useState as y}from"react";import{forwardRef as Gr,createElement as Vr}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 Wr,createElement as Vo}from"react";var ja=(...a)=>a.filter((t,r,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===r).join(" ").trim();var ra={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 to(a){return a!=null}function zo(a,t={}){let r=t.attributeNames??{},l=S=>r[S]??S,d=a.size??a.width??ra.width,c=a.size??a.height??ra.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?ja(...L):ja("lucide",...m,...L),M=t.absoluteStrokeWidth?Number(t.strokeWidth??ra["stroke-width"])*Number(a.size??a.width??ra.width)/Number(t.size??t.width??ra.width):t.strokeWidth??ra["stroke-width"];return["svg",{...Object.entries(ra).reduce((S,[O,B])=>(S[l(O)]=B,S),{}),..."color"in t&&t.color&&{[l("stroke")]:t.color},..."size"in t&&to(t.size)&&{[l("width")]:t.size,[l("height")]:t.size},..."width"in t&&to(t.width)&&{[l("width")]:t.width},..."height"in t&&to(t.height)&&{[l("height")]:t.height},[l("stroke-width")]:M,...v&&{[l("class")]:v},[l("viewBox")]:`0 0 ${d} ${c}`,...t.hasA11yProp===!1?{[l("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},a.node.map(S=>{let[O,B,J]=S,w=t.nonScalingStroke?{[l("vector-effect")]:"non-scaling-stroke",...B}:B;return J?[O,w,J]:[O,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 Or,useContext as zr,useMemo as Yl,createElement as Ql}from"react";var Nr=Or({});var Go=()=>zr(Nr);var Xo=Wr(({color:a,size:t,width:r,height:l,strokeWidth:d,absoluteStrokeWidth:c,nonScalingStroke:n,className:m="",children:L,iconNode:v=[],icon:M={node:v,aliases:[],size:24},...W},S)=>{let{size:O=24,strokeWidth:B=2,absoluteStrokeWidth:J=!1,nonScalingStroke:w=!1,color:C="currentColor",className:G=""}=Go()??{},Y=!!L||Wo(W),[te,h,b=[]]=No(M,{color:a??C,width:r??t??O,height:l??t??O,strokeWidth:d??B,absoluteStrokeWidth:c??J,nonScalingStroke:n??w,className:ja(G,m),hasA11yProp:Y,attributes:W});return Vo(te,{ref:S,...h},[...b.map(([V,fe])=>Vo(V,fe)),...Array.isArray(L)?L:[L]])});function g(a,t=[],r=[]){let l=typeof a=="string"?Ho(a,t,r):a,d=Gr(({className:c,...n},m)=>Vr(Xo,{ref:m,icon:l,className:c,...n}));return l.name&&(d.displayName=Oo(l.name)),d}var Xr={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]},_a=g(Xr);var $r={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]},Ja=g($r);var Kr={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]},ga=g(Kr);var Zr={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]},La=g(Zr);var jr={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]},la=g(jr);var _r={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"]},da=g(_r);var Jr={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]},Ya=g(Jr);var Yr={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"}]]},Ma=g(Yr);var Qr={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"}]]},Ba=g(Qr);var el={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"}]]},Qa=g(el);var al={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"}]]},et=g(al);var tl={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"}]]},Ia=g(tl);var ol={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]},sa=g(ol);var rl={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"}]]},at=g(rl);var ll={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"}]]},ba=g(ll);var dl={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"}]]},tt=g(dl);var sl={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"}]]},Ra=g(sl);var ul={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"}]]},Fa=g(ul);var il={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"}]]},ot=g(il);var nl={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]},rt=g(nl);var fl={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"}]]},Ca=g(fl);var cl={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"}]]},lt=g(cl);var pl={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"]},ua=g(pl);var ml={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"}]]},dt=g(ml);var hl={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"]},ia=g(hl);var xl={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]},Ta=g(xl);import{useEffect as Yo,useId as bl,useState as Ke}from"react";import{useEffect as gl,useRef as Ko,useState as qa}from"react";import{createPortal as Ll}from"react-dom";function $o(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 Mt({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 Bt(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 $o(l,d,c,n/255)}}return $o(0,0,0)}import{jsx as Pe,jsxs as st}from"react/jsx-runtime";function oo({label:a,value:t,onChange:r,disabled:l}){let d=Ko(null),c=Ko(null),[n,m]=qa(null),[L,v]=qa({h:0,s:0,v:0,a:1}),[M,W]=qa(""),[S,O]=qa(!1),[B,J]=qa(!1),[w,C]=qa(!1);function G(){m(null)}gl(()=>{if(!n)return;let h=U=>{!c.current?.contains(U.target)&&!d.current?.contains(U.target)&&G()},b=U=>{U.key==="Escape"&&(U.preventDefault(),U.stopPropagation(),G(),d.current?.focus())},V=d.current?.getBoundingClientRect(),fe=U=>{if(c.current?.contains(U.target))return;let ge=d.current?.getBoundingClientRect();(ge?.top!==V?.top||ge?.left!==V?.left)&&G()};return document.addEventListener("pointerdown",h),document.addEventListener("keydown",b,!0),window.addEventListener("resize",G),document.addEventListener("scroll",fe,!0),c.current?.querySelector("input")?.focus({preventScroll:!0}),()=>{document.removeEventListener("pointerdown",h),document.removeEventListener("keydown",b,!0),window.removeEventListener("resize",G),document.removeEventListener("scroll",fe,!0)}},[n]);function Y(h){h.a===0&&(h={...h,a:1}),v(h);let b=Mt(h);W(b.slice(1).toUpperCase()),O(!1),r(b)}function te(h){let b=h.currentTarget.getBoundingClientRect();Y({...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 st("div",{className:"comment-box-color",children:[Pe("button",{ref:d,className:"comment-color-trigger",type:"button","aria-label":`${a} picker`,"aria-haspopup":"dialog","aria-expanded":!!n,disabled:l,onClick:()=>{if(n){G();return}let h=Bt(t);v(h),W(Mt(h).slice(1).toUpperCase()),O(!1),J("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:Pe("span",{style:{background:t}})}),Pe("span",{className:"comment-color-value",title:t,children:t}),n&&Ll(st("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:[st("div",{className:"chisel-color-plane",style:{backgroundColor:`hsl(${L.h} 100% 50%)`},onPointerDown:h=>{h.currentTarget.setPointerCapture(h.pointerId),te(h)},onPointerMove:h=>{h.currentTarget.hasPointerCapture(h.pointerId)&&te(h)},children:[Pe("span",{className:"chisel-color-thumb",style:{left:`${L.s*100}%`,top:`${(1-L.v)*100}%`,background:Mt({...L,a:1})}}),Pe("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} saturation`,min:0,max:100,value:Math.round(L.s*100),onChange:h=>Y({...L,s:Number(h.target.value)/100})}),Pe("input",{className:"chisel-color-accessible",type:"range","aria-label":`${a} brightness`,min:0,max:100,value:Math.round(L.v*100),onChange:h=>Y({...L,v:Number(h.target.value)/100})})]}),st("div",{className:"chisel-color-tools",children:[Pe("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=>Y({...L,h:Number(h.target.value)})}),Pe("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();c.current&&Y(Bt(b.sRGBHex))}catch{}finally{C(!1)}}},children:Pe(ot,{size:18})})]}),st("label",{className:"chisel-color-hex",children:["HEX",Pe("input",{"aria-label":`${a} hex`,value:M,maxLength:9,spellCheck:!1,"aria-invalid":S,onChange:h=>{let b=h.target.value.replace(/^#/,"");W(b);let V=/^(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(b);if(O(!V),V){let fe=Bt(`#${b}`);v(fe),r(`#${b}`)}}})]}),S&&Pe("span",{className:"chisel-color-error",role:"status",children:"Enter a valid hex color."})]}),document.body)]})}import{useRef as Il}from"react";import{jsx as Zo}from"react/jsx-runtime";function ut({onMoveStart:a}){let t=Il(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(),v=m.closest(".feedback-preview-scroll"),M=v?.getBoundingClientRect(),W=Math.max(L.left,M?.left??L.left),S=Math.min(L.right,M?M.left+v.clientWidth:L.right),O=Math.min(L.bottom,M?M.top+v.clientHeight:L.bottom),B=n.getBoundingClientRect();for(let[J,w]of[["x",Math.max(W+8-B.left,Math.min(d,S-8-B.right))],["y",Math.max(L.top+8-B.top,Math.min(c,O-8-B.bottom))]]){let C=`--comment-drag-${J}`;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 c=l.shiftKey?40:10;r(l.currentTarget,d[0]*c,d[1]*c)},children:Zo(et,{size:16,"aria-hidden":"true"})})}function jo(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 _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 Rt(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&&_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),c&&!a.children.length&&(a.textContent=d))}}import{Fragment as wl,jsx as E,jsxs as ne}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"]],Cl=["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 kl(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=>Cl.map(l=>[`${r}-${l}`,t.getPropertyValue(`${r}-${l}`)]))])}function ro({target:a,text:t,onText:r,onCancel:l,onPost:d,style:c,changes:n=[],editing:m=!1,commentId:L,renderComposer:v,hasExistingAttachments:M=!1,onDraftChange:W,hidden:S=!1,draftKey:O,onDiscard:B}){let[J]=Ke(()=>Jo(a?kl(a):{},n)),w=J.initial,[C,G]=Ke(J.values),[Y]=Ke(()=>({style:a?.getAttribute("style")??null,text:a?.textContent??null})),[te,h]=Ke({}),[b,V]=Ke(!1),[fe]=Ke(t),[I,U]=Ke(!1),[ge,Le]=Ke(""),[ce,fa]=Ke(!1),ca=bl();function Sa(){a&&(Y.style===null?a.removeAttribute("style"):a.setAttribute("style",Y.style),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(Y.text??"")))}async function ya(K=!0){K&&B&&!await B()||(Sa(),l())}Yo(()=>(a&&Rt(a,n),Sa),[a,Y]);function je(K,ke){if(!a)return;if(K==="text"){G(D=>({...D,text:ke})),a.children.length||a.replaceChildren(a.ownerDocument.createTextNode(ke));return}let Z=Qo.flatMap(D=>D.pairs).find(D=>D.includes(K)&&te[D.join(":")]),Ee=Z?jo(K,ke,Z,w):{[K]:ke};G(D=>({...D,...Ee}));for(let[D,F]of Object.entries(Ee))CSS.supports(D,F)&&a.style.setProperty(D,F,"important")}let Ha=Object.entries(C).some(([K,ke])=>ke!==w[K]),_e=!!(t.trim()||Ha||I||m&&t!==fe);Yo(()=>(W?.(_e),()=>W?.(!1)),[_e,W]);async function _(K=t,ke,Z,Ee){if(b||!K.trim()&&!Z?.length&&!M)return!1;let D=Object.entries(C).filter(([F,z])=>z!==w[F]).map(([F,z])=>({property:F,before:w[F],after:z}));if(D.some(F=>F.property!=="text"&&!CSS.supports(F.property,F.after)))return Le("Check the style values before posting."),!1;V(!0),Le("");try{let F=await d(D,K.trimEnd(),ke,Z,Ee);return F?await ya(!1):Le("Could not post. Your changes are still here; please try again."),F}catch{return Le("Could not post. Please try again."),!1}finally{V(!1)}}let Ea=(K,ke=!1,Z=!1,Ee)=>ne(wl,{children:[ne("div",{className:"comment-box-prompt",children:[a&&E("button",{type:"button",className:"comment-box-symbol","aria-label":"Comment settings",title:"Comment settings","aria-expanded":ce,"aria-controls":ca,disabled:b,onClick:()=>fa(D=>!D),children:E(Ca,{})}),K]}),a&&ne("div",{className:"comment-box-settings",id:ca,hidden:!ce,children:[ne("div",{className:"comment-box-element",children:[ne("code",{children:["<",a.tagName.toLowerCase(),">"]}),Ha&&E("span",{className:"comment-box-preview-status",role:"status",children:"Unsaved preview"}),E(ut,{})]}),ne("fieldset",{className:"comment-box-properties",disabled:b||!ce,children:[ne("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:D=>je("text",D.target.value)})]}),["Typography","Appearance"].map(D=>ne("div",{className:"comment-box-control-group",children:[E("h3",{children:D}),er.filter(([,F])=>D==="Typography"===["color","font-family","font-size","font-weight"].includes(F)).map(([F,z,Oe])=>ne("div",{className:"comment-box-row",children:[E("span",{children:F}),Oe==="color"?ce&&E(oo,{label:F,value:C[z],disabled:b,onChange:H=>je(z,H)}):Oe==="font"?E("select",{"aria-label":F,value:C[z],onChange:H=>je(z,H.target.value),children:Array.from(new Set([w[z],"Arial, sans-serif","Georgia, serif","system-ui","monospace"])).map(H=>E("option",{value:H,children:H},H))}):Oe==="weight"?E("select",{"aria-label":F,value:C[z],onChange:H=>je(z,H.target.value),children:Array.from(new Set([w[z],...[100,200,300,400,500,600,700,800,900].map(String)])).map(H=>E("option",{children:H},H))}):ne("div",{className:"comment-box-number",children:[E("input",{type:"number","aria-label":F,value:Number.isFinite(parseFloat(C[z]))?parseFloat(C[z]):"",min:0,max:z==="opacity"?1:void 0,step:"any",onChange:H=>je(z,H.target.value+(z==="opacity"?"":"px"))}),z!=="opacity"&&E("span",{children:"px"})]})]},z))]},D)),Qo.map(D=>ne("details",{className:"comment-box-group",open:!0,children:[ne("summary",{children:[D.label,E(la,{size:12,"aria-hidden":"true"})]}),D.pairs.map(F=>{let z=F.join(":"),Oe=D.label==="Size"?"Lock aspect ratio":`Link ${D.label.toLowerCase()} ${F[0].split("-")[1]} and ${F[1].split("-")[1]}`;return ne("div",{className:"comment-box-pair",children:[E("button",{className:"comment-box-link",type:"button","aria-label":Oe,title:Oe,"aria-pressed":!!te[z],onClick:()=>h(H=>({...H,[z]:!H[z]})),children:E(Ia,{size:12})}),F.map(H=>{let Je=H.includes("-")?H.split("-")[1]:H;return ne("label",{className:"comment-box-row",children:[E("span",{children:Je[0].toUpperCase()+Je.slice(1)}),ne("span",{className:"comment-box-number",children:[E("input",{type:"number",step:"any",min:H.startsWith("margin-")?void 0:0,"aria-label":H.replace("-"," ").replace(/^width$/,"Width").replace(/^height$/,"Height"),value:Number.isFinite(parseFloat(C[H]))?parseFloat(C[H]):"",onChange:Oa=>je(H,`${Oa.target.value}px`)}),E("span",{children:"px"})]})]},H)})]},z)})]},D.label))]})]}),ge&&E("p",{className:"comment-box-error",role:"alert",children:ge}),ne("footer",{className:"comment-box-footer",children:[E("button",{type:"button",className:"comment-box-cancel",onClick:()=>{ya()},disabled:b,children:"Cancel"}),E("span",{}),Ee,E("button",{type:"submit",className:"comment-box-submit","aria-label":m?"Save comment":"Post comment",title:m?"Save comment":"Post comment",disabled:b||Z||!t.trim()&&!ke&&!M,children:b?E("span",{className:"comment-box-saving"}):E(ga,{})})]})]}),ct=`comment-box${v?" comment-box-native":""}`,pt=K=>{K.key==="Escape"&&!b&&(K.preventDefault(),K.stopPropagation(),ya())};return v?E("div",{className:ct,hidden:S,"data-settings-open":ce,style:c,onKeyDown:pt,children:v({draftKey:O,text:t,onText:r,disabled:b,commentId:L,onAttachmentDraftChange:U,onSubmit:_,renderContent:Ea})}):E("form",{className:ct,hidden:S,"data-settings-open":ce,style:c,"aria-label":m?"Edit comment":"New comment",onKeyDown:pt,onSubmit:K=>{K.preventDefault(),_()},children:Ea(E("input",{"aria-label":"Comment",placeholder:"Leave a comment\u2026",value:t,onChange:K=>r(K.target.value),autoFocus:!0,maxLength:4e3,required:!0,disabled:b}))})}import{useEffect as Sl,useLayoutEffect as yl,useRef as Tt,useState as qt}from"react";function ka(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 Ft(a){return a.split(/[?#]/,1)[0]}function lo(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,c=!0,n=()=>{let v=lo(a);c&&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(),()=>{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 vl,jsx as De,jsxs as na}from"react/jsx-runtime";function so({path:a,routes:t,disabled:r,onNavigate:l,onOpen:d,counts:c}){let n=Tt(null),m=Tt(null),L=Tt(null),v=Tt(!1),[M,W]=qt(!1),[S,O]=qt(""),[B,J]=qt(!1),[w,C]=qt(""),G=Ft(a),Y=[...new Set([a,...t].map(Ft))],te=S.trim();if(/^https?:\/\//i.test(te))try{let I=new URL(te);I.origin===window.location.origin&&(te=I.pathname)}catch{}else te=Ft(te);let h=te.toLocaleLowerCase(),b=Y.filter(I=>I.toLocaleLowerCase().includes(h));function V(I=!1){n.current&&(n.current.open=!1),W(!1),I&&m.current?.focus({preventScroll:!0})}yl(()=>{if(!M)return;let I=()=>{let U=n.current,ge=U?.closest(".feedback-sidebar-panel");U&&ge&&U.style.setProperty("--feedback-page-space",`${Math.max(0,U.getBoundingClientRect().top-ge.getBoundingClientRect().top-12)}px`)};return I(),L.current?.focus(),L.current?.select(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I)},[M]),Sl(()=>{if(!M)return;let I=Le=>{!v.current&&!n.current?.contains(Le.target)&&V()},U=Le=>{Le.key!=="Escape"||v.current||(Le.preventDefault(),Le.stopPropagation(),V(!0))},ge=()=>{v.current||V()};return document.addEventListener("pointerdown",I),document.addEventListener("keydown",U,!0),window.addEventListener("blur",ge),()=>{document.removeEventListener("pointerdown",I),document.removeEventListener("keydown",U,!0),window.removeEventListener("blur",ge)}},[M]);async function fe(I){if(!(r||v.current)){v.current=!0,J(!0),C("");try{await l(I)&&V(!0)}catch(U){C(U instanceof Error&&U.message?U.message:"This page could not be opened. Try again.")}finally{v.current=!1,J(!1)}}}return na("details",{ref:n,className:"feedback-page-control",onToggle:I=>W(I.currentTarget.open),children:[na("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?V():(O(""),C(""),d?.(),n.current.open=!0,W(!0)))},children:[De(Qa,{"aria-hidden":"true"}),De("span",{title:a,children:a}),De(La,{className:"feedback-page-chevron","aria-hidden":"true"})]}),na("div",{className:"feedback-page-popover",children:[na("form",{className:"feedback-page-form",onSubmit:I=>{I.preventDefault(),fe(S)},children:[De("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=>{O(I.target.value),C("")}}),De("button",{type:"submit","aria-label":"Go to page",title:"Go to page","aria-busy":B,disabled:r||B||!S.trim(),children:De(_a,{"aria-hidden":"true"})})]}),w&&De("p",{className:"feedback-page-error",role:"alert",children:w}),na("nav",{className:"feedback-page-routes","aria-label":"Known pages",children:[b.map(I=>na("button",{type:"button",title:I,"aria-current":I===G?"page":void 0,disabled:r||B,onClick:()=>{I===G?V(!0):fe(I)},children:[De("span",{children:h?na(vl,{children:[I.slice(0,I.toLocaleLowerCase().indexOf(h)),De("mark",{children:I.slice(I.toLocaleLowerCase().indexOf(h),I.toLocaleLowerCase().indexOf(h)+te.length)}),I.slice(I.toLocaleLowerCase().indexOf(h)+te.length)]}):I}),c?.[I]&&na("small",{"aria-hidden":"true",children:[c[I].open," open",c[I].unread?` \xB7 ${c[I].unread} unread`:""]}),I===G&&De(ga,{"aria-hidden":"true"})]},I)),!b.length&&De("p",{className:"feedback-page-empty",children:"No matching pages"})]})]})]})}import{useEffect as or,useRef as uo,useState as Pl}from"react";import{jsx as it,jsxs as tr}from"react/jsx-runtime";function Dl({request:a,finish:t,returnFocus:r}){let l=uo(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:[it("h2",{id:"feedback-confirmation-title",children:a.title}),it("p",{id:"feedback-confirmation-description",children:a.description}),tr("div",{children:[it("button",{type:"button",autoFocus:!0,onClick:()=>t(!1),children:"Cancel"}),it("button",{type:"button","data-danger":a.danger,onClick:()=>t(!0),children:a.action})]})]})}function rr(){let[a,t]=Pl(null),r=uo(null),l=uo(null);or(()=>()=>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&&it(Dl,{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 io(a){return a<768?"mobile":a<1024?"tablet":"desktop"}var dr={desktop:0,tablet:1,mobile:2};function nt(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,W=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,W)-8),maxHeight:W};let S=m(a.y+36+8,r.height-8),O=m(a.y+-4-8,r.height-8),B=r.height-S-8,J=O-8;return B>=J?{left:m(a.x+-4,M),top:S,maxHeight:B}:{left:m(a.x+-4,M),top:O-Math.min(t.height,J),maxHeight:J}}function no(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 Ut=new WeakMap;function Ht(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)"},O={opacity:1,transform:"translateY(0px)"},B=l?{opacity:d.opacity,transform:d.transform}:t?O:S;return r?.cancel(),a.animate([B,t?S:O],{duration:t?100:140,easing:"cubic-bezier(.4,0,.2,1)"})}let c=a.querySelector(".feedback-hover-preview"),n=Ut.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},v=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 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,Ut.set(a,n);let W=()=>{Ut.get(a)?.animation===M&&(n.content&&(n.content.style.width=n.contentWidth),Ut.delete(a))};return M.finished.then(()=>{t||W()},W),M}var ir=`:is(.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box,.chisel-project-directory) :focus{outline:none}.chisel-updates,.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-updates,.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-updates,.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-updates,.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 Ml}from"react/jsx-runtime";var Al=`.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}}.feedback-shell{--chisel-ui-scale:.935;--chisel-ui-hit:calc(40px / var(--chisel-ui-scale))}.feedback-sidebar,.feedback-toolbar{zoom:var(--chisel-ui-scale)}.feedback-composer,.comment-box,.feedback-pin{scale:var(--chisel-ui-scale);transform-origin:top left}.feedback-toolbar{--chisel-ui-control:var(--chisel-ui-hit)}.feedback-shell .feedback-sidebar :is(button,summary,input:not([type=checkbox])),.feedback-shell .feedback-toolbar button,.feedback-shell .feedback-toolbar .feedback-preview-width input,.feedback-shell :is(.feedback-composer,.comment-box) :is(button,select,[role=textbox]),.feedback-shell.chisel-review :is(.feedback-composer,.comment-box) :is(button,select,[role=textbox]){min-width:var(--chisel-ui-hit);min-height:var(--chisel-ui-hit)}.feedback-shell .feedback-thread-status{min-height:var(--chisel-ui-hit)}.feedback-shell .feedback-pin:after{content:"";position:absolute;inset:calc((40px - var(--chisel-ui-hit)) / 2);border-radius:inherit}@media(pointer:coarse){.feedback-shell{--chisel-ui-hit:calc(44px / var(--chisel-ui-scale))}}
4
+ `;function fo(){return Ml("style",{children:Al})}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 co(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: ${co(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 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=`
10
+ `)}function po(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 Ua(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,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 wa(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 Ze(a,t){return a.some(r=>r.id===t.id)?a.map(r=>r.id===t.id?t:r):[...a,t]}function Et(a,t){return a.filter(r=>r.id!==t)}function Ot(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(c=>c.name),...d.replies.map(c=>typeof c=="string"?c:`${c.author} ${c.text}`)].some(c=>c.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 Gt,jsx as s,jsxs as p}from"react/jsx-runtime";var zt="chisel-feedback-v1",Nt=process.env.NODE_ENV!=="production",Wt=[{key:"desktop",label:"Desktop",width:1440,shortcut:"D",Icon:tt},{key:"tablet",label:"Tablet",width:768,shortcut:"T",Icon:dt},{key:"mobile",label:"Mobile",width:390,shortcut:"M",Icon:lt}];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 mo(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?`${mo(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:c,collaboration:n,commentUI:m,projectId:L="local",manageReview:v,accountURL:M,agentURL:W,saveSnapshot:S,getAttachmentURL:O}){let{confirm:B,dialog:J}=rr(),w=q(null),[C,G]=y([]),[Y,te]=y(null),[h,b]=y(!1),[V,fe]=y(new Set),[I,U]=y(""),[ge,Le]=y([]),ce=q([]),fa=q(0),ca=q(null),Sa=q(null),ya=q(!1),[je,Ha]=y(!1),_e=`chisel:draft:${L}:${a.id}`,[_,Ea]=y("/"),[ct,pt]=y(["/"]),[K,ke]=y([]),[Z,Ee]=y(Nt?"edit":"comment"),[D,F]=y(1440),[z,Oe]=y(!1),[H,Je]=y(null),Oa=q(!1),[va,Ir]=y(3840),[Pa,ho]=y("desktop"),pa=`${_e}:${_}:${Pa}`,Vt=q(pa);Vt.current=pa;let za=q(Pa),Ye=q(null),pe=q(Z),ze=q(null),xo=q(null),Ae=q(null),Me=q(!1),Ne=q(null),Na=q(""),Qe=q(!1),re=q(!1),Ie=q(null),le=q(null),Xt=q(null),[Wa,$t]=y(null),[be,go]=y(!1),[we,Lo]=y(!1),ma=q(we);ma.current=we;let[Se,ha]=y(null),[We,Be]=y(null),mt=q(We);mt.current=We;let[X,Re]=y(null),ht=q(X),Ga=q(!1);ht.current=X;let[br,ye]=y(null),[Io,xt]=y(void 0),[N,Cr]=y(null),[kr,ea]=y(null),[Va,aa]=y(""),[ta,me]=y(""),[de,Ge]=y(null);oe(()=>{Ge(null),re.current=!1},[We]);let[Xa,wr]=y("open"),[gt,Sr]=y(""),[Lt,j]=y(""),[It,bt]=y(!!l),[Fe,Da]=y(!1),[he,Ct]=y(null),Ve=q(null),[Kt,bo]=y(null),[Co,yr]=y(""),[Zt,ko]=y(!1),[wo,kt]=y(""),ue=q(!1),Te=q(0),Xe=q(null),So=q(!1),jt=q(null),[$a,_t]=y({x:0,y:0});Na.current=ta,le.current||(le.current=sr(()=>{let e=document.activeElement,o=ze.current?.contains(e)&&e?.matches('input,textarea,[contenteditable="true"]');!Ne.current||Na.current.trim()||Qe.current||re.current||o||Do()}));let i=C.find(e=>e.id===We),qe=i?.resolved?"resolved":i?.status??"open",vr=qe==="ready"?"Ready":qe==="resolved"?"Resolved":"Open",yo=!l||d||i?.authorId===a.id,wt=(he?.type==="status"||he?.type==="resolve")&&he.id===i?.id,vo=he?.type==="create",xa=vo?null:X;oe(()=>{let e=o=>{(ue.current||fa.current||ht.current&&Ga.current||Na.current.trim()||Qe.current||re.current||ce.current.length)&&o.preventDefault()};return document.addEventListener("chisel:before-ui-update",e),()=>document.removeEventListener("chisel:before-ui-update",e)},[]);function Jt(e=mt.current){if(Ua(`${Vt.current}:anchor`,null),Ua(`${Vt.current}:body`,null),e){let o=`${_e}:reply:${e}`;Ua(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{}}}oe(()=>{if(!N||ht.current||pe.current!=="comment")return;let e=po(`${pa}:anchor`);e&&typeof e.text=="string"&&e.text.length<=4e3&&Number.isFinite(e.anchor?.x)&&Number.isFinite(e.anchor?.y)&&(aa(e.text),Re(e.anchor),Be(null),Xe.current=crypto.randomUUID(),U("Your unsent comment was restored."))},[pa,N,Z]),oe(()=>{X&&!Se&&!Ua(`${pa}:anchor`,Va.trim()?{anchor:X,text:Va}:null)&&Va.trim()&&U("Your comment is still here, but this browser could not autosave it.")},[X,Va,pa,Se]),oe(()=>{if(!X||Se||!S||!N||ca.current?.id===Xe.current)return;let e=N.defaultView;ca.current={id:Xe.current,context:{width:e.innerWidth,height:e.innerHeight,url:e.location.origin+e.location.pathname,capturedAt:new Date().toISOString(),...Y?.round?{deployment:Y.round.deployment}:{}},file:cr(N).catch(()=>null)}},[X,Se,S,N,Y?.round]),oe(()=>{try{Ha(localStorage.getItem(`chisel:guide:${a.id}`)!=="1")}catch{}},[a.id]),oe(()=>{if(!v)return;let e=!0;return v("get").then(o=>{e&&te(o)}).catch(()=>{}),()=>{e=!1}},[v,C]);async function Pr(e){let o=Y?.reviewURL??nr(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(co(o,e)),U("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 Dr(){let e=C.filter(o=>V.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:O?await O(f.id).catch(()=>{}):f.previewUrl})))})));await navigator.clipboard.writeText(fr(o,Y?.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),fe(new Set)}catch{j("Feedback could not be copied. Check clipboard permission and try again.")}}function Po(e){fe(o=>{let u=new Set(o);return u.has(e)?u.delete(e):u.add(e),u})}async function Ar(){if(!(!c||Zt)){ko(!0),kt("");try{let e=await c();yr(e);try{await navigator.clipboard.writeText(e),kt("Link copied. Anyone with the link can sign in and review this website.")}catch{kt("Select and copy the review link below.")}}catch(e){kt(e instanceof Error?e.message:"The review link could not be created. Please try again.")}finally{ko(!1)}}}async function Do(){if((Na.current.trim()||Qe.current||re.current)&&!await ie()||(le.current?.cancel(),Ne.current=null,Me.current))return;Me.current=!0;let e=ze.current?Ht(ze.current,!0,Ae.current):null;Ae.current=e;let o=()=>{if(!Me.current||Ae.current!==e)return;Me.current=!1,Ue(),Be(null),me("");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 Yt(){le.current?.cancel(),Me.current&&(Me.current=!1,Ae.current=ze.current?Ht(ze.current,!1,Ae.current):null)}function St(){Ae.current?.cancel(),Ae.current=null,Me.current=!1,go(!0)}async function Ao(e){if(!await ie()||ue.current)return;let o=null;try{o=e.selector?N?.querySelector(e.selector)??null:null}catch{}if(!o){j("This element is no longer on the page. Its changes cannot be edited.");return}Ue(),le.current?.cancel(),me(""),Ie.current=null,ha(e.id),aa(e.text),Re(e)}function Mo(e){le.current?.cancel(),!(xa||e.path!==_||(ta.trim()||Qe.current||re.current)&&We!==e.id)&&(i&&be||(Ne.current=e.id,Ka(e,!0)))}function Ue(){Xt.current?.(),Xt.current=null,$t(null)}async function ie(){return ue.current?!1:!(ht.current&&Ga.current)&&!Na.current.trim()&&!Qe.current&&!re.current?!0:await B({title:"Discard this draft?",description:"Your comment and unsaved preview changes will be discarded.",action:"Discard draft",danger:!0})?(Jt(),!0):!1}function yt(){let e=w.current?.closest(".feedback-preview-scroll");return Math.max(320,Math.min(3840,e?e.clientWidth-24:3840))}async function $e(e,o=!1){o&&(e=Math.max(320,Math.min(yt(),e)));let u=io(e),f=za.current;if(u!==f){if(!await ie())return!1;le.current?.cancel(),Ne.current=null,Ue(),Re(null),ha(null),Be(null),ye(null),ea(null),aa(""),me(""),Xe.current=null,Ie.current=null,Ga.current=!1,Qe.current=!1,w.current?.contentDocument&&delete w.current.contentDocument.documentElement.dataset.chiselSelection,za.current=u,ho(u)}if(o&&e>yt())return $e(e,!0);Oe(o),F(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 Mr(e){if(Oa.current)return;let o=Number(e);if(!e.trim()||!Number.isFinite(o)||Math.round(o)===D){Je(null);return}Oa.current=!0;try{await $e(Math.round(o),!0)}finally{Oa.current=!1,Je(null)}}function Br(e,o){if(!e.isPrimary||e.button!==0||ue.current||Ye.current)return;e.preventDefault(),e.currentTarget.focus({preventScroll:!0});let u=e.currentTarget.parentElement,f=u.offsetWidth,k=u.parentElement.clientWidth-24;Ye.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 Rr(e){let o=Ye.current;!o||o.id!==e.pointerId||(o.next=Math.max(320,Math.min(va,Math.round(o.width+(e.clientX-o.x)*o.direction*o.factor))),o.raf===null&&(o.raf=requestAnimationFrame(()=>{o.raf=null,F(o.next)})))}async function vt(e=!1){let o=Ye.current;o&&(Ye.current=null,o.raf!==null&&cancelAnimationFrame(o.raf),(e||!await $e(o.next,!0))&&F(o.width))}oe(()=>()=>{Ye.current?.raf!=null&&cancelAnimationFrame(Ye.current.raf)},[]),ft(()=>{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=Wt.find(Q=>Q.key===o.get("breakpoint")),A=f?u:k?.width??Math.min(1440,yt());F(A),Oe(!f&&!k);let T=io(A);ho(T),za.current=T;let $=()=>Ir(yt());$();let xe=new ResizeObserver($);return xe.observe(e),()=>xe.disconnect()},[]),oe(()=>{z&&D>va&&!Ye.current&&$e(va,!0)},[z,D,va]);async function Pt(e){if(e===pe.current||!await ie())return;le.current?.cancel(),Ne.current=null,Ue(),Ee(e),pe.current=e,Re(null),ha(null),ye(null),e==="comment"&&Lo(!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 Fr(){let e=w.current?.contentDocument;if(!e)return;let o=Array.from(e.querySelectorAll("a[href]:not([download])"),u=>ka(u.href,window.location.origin));ke([...new Set(o.filter(u=>u!==null))])}async function Tr(e){let o=ka(e,window.location.origin,_);if(!o)throw new Error("Enter a page path or URL from this site.");if(o===_)return!0;if(!await ie())return!1;let u=w.current?.contentWindow;return u?(le.current?.cancel(),Ne.current=null,Ue(),Re(null),ha(null),Be(null),ye(null),ea(null),aa(""),me(""),Xe.current=null,Ie.current=null,Ga.current=!1,Qe.current=!1,u.location.assign(o),!0):!1}function Ce(e){if(e.area){let f=no(e.area,N,$a);return{rect:void 0,x:f.left,y:f.top}}let o=null;try{o=e.selector?N?.querySelector(e.selector)??null:null}catch{}let u=o?.getBoundingClientRect();return{rect:u,x:u?u.left+u.width*(e.offsetX??0):e.x-$a.x,y:u?u.top+u.height*(e.offsetY??0):e.y-$a.y}}async function Ka(e,o=!1){let u=ka(e.path,window.location.origin);if(!u){j("This comment's page cannot be opened in the preview.");return}if(!o&&!await ie())return;let f=e.breakpoint??"desktop",k=f!==za.current&&nt(f,za.current);if(!o&&e.context&&!k&&await $e(e.context.width),!o){let $=new URL(window.location.href);$.searchParams.set("thread",e.id),window.history.replaceState(window.history.state,"",$)}if(Yt(),o||n?.markRead(e.id),o||(St(),Ne.current=null,me(po(`${_e}:reply:${e.id}`)?.text??"")),We===e.id&&_===e.path)return;go(!o),Ue(),Be(e.id),(!o||!vo)&&Re(null),ye(null),ea(e),o&&me(""),Ie.current=null;let A=w.current?.contentDocument;if(A?.documentElement&&e.selector&&(A.documentElement.dataset.chiselSelection=e.selector),_!==u){w.current?.contentWindow?.location.assign(u);return}let T=Ce(e);if(!o){let $=w.current?.closest(".feedback-preview-scroll");$?.scrollTo({left:Math.max(0,T.x+12-$.clientWidth/2)}),w.current?.contentWindow?.scrollTo({top:Math.max(0,T.y+$a.y-180),behavior:"smooth"})}}async function qr(e){if(ue.current&&Ve.current?.id!==e.id)return!1;let o=C.find(f=>f.id===e.id);if(!o)return!1;let u=o;if(Ve.current=e,G(f=>Ze(f,wa(f,e))),Ct(e),j(""),ue.current)return!0;ue.current=!0,Da(!0),++Te.current;try{for(;Ve.current;){let f=Ve.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):wa([u],f);++Te.current,l||localStorage.setItem(zt,JSON.stringify(Ze(C,k))),u=k,Ve.current===f&&(Ve.current=null);let A=Ve.current?wa([k],Ve.current):k;G(T=>Ze(T,A))}return!0}catch(f){let k=u;return G(A=>Ze(A,k)),j(f instanceof Error?f.message:"The status could not be saved. Please try again."),!1}finally{++Te.current,Ve.current=null,ue.current=!1,Da(!1),Ct(null)}}async function He(e,o=[]){if(e.type==="status"||e.type==="resolve")return qr(e);if(ue.current)return!1;ue.current=!0,Da(!0),Ct(e),++Te.current;let u=e.type==="create"?e.comment.id:e.id,f=C.find(A=>A.id===u),k=!1;try{let A=e.type==="create"?{...e.comment,body:e.body,attachments:o,pending:!0}:e.type==="reply"?wa(C,{...e,reply:{...e.reply,body:e.body,attachments:o,date:new Date().toISOString(),pending:!0}}):{...wa(C,e),...e.type==="edit"&&o.length?{attachments:[...f?.attachments??[],...o]}:{}};if(G($=>Ze($,A)),bt(!1),j(""),k=!0,!await t())throw new Error("Your session has expired. Reload this page to sign in again.");let T=l?await l.mutate(e):wa(C,e);if(++Te.current,l||localStorage.setItem(zt,JSON.stringify(Ze(C,T))),G($=>Ze($,T)),bt(!1),j(""),e.type==="create"){Jt(null);let $=ca.current;S&&$?.id===e.comment.id&&(fa.current++,$.file.then(async xe=>{if(!xe){U("Comment saved. This page could not be captured; you can attach an image manually.");return}try{await S(T.id,xe)}catch{ce.current=[...ce.current.filter(Q=>Q.id!==T.id),{id:T.id,file:xe}],Le(ce.current)}}).finally(()=>{fa.current--}))}return e.type==="reply"&&Ua(`${_e}:reply:${e.id}`,null),!0}catch(A){return k&&G(T=>f?Ze(T,f):Et(T,u)),e.type==="create"&&(Ne.current=null,Be(null)),j(A instanceof Error?A.message:"Your comment could not be saved. Your draft is still here; please try again."),!1}finally{ue.current=!1,Da(!1),Ct(null)}}async function Ur(e){if(!(ue.current||!await B({title:"Delete this comment?",description:"The comment and all its replies will be permanently deleted.",action:"Delete comment",danger:!0}))){ue.current=!0,Da(!0),bo(e.id),j(""),++Te.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(zt,JSON.stringify(Et(C,e.id)));++Te.current,mt.current===e.id&&(Ue(),Be(null),me(""),ea(null)),G(o=>Et(o,e.id)),j("")}catch{j("The comment could not be deleted. Please try again.")}finally{ue.current=!1,Da(!1),bo(null)}}}function Qt(){let e=w.current?.contentDocument,o=w.current?.contentWindow;if(!e?.documentElement||!o)return;let u=lo(o);if(u===null||e===jt.current)return;if(jt.current=null,!So.current){So.current=!0;let x=new URLSearchParams(window.location.search);if(Sa.current=x.get("thread"),!l)try{let se=JSON.parse(localStorage.getItem(zt)||"[]");if(!Array.isArray(se)||se.some(ee=>typeof ee.id!="string"||typeof ee.text!="string"||!Array.isArray(ee.replies)))throw Error();G(se)}catch{j("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"||Nt)&&(Ee(R),pe.current=R);let ae=new URLSearchParams(window.location.search).get("path");if(ae){let se=ka(ae,window.location.origin);if(!se)j("That preview page is invalid. Enter a URL from this site.");else if(se!==u){if(se.split("#")[0]!==u.split("#")[0]){jt.current=e,o.location.replace(se);return}o.location.replace(se),u=se}}}if(Ea(u),Cr(e),!o.chiselReady){e.addEventListener("chisel:ready",Qt,{once:!0});return}let f=e.documentElement;if(f.dataset.feedbackBound)return;f.dataset.feedbackBound="true";let k=e.createElement("style");k.textContent=`
11
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; }
@@ -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(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};
27
+ `,e.head.append(k),f.dataset.chiselMode=pe.current,f.dataset.chiselCommentsHidden=String(ma.current),o.dispatchEvent(new Event("chisel:mode")),o.addEventListener("chisel:selection",x=>{let P=x.detail;ea(P),P.selector&&(f.dataset.chiselSelection=P.selector)});let A=()=>_t({x:o.scrollX,y:o.scrollY});A(),o.addEventListener("scroll",A),o.addEventListener("resize",()=>{ye(null),A()}),e.addEventListener("scroll",()=>{ye(null),A()},!0);let T=null,$=null,xe=()=>{T!==null&&o.cancelAnimationFrame(T),T=null,$=null,ye(null)};e.addEventListener("mousemove",x=>{$=x.target,T===null&&(T=o.requestAnimationFrame(()=>{T=null;let P=pe.current==="comment"&&!ma.current&&$?.nodeType===1?$.getBoundingClientRect():null;ye(R=>R?.left===P?.left&&R?.top===P?.top&&R?.width===P?.width&&R?.height===P?.height?R:P)}))},!0),e.addEventListener("mouseleave",xe),o.addEventListener("pagehide",xe);let Q=null,Za=!1,At=null;e.addEventListener("keydown",x=>{if(x.key==="Escape"&&Q){At=Q.pointerId,Q=null,xt(void 0),x.preventDefault(),x.stopPropagation();return}x.key==="Escape"&&!ue.current&&(x.preventDefault(),ie().then(P=>{P&&(Re(null),Be(null),ye(null),ea(null),delete f.dataset.chiselSelection)}))}),e.addEventListener("dragstart",x=>{pe.current==="comment"&&!ma.current&&!x.target?.closest("[data-chisel-root]")&&x.preventDefault()},!0),e.addEventListener("pointerdown",x=>{let P=x.target;if(!(pe.current!=="comment"||ma.current||x.pointerType!=="mouse"||x.button!==0||!P||P.closest("[data-chisel-root]"))){Q={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,ae=x.clientY+o.scrollY;return{x:Math.min(P.x,R),y:Math.min(P.y,ae),width:Math.abs(R-P.x),height:Math.abs(ae-P.y)}}e.addEventListener("pointermove",x=>{!Q||x.pointerId!==Q.pointerId||!Q.moved&&Math.hypot(x.clientX-Q.clientX,x.clientY-Q.clientY)<6||(Q.moved=!0,x.preventDefault(),x.stopPropagation(),ye(null),xt(To(x,Q)))},!0),e.addEventListener("pointercancel",()=>{Q=null,At=null,xt(void 0)},!0),e.addEventListener("pointerup",async x=>{if(At===x.pointerId){At=null,Za=!0,setTimeout(()=>{Za=!1},0),x.preventDefault(),x.stopPropagation();return}let P=Q;if(Q=null,!P||x.pointerId!==P.pointerId||!P.moved)return;Za=!0,setTimeout(()=>{Za=!1},0),x.preventDefault(),x.stopPropagation();let R=To(x,P);if(xt(void 0),pe.current!=="comment"||ma.current||R.width<1||R.height<1||!await ie())return;let ae=P.target,se=e.elementFromPoint(x.clientX,x.clientY);for(;ae&&(!se||!ae.contains(se));)ae=ae.parentElement;let ee=ae?.getBoundingClientRect(),oa=R.x-o.scrollX,ao=R.y-o.scrollY,Hr=ae&&ae!==e.body&&ae!==f&&ee&&ee.width>0&&ee.height>0&&oa>=ee.left&&ao>=ee.top&&oa+R.width<=ee.right&&ao+R.height<=ee.bottom,Er={...R,...Hr&&ee?{selector:mo(ae),relative:{x:(oa-ee.left)/ee.width,y:(ao-ee.top)/ee.height,width:R.width/ee.width,height:R.height/ee.height}}:{}},qo={x:R.x,y:R.y,area:Er};Ue(),delete f.dataset.chiselSelection,Be(null),aa(""),ye(null),ea(qo),ha(null),Xe.current=crypto.randomUUID(),Re(qo)},!0),e.addEventListener("click",async x=>{if(Za){x.preventDefault(),x.stopImmediatePropagation();return}let P=x.target;if(!P||P.nodeType!==1||P.closest("[data-chisel-root]")||pe.current==="view"||pe.current==="comment"&&ma.current)return;let R=P.getBoundingClientRect(),ae=R.width?(x.clientX-R.left)/R.width:-1,se=R.height?(x.clientY-R.top)/R.height:-1,ee=P!==e.body&&P!==f&&ae>=0&&ae<=1&&se>=0&&se<=1,oa={x:x.clientX+o.scrollX,y:x.clientY+o.scrollY,...ee?{selector:mo(P),tag:P.tagName.toLowerCase(),offsetX:ae,offsetY:se}:{}};pe.current==="comment"&&(x.preventDefault(),x.stopImmediatePropagation(),!await ie())||(Ue(),ea(oa),oa.selector?f.dataset.chiselSelection=oa.selector:delete f.dataset.chiselSelection,pe.current!=="edit"&&(x.preventDefault(),x.stopImmediatePropagation(),Be(null),aa(""),ye(null),ha(null),Xe.current=crypto.randomUUID(),Re(oa)))},!0)}oe(()=>{let e=N?.defaultView;if(e)return ar(e,o=>{if(!ka(o,window.location.origin))return;Ea(o),pt(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)})},[N]),oe(()=>{N&&(N.documentElement.dataset.chiselCommentsHidden=String(we))},[we,N]),oe(()=>()=>le.current?.cancel(),[]),oe(()=>{if(!l)return;let e=!1,o=!1,u=!1,f,k=()=>{clearTimeout(f),f=setTimeout(()=>{f=void 0,A()},1e4)},A=async()=>{if(e||document.visibilityState==="hidden")return;if(ue.current){k();return}if(o){u=!0;return}o=!0,clearTimeout(f),f=void 0;let xe=++Te.current;try{let Q=await l.list();!e&&xe===Te.current&&(clearTimeout(f),f=void 0,G(Q),bt(!1),j(""))}catch{!e&&xe===Te.current&&(bt(!1),j("Shared comments could not be loaded. Check your connection; retrying automatically."),k())}finally{o=!1,u&&(u=!1,A())}};A();let T=l.subscribe?.(()=>{A()}),$=l.subscribe?void 0:window.setInterval(()=>{A()},1e4);return window.addEventListener("focus",A),document.addEventListener("visibilitychange",A),()=>{e=!0,clearTimeout(f),T?.(),window.clearInterval($),window.removeEventListener("focus",A),document.removeEventListener("visibilitychange",A)}},[l]);let Bo=n?.setPage;oe(()=>{Bo?.(_)},[_,Bo]),ft(()=>{let e=xo.current;e&&(e.style.height="auto",e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[ta,be,i?.id,we,Z,_]),ft(()=>{let e=w.current?.parentElement,o=e?.querySelector(".comment-box");if(!X||!e||!o||we)return;let u=()=>{let k=hr(e),A=Ce(X),T=ur({x:A.x-k.left,y:A.y},{width:o.offsetWidth,height:o.offsetHeight},k);o.style.left=`${T.left+k.left}px`,o.style.top=`${T.top}px`,o.style.maxHeight=`${T.maxHeight}px`};u();let f=new ResizeObserver(u);return f.observe(o),f.observe(e),()=>f.disconnect()}),ft(()=>{let e=ze.current;if(!e||we||Ae.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,A=Number(e.dataset.pinX),T=Number(e.dataset.pinY),$=be?Math.max(8,Math.min(T-40,f-Math.min(340,f-16)-8)):Math.max(8,Math.min(T+32-e.offsetHeight,f-e.offsetHeight-8)),xe=be?A+44:A;e.style.left=`${Math.max(u.left+8,Math.min(xe,u.left+k-e.offsetWidth-8))}px`,e.style.top=`${$}px`,e.style.maxHeight=`${f-$-8}px`}),ft(()=>(Me.current=!1,Ae.current=ze.current&&!we?Ht(ze.current):null,()=>{Me.current=!1,Ae.current?.cancel()}),[i?.id,!!X,Z,we,_]),oe(()=>{w.current?.contentDocument?.readyState==="complete"&&Qt()},[]),oe(()=>{if(ya.current||!Sa.current||It||!N)return;let e=C.find(o=>o.id===Sa.current);if(!(!e&&Lt)){if(ya.current=!0,!e){j("This comment was deleted or is unavailable to your account.");return}(async()=>{let o=e.context?.width??Wt.find(u=>u.key===(e.breakpoint??"desktop")).width;await $e(o)&&await Ka(e)})()}},[C,It,N,Lt]),oe(()=>{let e=o=>{if(document.querySelector('dialog[open], [aria-modal="true"]'))return;let u=lr(o);if(!u||u===pe.current||u==="edit"&&!Nt)return;o.preventDefault(),o.stopPropagation();let f=Wt.find(k=>k.key===u);if(f){$e(f.width);return}if(u==="toggle-comments"){le.current?.cancel(),Ue(),Lo(k=>!k);return}(u==="edit"||u==="comment"||u==="view")&&Pt(u)};return document.addEventListener("keydown",e,!0),N?.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0),N?.removeEventListener("keydown",e,!0)}},[N]),oe(()=>{if(!i||Wa!==i.id||X||Z==="edit"||i.path!==_||!i.selector||!N)return;let e;try{e=N.querySelector(i.selector)}catch{e=null}if(!e){$t(null),j("This element is no longer on the page. Its saved changes cannot be previewed.");return}let o=Rt(e,i.changes??[]);return Xt.current=o,_t({x:e.ownerDocument.defaultView.scrollX,y:e.ownerDocument.defaultView.scrollY}),o},[Wa,i,X,Z,_,N]);let Dt=C.filter(e=>e.id!==Kt&&nt(e.breakpoint,Pa)),Ro=pr(Dt,Xa,gt),Aa=new Set(n?.unreadThreadIds),eo=Dt.filter(e=>Aa.has(e.id)).length,ve={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"])nt(e.breakpoint,u)&&(e.resolved||ve[u].open++,Aa.has(e.id)&&ve[u].unread++);if(!nt(e.breakpoint,Pa))continue;let o=Fo[e.path.split(/[?#]/)[0]]??={open:0,unread:0};e.resolved||o.open++,Aa.has(e.id)&&o.unread++}return p("main",{"aria-label":"Chisel workspace",className:`feedback-shell ${m?.className??""} ${Z==="edit"?"is-editing":""} ${we?"comments-hidden":""}`,children:[s(fo,{}),J,p("div",{className:"feedback-workspace",children:[p("section",{className:"feedback-canvas","aria-label":"Website preview",children:[s("div",{className:"feedback-preview-scroll",onScroll:()=>_t({x:w.current?.contentWindow?.scrollX??0,y:w.current?.contentWindow?.scrollY??0}),children:p("div",{className:"feedback-preview-frame",style:{width:D},children:[p("div",{className:"feedback-viewport",children:[s("iframe",{ref:w,src:"/",title:"Website for feedback",onLoad:Qt}),p("div",{className:"feedback-comment-layer","data-hover-preview":!!(i&&!be&&!xa),hidden:we,children:[(Io||xa?.area||!xa&&i?.area)&&(()=>{let e=no(Io||xa?.area||i?.area,N,$a);return s("div",{className:"feedback-comment-area","data-testid":"comment-area",style:{left:e.left,top:e.top,width:e.width,height:e.height}})})(),X&&he?.type!=="create"&&s("span",{className:"feedback-pin comment-box-draft-pin","aria-hidden":"true",style:{left:Ce(X).x,top:Ce(X).y}}),i&&!xa&&Z!=="edit"&&i.path===_&&p("section",{ref:ze,hidden:Kt===i.id,"data-pin-x":Ce(i).x,"data-pin-y":Ce(i).y,"data-pin-width":40+(Math.min(Ot(i).length,4)-1)*20,"data-expanded":be,onPointerEnter:()=>{Me.current||le.current?.cancel()},onPointerMove:Yt,onPointerLeave:()=>le.current?.schedule(),onFocus:Yt,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||le.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&&p("button",{type:"button",className:"feedback-hover-preview","aria-label":`Expand comment: ${i.text||i.attachments?.map(e=>e.name).join(", ")}`,onClick:()=>{Ka(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()}),p("span",{className:"feedback-hover-copy",children:[p("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(", ")})]})]}),p("div",{className:"feedback-thread-content",hidden:!be,children:[p("header",{className:"feedback-thread-header",children:[s(ut,{onMoveStart:()=>{Ne.current=null,le.current?.cancel(),St()}}),p("label",{className:"feedback-thread-status","data-state":qe,title:wt?"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:[p("span",{className:"feedback-status-value","aria-hidden":"true",children:[wt?s(sa,{className:"chisel-spin"}):qe==="resolved"?s(da,{}):qe==="ready"?s(Ba,{}):s(Ya,{}),s("span",{children:vr}),yo&&s(La,{})]}),p("select",{"aria-label":"Comment status","aria-busy":wt,disabled:Fe&&!wt||!yo,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"})]})]}),p("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:()=>{Pr(i)},children:s(Ia,{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:Fe,onClick:()=>{Ur(i)},children:s(ia,{size:16})}),s("button",{className:"feedback-thread-close",type:"button",title:"Close thread","aria-label":"Close thread",onClick:Do,children:s(Ta,{size:18})})]})]}),p("div",{className:"feedback-thread-summary",children:[!m&&de&&de.id===i.id&&he?.type!=="edit"?p("form",{onSubmit:async e=>{e.preventDefault(),await He({type:"edit",id:i.id,text:de.text.trimEnd(),changes:i.changes??[]})&&(re.current=!1,Ge(null))},children:[s("textarea",{"aria-label":"Edit comment",value:de.text,onChange:e=>{re.current=e.target.value!==de.original,Ge({...de,text:e.target.value})}}),s("button",{type:"button",onClick:async()=>{re.current&&!await ie()||(re.current=!1,Ge(null))},children:"Cancel"}),i.selector&&s("button",{type:"button",onClick:()=>{Ao(i)},children:"Edit styles"}),s("button",{type:"submit",disabled:Fe||!de.text.trim()&&!i.attachments?.length,children:"Save"})]}):!m&&p("button",{type:"button",className:"feedback-thread-summary-button","aria-label":`Expand comment: ${i.text}`,"aria-expanded":be,onClick:St,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()}),p("span",{className:"feedback-thread-summary-copy",children:[p("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&&de?.id!==i.id&&s("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:Fe,onClick:async()=>{await ie()&&(me(""),re.current=!1,Ge({id:i.id,text:i.text,original:i.text}))},children:s(Fa,{size:16})})]}),!!i.changes?.length&&s("div",{className:"feedback-proposal-actions",children:p("button",{type:"button",className:"feedback-preview","aria-pressed":Wa===i.id,disabled:!i.selector,onClick:()=>{j(""),$t(Wa===i.id?null:i.id)},children:[s(Ba,{size:16}),Wa===i.id?"Exit preview":"Preview changes"]})}),(be||m)&&s(Gt,{children:m?m.renderThread({draftKey:`${_e}:reply:${i.id}`,comment:i,expanded:be,reply:ta,saving:Fe,submittingReply:he?.type==="reply"&&he.id===i.id,userId:a.id,onEditDraftChange:e=>{re.current=e},onDiscardEdit:ie,onBeginEdit:async()=>await ie()?(me(""),Ie.current=null,!0):!1,onEditStyles:i.selector?()=>{Ao(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=>{Qe.current=e},onReplyText:e=>{me(e),Ie.current=null},onReply:async(e,o,u,f)=>{if(!e.trim()&&!u?.length)return!1;let k=await He({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&&(me(""),Ie.current=null),k},onResolve:()=>{He({type:"resolve",id:i.id,resolved:!i.resolved})},onExpand:St}):p(Gt,{children:[s("div",{className:"feedback-thread-replies",children:i.replies.map((e,o)=>p("div",{className:"feedback-thread-reply",children:[s("span",{className:"feedback-avatar","aria-hidden":"true",children:(typeof e=="string"?"?":e.author.slice(0,1)).toUpperCase()}),p("div",{children:[typeof e!="string"&&s("strong",{children:e.author}),typeof e!="string"&&de&&de.id===e.id&&he?.type!=="edit_reply"?p("form",{onSubmit:async u=>{u.preventDefault(),await He({type:"edit_reply",id:i.id,replyId:de.id,text:de.text.trimEnd()})&&(re.current=!1,Ge(null))},children:[s("textarea",{"aria-label":"Edit comment",value:de.text,onChange:u=>{re.current=u.target.value!==de.original,Ge({...de,text:u.target.value})}}),s("button",{type:"button",onClick:async()=>{re.current&&!await ie()||(re.current=!1,Ge(null))},children:"Cancel"}),s("button",{type:"submit",disabled:Fe||!de.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&&de?.id!==e.id&&s("button",{className:"feedback-message-edit",type:"button",title:"Edit comment","aria-label":"Edit comment",disabled:Fe,onClick:async()=>{await ie()&&(me(""),re.current=!1,Ge({id:e.id,text:e.text,original:e.text}))},children:s(Fa,{size:16})})]},o))}),p("form",{hidden:he?.type==="reply"&&he.id===i.id,onSubmit:async e=>{e.preventDefault(),ta.trim()&&await He({type:"reply",id:i.id,reply:{id:Ie.current??(Ie.current=crypto.randomUUID()),text:ta.trimEnd(),author:a.name,authorId:a.id,authorImage:a.image}})&&(me(""),Ie.current=null)},children:[s("textarea",{ref:xo,"aria-label":"Reply",rows:1,placeholder:"Write a reply\u2026",value:ta,maxLength:4e3,onChange:e=>{me(e.target.value),Ie.current=null},disabled:Fe,required:!0}),s("div",{className:"feedback-thread-actions",children:p("button",{type:"submit",className:"feedback-primary",disabled:Fe||!ta.trim(),"aria-label":"Reply",children:["Reply ",s(Ja,{})]})})]})]})})]})]},i.id),Z==="comment"&&[br,Ce(xa??i??kr??{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)),Z!=="edit"&&Dt.filter(e=>e.path===_&&!e.resolved).map(e=>{let o=Ot(e);return p("button",{"aria-label":`Open comment: ${e.text}`,title:o.map(u=>u.author).join(", "),className:`feedback-pin ${o.length>1?"feedback-pin-group":""} ${We===e.id?"selected":""}`,onPointerEnter:u=>{u.pointerType!=="touch"&&Mo(e)},onPointerLeave:()=>le.current?.schedule(),style:{left:Ce(e).x,top:Ce(e).y},onClick:()=>Ka(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&&p("span",{className:"feedback-avatar feedback-pin-more","aria-hidden":"true",children:["+",o.length-3]})]},e.id)}),X&&N&&s(ro,{target:X.selector?N.querySelector(X.selector):null,text:Va,onText:aa,onDraftChange:e=>{Ga.current=e},draftKey:`${pa}:body`,onDiscard:ie,hidden:he?.type==="create"||he?.type==="edit"&&he.id===Se,editing:!!Se,commentId:Se??void 0,renderComposer:m?.renderComposer,changes:C.find(e=>e.id===Se)?.changes,hasExistingAttachments:!!C.find(e=>e.id===Se)?.attachments?.length,onCancel:()=>{Jt(Se?mt.current:null),Re(null),aa(""),ha(null)},onPost:(e,o,u,f,k)=>He(Se?{type:"edit",id:Se,text:o,changes:e,body:u,attachmentTokens:f}:{type:"create",body:u,attachmentTokens:f,comment:{id:Xe.current??(Xe.current=crypto.randomUUID()),path:_,...X,breakpoint:Pa,context:ca.current?.context??{width:w.current?.contentWindow?.innerWidth??D,height:w.current?.contentWindow?.innerHeight??900,url:window.location.origin+_,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).x+44,top:Ce(X).y}},`${X.selector}:${X.x}:${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":va,"aria-valuenow":D,tabIndex:0,title:"Drag to resize \xB7 Arrow keys to adjust",onPointerDown:o=>Br(o,e),onPointerMove:Rr,onPointerUp:()=>{vt()},onPointerCancel:()=>{vt(!0)},onLostPointerCapture:()=>{vt(!0)},onKeyDown:o=>{if(o.key==="Escape"){o.preventDefault(),vt(!0);return}o.key!=="ArrowLeft"&&o.key!=="ArrowRight"||(o.preventDefault(),o.stopPropagation(),$e(D+(o.key==="ArrowRight"?1:-1)*e*(o.shiftKey?50:10),!0))}},e))]})}),p("div",{className:"feedback-toolbar",role:"group","aria-label":"Preview mode",children:[Nt&&p("button",{title:"Edit styles","aria-keyshortcuts":"E","aria-pressed":Z==="edit",onClick:()=>Pt("edit"),children:[s(Ca,{}),s("span",{children:"Edit"})]}),p("button",{title:"Add comments","aria-keyshortcuts":"C","aria-pressed":Z==="comment",onClick:()=>Pt("comment"),children:[s(ba,{}),s("span",{children:"Comment"})]}),p("button",{title:"View website","aria-keyshortcuts":"V","aria-pressed":Z==="view",onClick:()=>Pt("view"),children:[s(Ra,{}),s("span",{children:"View"})]})]}),p("div",{className:"feedback-toolbar feedback-breakpoints",role:"group","aria-label":"Preview breakpoint",children:[p("label",{className:"feedback-preview-width",children:[s("input",{"aria-label":"Preview width",title:`Preview width \xB7 320\u2013${va}px`,inputMode:"numeric",value:H??String(D),onFocus:e=>{Je(e.currentTarget.value),e.currentTarget.select()},onChange:e=>Je(e.target.value),onBlur:e=>{H!==null&&Mr(e.currentTarget.value)},onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),e.currentTarget.blur()),e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),Je(null))}}),s("span",{"aria-hidden":"true",children:"px"})]}),Wt.map(({key:e,label:o,width:u,shortcut:f,Icon:k})=>p("button",{type:"button","aria-label":o,title:`${o} \xB7 ${u}px \xB7 ${f} \xB7 ${ve[e].open} open, ${ve[e].unread} unread`,"aria-keyshortcuts":f,"aria-description":`${ve[e].open} open comments, ${ve[e].unread} unread comments`,"aria-pressed":Pa===e,onClick:()=>{$e(u)},children:[s(k,{"aria-hidden":"true"}),(ve[e].open>0||ve[e].unread>0)&&p("sup",{"aria-hidden":"true",children:[ve[e].open,ve[e].unread>0&&`\xB7${ve[e].unread}`]})]},e))]})]}),s("aside",{className:"feedback-sidebar",hidden:Z==="edit"||we,children:p("div",{className:"feedback-sidebar-panel",children:[p("div",{className:"feedback-sidebar-title",children:[p("h1",{children:["Comments ",s("span",{children:Dt.length})]}),p("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()})}),p("div",{children:[s("strong",{children:a.name}),s("span",{children:a.email}),W&&s("a",{href:W,target:"_blank",rel:"noopener noreferrer",children:"Connect your agent"}),M&&s("a",{href:M,children:"My projects"}),p("button",{onClick:async()=>{try{await r(),window.location.reload()}catch{j("Sign out failed. Please try again.")}},children:[s(at,{}),"Sign out"]})]})]})]}),p("label",{className:"feedback-search",children:[s(rt,{"aria-hidden":"true",size:18}),s("input",{type:"search","aria-label":"Search comments",placeholder:"Search",value:gt,onChange:e=>Sr(e.target.value)})]}),n&&(n.status!=="connected"||n.participants.length>0||eo>0)&&p("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))}),eo>0&&p("span",{className:"feedback-unread-count",children:[eo," unread"]})]}),s("div",{className:"feedback-tabs",role:"group","aria-label":"Filter comments",children:["open","resolved","all"].map(e=>s("button",{"aria-pressed":Xa===e,onClick:()=>wr(e),children:e[0].toUpperCase()+e.slice(1)},e))}),je&&p("section",{className:"feedback-guide","aria-label":"Quick start",children:[s("strong",{children:"Leave feedback"}),p("ul",{children:[p("li",{children:[s(ba,{"aria-hidden":"true"}),"Click to comment"]}),p("li",{children:[s(ua,{"aria-hidden":"true"}),"Drag to mark an area"]}),p("li",{children:[s(Ra,{"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{}Ha(!1)},children:"Got it"})]}),I&&p("p",{className:"feedback-notice",role:"status",children:[I,s("button",{type:"button","aria-label":"Dismiss message",onClick:()=>U(""),children:s(Ta,{size:14})})]}),ge.map(e=>p("p",{className:"feedback-notice",children:["Comment saved; its snapshot could not be attached. ",s("button",{type:"button",onClick:async()=>{fa.current++;try{await S?.(e.id,e.file),ce.current=ce.current.filter(o=>o.id!==e.id),Le(ce.current)}catch{U("Snapshot still unavailable. Your comment is saved.")}finally{fa.current--}},children:"Retry snapshot"})]},e.id)),Lt&&s("p",{role:"alert",className:"feedback-error",children:Lt}),p("div",{className:"feedback-comment-list",children:[Ro.map(e=>p("article",{onPointerEnter:o=>{!h&&o.pointerType!=="touch"&&Mo(e)},onPointerLeave:()=>le.current?.schedule(),className:`feedback-comment ${(h?V.has(e.id):We===e.id)?"active":""}`,children:[d&&h&&s("label",{className:"feedback-comment-select",children:s("input",{type:"checkbox","aria-label":`Select comment: ${e.text}`,checked:V.has(e.id),onChange:()=>Po(e.id)})}),p("button",{className:"feedback-comment-main","aria-pressed":h?V.has(e.id):We===e.id,onClick:()=>h?Po(e.id):Ka(e),children:[p("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()}),p("span",{className:"feedback-comment-identity",children:[p("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"})})]}),p("span",{className:"feedback-comment-status",children:[(Xa==="all"||e.status==="ready")&&p(Gt,{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})]})]}),Aa.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||Aa.has(e.id))&&p("span",{className:"feedback-comment-activity",children:[e.replies.length>0&&p(Gt,{children:[s("span",{className:"feedback-comment-avatars",children:Ot(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))}),p("span",{className:"feedback-comment-reply-count",children:[e.replies.length," ",e.replies.length===1?"reply":"replies"]})]}),Aa.has(e.id)&&s("span",{className:"feedback-unread-label",children:e.replies.length?"New replies":"Unread"})]})]})]},e.id)),It&&s("p",{role:"status",children:"Loading shared comments\u2026"}),!It&&!Ro.length&&p("div",{className:"feedback-empty",children:[s("span",{children:s(ba,{size:30})}),s("h2",{children:gt.trim()?"No matching comments":Xa==="resolved"?"Nothing resolved yet":"No comments yet"}),s("p",{children:gt.trim()?"Try another name, phrase, or page.":Xa==="resolved"?"Resolved threads will appear here.":"Click anywhere on the page to leave your first comment."})]})]}),s(so,{path:_,counts:Fo,disabled:Fe||!N,onNavigate:Tr,onOpen:Fr,routes:[...new Set([_,...ct,...K,...C.map(e=>e.path)])].filter(e=>N&&ka(e,window.location.origin)).sort((e,o)=>e.localeCompare(o))}),d&&C.length>0&&p("details",{className:"feedback-export",open:h,children:[p("summary",{onClick:e=>{e.preventDefault(),b(!h),fe(new Set)},children:[s(Ma,{size:16}),"Export feedback for agents",s(la,{size:14})]}),p("div",{children:[s("span",{children:V.size?`${V.size} selected`:"Select comments above"}),p("button",{type:"button",disabled:!V.size,onClick:()=>{Dr()},children:[s(Ma,{size:14}),"Copy feedback"]})]})]}),c&&d&&p("details",{className:"feedback-review-invite",children:[p("summary",{children:[s(la,{"aria-hidden":"true"}),"Share review link"]}),p("form",{onSubmit:e=>{e.preventDefault(),Ar()},children:[s("p",{children:"Anyone with this link can sign in and review this website."}),s("button",{type:"submit",className:"feedback-primary",disabled:Zt,children:Zt?"Preparing link\u2026":"Copy review link"}),Co&&s("input",{"aria-label":"Review link",value:Co,readOnly:!0,onFocus:e=>e.currentTarget.select()}),wo&&s("p",{role:"status",children:wo})]})]})]})})]})]})}import{useEffect as Lr,useSyncExternalStore as Bl}from"react";import{Chisel as Rl}from"use-chisel";import{jsx as Ul}from"react/jsx-runtime";function Fl(a){return window.addEventListener("chisel:mode",a),()=>window.removeEventListener("chisel:mode",a)}function Tl(){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 ql({projectName:a="Chisel"}){let t=Bl(Fl,Tl,()=>"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:Ul(Rl,{embedded:!0,enabled:t==="edit",projectName:a})}export{ql as ChiselPreview,gr as ChiselWorkspace,fo 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.11",
3
+ "version": "0.1.13",
4
4
  "description": "Hosted website reviews and visual editing for Next.js.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -77,7 +77,8 @@
77
77
  "html-to-image": "^1.11.13",
78
78
  "slate": "^0.110.2",
79
79
  "slate-history": "^0.110.3",
80
- "slate-react": "^0.110.3"
80
+ "slate-react": "^0.110.3",
81
+ "sonner": "^2.0.8"
81
82
  },
82
83
  "devDependencies": {
83
84
  "@types/react": "^18.3.3",