use-chisel 0.1.7 → 0.1.9
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 +3 -2
- package/dist/hosted-entry.js +4 -133
- package/dist/index.js +5 -168
- package/dist/review-content-entry.js +2 -2
- package/dist/review-entry.js +3 -3
- package/dist/workspace/comments.d.ts +14 -0
- package/dist/workspace-entry.d.ts +1 -1
- package/dist/workspace-entry.js +8 -345
- package/package.json +4 -4
- package/dist/persistence.d.ts +0 -30
- package/dist/review/media-lightbox.d.ts +0 -8
- package/dist/theme.d.ts +0 -1
- package/dist/workspace/color-picker.d.ts +0 -6
- package/dist/workspace/color.d.ts +0 -9
- package/dist/workspace/comment-drag-handle.d.ts +0 -3
- package/dist/workspace/composer-position.d.ts +0 -13
- package/dist/workspace/confirmation.d.ts +0 -11
- package/dist/workspace/hover-dismiss.d.ts +0 -4
- package/dist/workspace/mode-shortcuts.d.ts +0 -1
- package/dist/workspace/page-control.d.ts +0 -7
- package/dist/workspace/preview-navigation.d.ts +0 -4
- package/dist/workspace/thread-morph.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -1,171 +1,8 @@
|
|
|
1
|
-
"use client";import
|
|
2
|
-
:is(.chisel-root,.feedback-shell,.chisel-sign-in,.chisel-color-picker,.comment-box) :focus{outline:none}
|
|
3
|
-
.
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.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:120ms cubic-bezier(.2,0,0,1);--chisel-ui-popover-shadow:0 2px 6px #0000000f,0 12px 36px #0000001f;}
|
|
8
|
-
@media(prefers-color-scheme:dark){.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;}}
|
|
9
|
-
`;function ca(e,a){return{schemaVersion:1,activeVersionId:e.some(o=>o.id===a)?a:e[0]?.id??a,versions:e}}function Xa(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(Ka);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 Mt(a)?{envelope:a,migrated:!1}:{migrated:!1,warning:"Saved edits use an unsupported or malformed format. Edits will be kept for this session."}}function Mt(e){return!ve(e)||e.schemaVersion!==1||typeof e.activeVersionId!="string"||!Array.isArray(e.versions)||!e.versions.every(Ka)?!1:e.versions.length===0||e.versions.some(a=>a.id===e.activeVersionId)}function Ka(e){return!ve(e)||typeof e.id!="string"||typeof e.name!="string"||!ve(e.elements)?!1:Object.values(e.elements).every(Dt)}function Dt(e){return!(!ve(e)||typeof e.selector!="string"||!ve(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 ve(e)&&typeof e.fileName=="string"&&typeof e.mimeType=="string"&&typeof e.size=="number"&&Number.isFinite(e.size)&&e.size>=0}function ve(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}var qt=["px","rem","em"],Ut=[{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"],Ht=["Solid","Gradient","Image"],Et=[{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,$a=0,xa=new Map,Xe=new WeakMap;function Sr({id:e,as:a,children:t,...o}){return u(a??"span",{"data-chisel-id":e,...o,children:t})}function wr({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,g]=p.useState(null),[S,A]=p.useState([]),[M,F]=p.useState(null),[k,P]=p.useState([]),[T,q]=p.useState(!1),[H,ae]=p.useState(""),[v,U]=p.useState(()=>[pa(1)]),[B,W]=p.useState("version-1"),[G,K]=p.useState(!1),[te,E]=p.useState(""),[fe,oe]=p.useState(""),[re,le]=p.useState(!1),[$,ee]=p.useState([]),[m,I]=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),Ie=p.useRef(null),ye=p.useRef(null),Ue=p.useRef(!1),ge=p.useRef(null),s=p.useRef(null),L=p.useRef(null),b=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?ut(r.pathname,r.search):"";if(p.useEffect(()=>()=>ha(N.current),[]),p.useEffect(()=>{let l=()=>n(Kt());return l(),$t(l)},[]),p.useEffect(()=>{if(Q){Ue.current=!0;return}if(!Ue.current||(Ue.current=!1,o))return;let l=v.find(d=>d.id===B)??v[0];l&&Qa(l,O.current,N.current),ha(N.current),V.current=null,ne.current=null,X.current=[],c(null),g(null),A([]),F(null),P([]),q(!1)},[B,Q,o,v]),p.useEffect(()=>{if(!Q||!o)return;let l=()=>{let d=document.documentElement?.dataset.chiselSelection,x=d?document.querySelector(d):null;x instanceof HTMLElement&&!Be(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=()=>{ge.current===null&&(ge.current=window.requestAnimationFrame(()=>{ge.current=null;let x=V.current,h=X.current;F(C=>x?ie(x.getBoundingClientRect()):C),P(h.map(C=>ie(C.getBoundingClientRect())))}))},d=x=>{let h=x.target;h instanceof HTMLElement&&Be(h)||x.key==="Escape"&&(ne.current=null,X.current=[],g(null),A([]),P([]))};return document.addEventListener("keydown",d),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),()=>{ge.current!==null&&window.cancelAnimationFrame(ge.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),g(null),A([]),F(null),P([]);let d=v.find(_=>_.id===B)??v[0];d&&Qa(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);b.current=!h.warning,E(h.warning??"");let C=h.envelope?.versions.length?h.envelope.versions:[pa(1)],y=h.envelope?.activeVersionId??C[0].id;U(C),W(y),oe(l);let R=C.find(_=>_.id===y)??C[0],z=window.setTimeout(()=>aa(R,C,O.current,N.current),0);if(h.migrated&&h.envelope){let _=Ja(l,C,y);_&&E(_)}return Ke=!1,()=>window.clearTimeout(z)},[ya,Q]),p.useEffect(()=>{if(!Q||!b.current||!xe.current||fe!==xe.current)return;let l=Ja(xe.current,v,B);l&&E(l)},[B,Q,fe,v]),p.useEffect(()=>{if(!Q||typeof MutationObserver>"u"||!document.body)return;let l=null,d=()=>{l=null;let h=v.find(y=>y.id===B)??v[0];h&&aa(h,v,O.current,N.current,!1),V.current&&!V.current.isConnected&&(V.current=null,c(null),F(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,A(C),g(y),P(C.map(R=>ie(R.getBoundingClientRect())))}},x=new MutationObserver(h=>{if(Ke)return;let C=h.some(R=>{let z=R.target instanceof HTMLElement?R.target:R.target.parentElement;return z&&Xe.has(z)?!1:z&&!Be(z)?!0:Array.from(R.addedNodes).some(_=>{let Ba=_ instanceof HTMLElement?_:_.parentElement;return!!(Ba&&!Be(Ba))})}),y=h.some(R=>Array.from(R.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)}},[B,Q,v]),p.useEffect(()=>{if(!re)return;let l=h=>{let C=Y(h,0,Math.max(0,$.length-1)),y=$[C];I(C),y&&(V.current=y,c(y),F(ie(y.getBoundingClientRect())),j(at(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 R=$.find(z=>z.parentElement===C);R&&(y=$.indexOf(R))}else if(h.key==="ArrowLeft"&&C){let R=C.parentElement;for(;R&&!$.includes(R);)R=R.parentElement;R&&(y=$.indexOf(R))}else if(h.key==="Enter"&&C){Ye(h.shiftKey?Ya(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(()=>{H&&(me.current?.focus(),me.current?.select())},[H]),p.useEffect(()=>{if(!G)return;let l=h=>{K(!1),h&&window.requestAnimationFrame(()=>ye.current?.focus())},d=h=>{h.target instanceof Node&&Ie.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&&tt(f)),He=f?De(f):void 0,Pa=f?$e(f):"",ue=v.find(l=>l.id===B)??v[0]??pa(1),_e=he>1?S.flatMap(l=>ao(ue.elements[de(l)])):f&&Oe?eo(f,Oe):[],Ce=f?getComputedStyle(f):null,Ee=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,A(l),g(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())))},Aa=(l,d)=>{let x=document.elementsFromPoint(l,d).find(h=>h instanceof HTMLElement&&!Be(h));return x instanceof HTMLElement?lo(x):null},mt=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=Aa(d.x,d.y);if(!x){V.current=null,c(null),F(null);return}x!==V.current&&(V.current=x,c(x),F(ie(x.getBoundingClientRect())))}))},ht=l=>{l.preventDefault(),l.stopPropagation();let d=Aa(l.clientX,l.clientY);d&&(le(!1),Ye(l.shiftKey?Ya(X.current,d):[d]))},Lt=()=>{let l=so();Qe.current=X.current,ee(l),I(0),le(!0);let d=l[0];d?(V.current=d,c(d),F(ie(d.getBoundingClientRect())),j(at(d))):j("No visible elements available")},xt=()=>{let l={id:`version-${Date.now()}`,name:`Version ${v.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(be(ue.id,d));h&&N.current.set(be(l.id,d),h)}aa(l,[...v,l],O.current,N.current),Se()},It=l=>{W(l.id),K(!1),aa(l,v,O.current,N.current),Se(),window.requestAnimationFrame(()=>ye.current?.focus())},gt=(l,d)=>{let x=l.unit==="px"?`${d}px`:String(d);va(l,x)},va=(l,d)=>{let x=Ne();if(x.length){for(let h of x)ke(h,de(h),O.current),ce(h),h.style[l.property]=d,we(h,{styles:{[l.property]:d}});Se()}},Fa=(l,d,x)=>{let h=Ne();if(h.length){for(let C of h){let y=de(C);if(ke(C,de(C),O.current),ce(C),l==="backgroundColor"&&ho(d)){if(C.style.backgroundImage=d,d.startsWith("url(")){let R=ga(d),z=be(B,y);x&&R?_t(N.current,z,R):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,be(B,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()}},Ct=l=>{let d=Ne();if(d.length){for(let x of d)ke(x,de(x),O.current),ce(x),x.style.fontFamily=l,we(x,{styles:{fontFamily:l}});Se()}},St=l=>{let d=Ne();if(d.length)for(let x of d)ke(x,de(x),O.current),ce(x),x.style.fontFamily=l},wt=l=>{!f||!fa||(ke(f,de(f),O.current),ce(f),f.textContent=l,we(f,{text:l}),Se())},kt=()=>{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 R of Object.keys(y.styles))d.style[R]=C?.styles[R]??"";typeof y.text=="string"&&tt(d)&&(d.textContent=C?.text??x?.text??""),bt(d),y.asset&&ma(N.current,be(B,h))}}Se()}};function we(l,d){let x=de(l);ke(l,x,O.current),ia(h=>h.map(C=>{if(C.id!==B)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 bt(l){let d=de(l),x=v.some(h=>h.id!==B&&!!h.elements[d]);ia(h=>h.map(C=>{if(C.id!==B)return C;let{[d]:y,...R}=C.elements;return{...C,elements:R}})),x||O.current.delete(d)}function ia(l){b.current=!0,U(l)}let yt=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:He,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:mt,onPointerLeave:()=>{L.current=null,s.current!==null&&window.cancelAnimationFrame(s.current),s.current=null,V.current=null,c(null),F(null)},onClick:ht}),M&&i&&!S.includes(i)?u(Za,{rect:M,tone:"hover"}):null,k.map((l,d)=>u(Za,{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:xt,children:u(Ve,{size:16,strokeWidth:1.75,"aria-hidden":"true"})}),w("div",{className:"chisel-preset-manager",ref:Ie,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(()=>Ie.current?.querySelector('[role="option"][aria-selected="true"]')?.focus()),d}),children:[u("span",{className:"chisel-preset-trigger-label",children:ue.name}),u(Ae,{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:ka,children:u("div",{className:"chisel-preset-list",children:v.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:()=>It(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=[],g(null),A([]),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(We,{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:He?"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:He?"chisel-text-value":"chisel-warning",children:He?`Source hint: ${He}`:"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=>wt(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(ja,{label:"Text",value:f.style.color||Me(Ce?.color??"#000000"),onChange:l=>Fa("color",l),mixed:Ee("color")}),u(ja,{label:"Fill",value:f.style.backgroundImage||(Ce?.backgroundImage&&Ce.backgroundImage!=="none"?Ce.backgroundImage:f.style.backgroundColor||Me(Ce?.backgroundColor??"#ffffff")),onChange:(l,d)=>Fa("backgroundColor",l,d),supportsBackgroundImages:!0,unavailableAsset:ue.elements[de(f)]?.asset,mixed:Ee("backgroundColor")||Ee("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:Ct,onPreview:St,mixed:Ee("fontFamily")}),Et.map(l=>u(Vt,{control:l,computedStyle:Ce,element:f,mixed:Ee(l.property),onSlide:d=>gt(l,d),onValueChange:d=>va(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:kt,children:"Reset"}),u("button",{className:"chisel-button chisel-button-primary",type:"button",onClick:yt,children:T?"Copied":"Copy agent prompt"})]}),T?u("div",{className:"chisel-note-row",role:"status",children:"Prompt copied"}):null,H?w("div",{className:"chisel-note-row",role:"alert",children:["Press Cmd+C/Ctrl+C",u("textarea",{ref:me,readOnly:!0,value:H,"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:Lt,"aria-pressed":re,children:"Pick element"})]})]})})})})]})}function Za({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),g=p.useMemo(()=>io(e),[e]),S=no(e,g),A=o?"Mixed":S?.label??Ze(e)??"Font";p.useEffect(()=>{r||(f.current=e)},[r,e]),p.useEffect(()=>{if(!r)return;let k=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",k,!0),document.addEventListener("keydown",P),()=>{document.removeEventListener("pointerdown",k,!0),document.removeEventListener("keydown",P)}},[r,t]);let M=()=>{if(r){t(f.current),n(!1);return}f.current=e,n(!0),window.requestAnimationFrame(()=>i.current?.querySelector('[role="option"][aria-selected="true"]')?.focus())},F=k=>{f.current=k.value,a(k.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:M,children:[u("span",{className:"chisel-font-trigger-label",children:A}),u(Ae,{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:ka,children:u("div",{className:"chisel-preset-list chisel-font-list",children:g.map(k=>u("button",{className:"chisel-preset-item chisel-font-item","data-active":ua(e,k.value),"aria-selected":ua(e,k.value),onClick:()=>F(k),onFocus:()=>t(k.value),onPointerEnter:()=>t(k.value),role:"option",style:{fontFamily:k.value},type:"button",children:u("span",{className:"chisel-preset-name",children:k.label})},k.value))})}):null]})]})}function ja({label:e,value:a,onChange:t,supportsBackgroundImages:o=!1,unavailableAsset:r,mixed:n=!1}){let i=lt(a),c=ga(a),f=o&&i?"Gradient":o&&(c!==void 0||r)?"Image":"Solid",g=i?.start??(c!==void 0?"#FFFFFF":rt(a)),[S,A]=p.useState(f),[M,F]=p.useState(()=>Fe(g)),[k,P]=p.useState(g),[T,q]=p.useState(i?.start??g),[H,ae]=p.useState(i?.end??"#FFFFFF"),[v,U]=p.useState("start"),[B,W]=p.useState(c??""),[G,K]=p.useState(""),[te,E]=p.useState(!1),[fe,oe]=p.useState(!1),re=p.useRef(null),le=p.useRef(null),$=S==="Gradient"?v==="start"?T:H:k,ee=Me($).toUpperCase(),m=mo($),I=p.useMemo(()=>uo(ba(ee)),[ee]),Z=n?"Mixed":S==="Gradient"?"Gradient":S==="Image"?"Image":k;p.useEffect(()=>{let s=lt(a),L=ga(a);if(o&&s){let D=v==="end"?s.end:s.start;A("Gradient"),q(s.start),ae(s.end),P(D),F(Fe(D)),E(!1);return}if(o&&L!==void 0){A("Image"),W(L),P("#FFFFFF"),E(!1);return}if(o&&r){A("Image"),W(""),K(""),E(!1);return}let b=rt(a);A("Solid"),P(D=>D&&Me(D)===Me(b)?D:b),F(Fe(b)),E(!1)},[v,o,r,a]),p.useEffect(()=>{if(!fe)return;let s=b=>{let D=b.target;D instanceof Node&&re.current?.contains(D)||(oe(!1),window.requestAnimationFrame(()=>le.current?.focus()))},L=b=>{b.key==="Escape"&&(oe(!1),window.requestAnimationFrame(()=>le.current?.focus()),b.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=ot(s);if(!L){E(s.trim().length>0);return}let b=Te(L)??L;if(F(Fe(b)),P(b),E(!1),S==="Gradient"){Ie(v,b);return}t(b)},se=(s,L=m,b=M)=>{let D=po(s,L,b);if(P(D),E(!1),S==="Gradient"){Ie(v,D);return}t(D)},O=(s,L)=>{let b=Y((s.clientX-L.left)/L.width*100,0,100),D=Y((1-(s.clientY-L.top)/L.height)*100,0,100);se(ta(I.h,b,D))},N=(s,L)=>{let b=Y((s.clientX-L.left)/L.width*360,0,360);se(ta(b,I.s,I.v))},xe=(s,L)=>{let b=Y((s.clientX-L.left)/L.width,0,1);se(ee,b)},V=s=>{if(!ra(s.key))return;let L=s.shiftKey?10:1,b=Y(I.s+(s.key==="ArrowRight"?L:s.key==="ArrowLeft"?-L:0),0,100),D=Y(I.v+(s.key==="ArrowUp"?L:s.key==="ArrowDown"?-L:0),0,100);se(ta(I.h,b,D)),s.preventDefault()},ne=s=>{if(!ra(s.key))return;let L=s.shiftKey?10:1,b=Y(I.h+(Ca(s.key)?L:-L),0,360);se(ta(b,I.s,I.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=>{F(s),se(ee,m,s)},Qe=s=>{if(!(s!=="Solid"&&!o)){if(A(s),s==="Solid"&&t(k),s==="Gradient"){let L=T||k;q(L),U("start"),P(L),t(oa(L,H))}s==="Image"&&B.trim()&&t(Re(B))}},me=s=>{let L=s==="start"?T:H;U(s),P(L),F(Fe(L)),E(!1)},Ie=(s,L)=>{let b=s==="start"?L:T,D=s==="end"?L:H;q(b),ae(D),t(oa(b,D))},ye=(s,L)=>{let b=ot(L);if(s==="start"?q(L):ae(L),U(s),P(L),!b){E(L.trim().length>0);return}let D=Te(b)??b;F(Fe(D)),P(D),E(!1),Ie(s,D)},Ue=s=>{W(s),K(""),t(s.trim()?Re(s):"")},ge=s=>{let L=s.currentTarget.files?.[0];if(!L)return;let b=URL.createObjectURL(L);K(L.name),W(b),t(Re(b),{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,H):S==="Image"&&B?Re(B):k},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(k)},onChange:s=>{if(S!=="Solid")return;let L=s.target.value;P(L),j(L)},onKeyDown:s=>{s.key==="Enter"&&(s.preventDefault(),j(k),s.currentTarget.blur()),s.key==="Escape"&&(s.preventDefault(),P(g),E(!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:[Ht.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(We,{children:[S==="Gradient"?w(We,{children:[u("div",{className:"chisel-color-gradient-preview",style:{backgroundImage:oa(T,H)}}),w("div",{className:"chisel-color-stop-buttons",role:"group","aria-label":`${e} gradient endpoints`,children:[w("button",{className:"chisel-color-stop-button","data-active":v==="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":v==="end","aria-label":`${e} gradient To`,onClick:()=>me("end"),type:"button",children:[u("span",{className:"chisel-color-stop-swatch",style:{background:H}}),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":I.s,"aria-valuetext":`Saturation ${I.s}%, brightness ${I.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(${I.h} 100% 50%)`},children:u("span",{className:"chisel-color-field-cursor",style:{left:`clamp(10px, ${I.s}%, calc(100% - 10px))`,top:`clamp(10px, ${100-I.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":I.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, ${I.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:ct(ee,m)}})]}),w("div",{className:"chisel-color-format-row",children:[u("select",{className:"chisel-color-format-select","aria-label":`${e} color format`,value:M,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:k,onBlur:()=>j(k),onChange:s=>{let L=s.target.value;P(L),j(L)}})]})]}):null,S==="Gradient"?w(We,{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:H,onFocus:()=>me("end"),onChange:s=>ye("end",s.target.value)})]})]}):null,S==="Image"?w(We,{children:[w("label",{className:"chisel-color-extra-row",children:[u("span",{children:"URL"}),u("input",{"aria-label":`${e} image URL`,value:B,onChange:s=>Ue(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:ge})]}),r&&!B.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),g=e.property==="width"?t.getBoundingClientRect().width:e.property==="height"?t.getBoundingClientRect().height:e.min,S=Number.isFinite(f)?f:g,A=Y(S,e.min,e.max),M=Ao(A,e.min,e.max),F=t.style[e.property],k=n?"Mixed":F||`${pe(S)}${e.unit}`,P=yo(k,e),[T,q]=p.useState(k),[H,ae]=p.useState(!1),[v,U]=p.useState(!1),[B,W]=p.useState(!1),G=p.useRef(null),K=p.useRef(null),te=p.useRef(!1),E=p.useMemo(()=>xo(e),[e]),fe={left:`max(5px, ${M}% - 9px)`,"--chisel-handle-opacity":M<18?"0.18":"1","--chisel-handle-scale":M<18?"0.25":"1"};p.useEffect(()=>{H||(q(k),U(!1))},[k,H]),p.useEffect(()=>{if(!B)return;let m=()=>{W(!1),window.requestAnimationFrame(()=>G.current?.focus())},I=j=>{j.target instanceof Node&&G.current?.parentElement?.contains(j.target)||m()},Z=j=>{j.key==="Escape"&&(m(),j.preventDefault())};return document.addEventListener("pointerdown",I,!0),document.addEventListener("keydown",Z),()=>{document.removeEventListener("pointerdown",I,!0),document.removeEventListener("keydown",Z)}},[B]);let oe=(m=T)=>{let I=da(m,e,t,P);if(!I){U(!0);return}q(I),U(!1),r(I)},re=()=>{G.current?.focus(),G.current?.select()},le=(m,I)=>{let Z=vo(m,I,e);q(`${pe(Z)}${e.unit}`),U(!1),o(Z)},$=()=>{E.length<=1||(W(!0),window.requestAnimationFrame(()=>G.current?.parentElement?.querySelector('[role="option"][aria-selected="true"]')?.focus()))},ee=m=>{let I=Io(T,m,e,t,P);if(!I){U(!0);return}q(I),U(!1),r(I),W(!1),G.current?.focus()};return w("div",{className:"chisel-slider","data-units-open":B,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 I=K.current;!I||I.pointerId!==m.pointerId||!I.dragging&&Math.abs(m.clientX-I.startX)<4||(I.dragging=!0,G.current?.blur(),m.preventDefault(),le(m.clientX,I.rect))},onPointerUp:m=>{let I=K.current;!I||I.pointerId!==m.pointerId||(I.dragging&&(te.current=!0,window.setTimeout(()=>{te.current=!1},250),le(m.clientX,I.rect)),I.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,I)=>u("span",{className:"chisel-slider-hashmark",style:{left:`${(I+1)*10}%`}},I))}),u("span",{className:"chisel-slider-fill",style:{width:`${M}%`}}),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:A,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":v,spellCheck:!1,value:T,onBlur:m=>{oe(),ae(!1),m.relatedTarget instanceof HTMLElement&&m.currentTarget.parentElement?.contains(m.relatedTarget)||W(!1)},onChange:m=>{let I=m.target.value;q(I);let Z=da(I,e,t,P);if(!Z){U(I.trim().length>0);return}U(!1),r(Z),Z!==I&&Lo(I)&&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 I=Po(T,e,t,P,m.shiftKey?10:1,Ca(m.key));if(!I)return;m.preventDefault(),q(I),U(!1),r(I)}m.key==="Escape"&&(m.preventDefault(),q(k),U(!1),W(!1),m.currentTarget.blur())}}),B?u("div",{className:"chisel-unit-menu",role:"listbox","aria-label":`${e.label} units`,onKeyDown:ka,children:E.map(m=>u("button",{className:"chisel-unit-option","data-active":m===P,"aria-selected":m===P,onClick:I=>{I.preventDefault(),ee(m)},onPointerDown:I=>{I.preventDefault(),I.stopPropagation()},role:"option",type:"button",children:m||"unitless"},m||"unitless"))}):null]})}function zt(){return u("style",{children:`
|
|
10
|
-
${Wa}
|
|
11
|
-
.chisel-root, .chisel-root * { box-sizing: border-box; }
|
|
12
|
-
.chisel-root :where(button, input, textarea, select) { margin: 0; font: inherit; color: inherit; text-transform: none; }
|
|
13
|
-
.chisel-root button { appearance: none; min-width: var(--chisel-ui-control); min-height: var(--chisel-ui-control); }
|
|
14
|
-
.chisel-root { --chisel-surface: rgba(0, 0, 0, 0.04); --chisel-surface-hover: rgba(0, 0, 0, 0.08); --chisel-surface-active: rgba(0, 0, 0, 0.1); --chisel-surface-subtle: rgba(0, 0, 0, 0.06); --chisel-text-root: #000; --chisel-text-section: rgba(0, 0, 0, 0.65); --chisel-text-label: rgba(0, 0, 0, 0.6); --chisel-text-focus: #000; --chisel-text-primary: rgba(0, 0, 0, 0.9); --chisel-text-secondary: rgba(0, 0, 0, 0.55); --chisel-text-tertiary: rgba(0, 0, 0, 0.55); --chisel-border: rgba(0, 0, 0, 0.1); --chisel-border-hover: rgba(0, 0, 0, 0.15); --chisel-glass-bg: rgba(250, 250, 250, 0.88); --chisel-radius: 8px; --chisel-row-height: 40px; --chisel-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); --chisel-motion: 150ms cubic-bezier(0.2, 0.8, 0.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; }
|
|
15
|
-
.chisel-root { color-scheme: light; --chisel-warning-color: #805b12; --chisel-danger-color: #8a1f1f; }
|
|
16
|
-
@media (prefers-color-scheme: dark) {
|
|
17
|
-
.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; }
|
|
18
|
-
}
|
|
19
|
-
.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);}
|
|
20
|
-
.chisel-inspection-layer { position: fixed; inset: 0; pointer-events: auto; touch-action: pan-y pinch-zoom; }
|
|
21
|
-
.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; }
|
|
22
|
-
.chisel-box { position: fixed; left: 0; top: 0; border-radius: 0; pointer-events: none; transition: none; }
|
|
23
|
-
.chisel-box-hover { border: 1px solid var(--chisel-ui-focus); background: color-mix(in srgb,var(--chisel-ui-focus) 8%,transparent); }
|
|
24
|
-
.chisel-box-selected { border: 2px solid var(--chisel-ui-focus); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92), 0 0 0 4px color-mix(in srgb,var(--chisel-ui-focus) 18%,transparent); }
|
|
25
|
-
.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; }
|
|
26
|
-
.chisel-panel-right { right: 16px; }
|
|
27
|
-
.chisel-panel-left { left: 16px; }
|
|
28
|
-
.chisel-panel-wrapper { display: inline-flex; flex-direction: column; width: 100%; }
|
|
29
|
-
.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; }
|
|
30
|
-
.chisel-panel-inner::-webkit-scrollbar { display: none; }
|
|
31
|
-
.chisel-folder { border: 0; margin-bottom: 16px; padding-bottom: 0; }
|
|
32
|
-
.chisel-folder-root { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
|
|
33
|
-
.chisel-panel-header { border: 0; margin-bottom: 16px; padding-bottom: 0; }
|
|
34
|
-
.chisel-folder-header { user-select: none; }
|
|
35
|
-
.chisel-folder-header-top { display: flex; align-items: center; justify-content: space-between; height: var(--chisel-row-height); padding: 0; }
|
|
36
|
-
.chisel-folder-title-row { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; overflow: hidden; white-space: nowrap; }
|
|
37
|
-
.chisel-folder-title { color: var(--chisel-text-section); font-size: 13px; font-weight: 600; letter-spacing: -0.01em; transform: translateY(-0.5px); }
|
|
38
|
-
.chisel-folder-title-root { color: var(--chisel-text-root); font-size: 15px; font-weight: 600; transform: translateZ(0); }
|
|
39
|
-
.chisel-folder-count { color: var(--chisel-text-tertiary); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; font-weight: 500; }
|
|
40
|
-
.chisel-folder-content { position: relative; }
|
|
41
|
-
.chisel-folder-inner, .chisel-content, .chisel-empty { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
|
|
42
|
-
.chisel-folder:not(.chisel-folder-root) { border: 0; margin-top: 16px; margin-bottom: 0; padding-bottom: 0; }
|
|
43
|
-
.chisel-folder:not(.chisel-folder-root) + .chisel-folder:not(.chisel-folder-root) { margin-top: 16px; }
|
|
44
|
-
.chisel-panel-toolbar { display: flex; align-items: center; gap: 6px; height: var(--chisel-row-height); min-width: 0; margin-bottom: 6px; overflow: visible; }
|
|
45
|
-
.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); }
|
|
46
|
-
.chisel-toolbar-add:hover, .chisel-preset-trigger:hover, .chisel-button:hover { background: var(--chisel-surface-hover); color: var(--chisel-text-primary); }
|
|
47
|
-
.chisel-toolbar-add:active, .chisel-preset-trigger:active, .chisel-button:active { transform: scale(0.96); }
|
|
48
|
-
.chisel-preset-manager { position: relative; flex: 1; min-width: 0; }
|
|
49
|
-
.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; }
|
|
50
|
-
.chisel-preset-trigger[aria-expanded="true"] { background: var(--chisel-surface-active); }
|
|
51
|
-
.chisel-preset-trigger-label, .chisel-font-trigger-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
52
|
-
.chisel-chevron { width: 16px; height: 16px; flex-shrink: 0; margin-left: 8px; opacity: 0.72; transition: transform var(--chisel-motion), opacity var(--chisel-motion); }
|
|
53
|
-
.chisel-preset-trigger[aria-expanded="true"] .chisel-chevron, .chisel-font-trigger[aria-expanded="true"] .chisel-chevron { opacity: 1; transform: rotate(180deg); }
|
|
54
|
-
.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 rgba(0, 0, 0, 0.08); animation: chisel-pop-in var(--chisel-motion); transform-origin: top center; }
|
|
55
|
-
.chisel-preset-list { display: flex; flex-direction: column; gap: 2px; }
|
|
56
|
-
.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); }
|
|
57
|
-
.chisel-preset-item:hover { background: var(--chisel-surface-hover); }
|
|
58
|
-
.chisel-preset-item[data-active="true"] { background: var(--chisel-surface-active); color: var(--chisel-text-primary); }
|
|
59
|
-
.chisel-preset-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
60
|
-
.chisel-preset-count { color: var(--chisel-text-tertiary); font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 11px; }
|
|
61
|
-
.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); }
|
|
62
|
-
.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(-0.5px); }
|
|
63
|
-
.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; }
|
|
64
|
-
.chisel-context-row { background: transparent; padding-inline: 0; }
|
|
65
|
-
.chisel-selector-row { min-height: var(--chisel-row-height); }
|
|
66
|
-
.chisel-selector { max-width: 168px; line-height: 1.25; }
|
|
67
|
-
.chisel-warning { color: var(--chisel-warning-color); font-family: inherit; }
|
|
68
|
-
.chisel-textarea-control { height: auto; align-items: flex-start; padding-top: 10px; padding-bottom: 10px; }
|
|
69
|
-
.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; }
|
|
70
|
-
.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); }
|
|
71
|
-
.chisel-text-input:disabled { color: var(--chisel-text-tertiary); cursor: not-allowed; }
|
|
72
|
-
.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; }
|
|
73
|
-
.chisel-toolbar-add { background: transparent; }
|
|
74
|
-
.chisel-actions .chisel-button { background: transparent; }
|
|
75
|
-
.chisel-actions .chisel-button-primary { background: var(--chisel-ui-action); color: var(--chisel-ui-action-text); }
|
|
76
|
-
.chisel-actions .chisel-button-primary:hover { background: var(--chisel-ui-action); opacity: .9; }
|
|
77
|
-
.chisel-button:disabled { color: var(--chisel-text-tertiary); cursor: not-allowed; transform: none; }
|
|
78
|
-
.chisel-font-control { position: relative; overflow: visible; cursor: default; }
|
|
79
|
-
.chisel-font-picker { min-width: 0; flex: 0 1 150px; }
|
|
80
|
-
.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); }
|
|
81
|
-
.chisel-font-trigger:hover, .chisel-font-trigger[aria-expanded="true"] { color: var(--chisel-text-primary); }
|
|
82
|
-
.chisel-font-dropdown { left: 0; right: 0; width: 100%; max-height: 262px; overflow: hidden; }
|
|
83
|
-
.chisel-font-list { max-height: 252px; overflow-y: auto; padding-right: 1px; -ms-overflow-style: none; scrollbar-width: none; }
|
|
84
|
-
.chisel-font-list::-webkit-scrollbar { display: none; }
|
|
85
|
-
.chisel-font-item { justify-content: flex-start; text-align: left; font-size: 14px; }
|
|
86
|
-
.chisel-color-control { position: relative; overflow: visible; flex-wrap: wrap; }
|
|
87
|
-
.chisel-color-control[data-picker-open="true"] { z-index: 25; padding-bottom: 0; }
|
|
88
|
-
.chisel-color-inputs { display: inline-flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; justify-content: flex-end; }
|
|
89
|
-
.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); }
|
|
90
|
-
.chisel-color-swatch:after { content:""; position:absolute; inset:-8px; border-radius:inherit; }
|
|
91
|
-
@media(pointer:coarse) { .chisel-color-swatch:after { inset:-10px; } }
|
|
92
|
-
.chisel-color-control:hover .chisel-color-swatch { box-shadow: 0 0 0 2px var(--chisel-surface-hover); }
|
|
93
|
-
.chisel-color-swatch:active { transform: scale(0.96); }
|
|
94
|
-
.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; }
|
|
95
|
-
.chisel-color-value-input[data-invalid="true"] { color: var(--chisel-danger-color); }
|
|
96
|
-
.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); }
|
|
97
|
-
.chisel-color-tabs { min-height:40px; height: 32px; display: flex; align-items: flex-start; gap: 14px; border-bottom: 1px solid var(--chisel-surface-subtle); }
|
|
98
|
-
.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; }
|
|
99
|
-
.chisel-color-tab { height: 32px; padding: 0; border-bottom: 2px solid transparent; }
|
|
100
|
-
.chisel-color-tab[data-active="true"] { color: var(--chisel-text-primary); border-bottom-color: var(--chisel-text-primary); }
|
|
101
|
-
.chisel-color-tab[aria-disabled="true"] { color: var(--chisel-text-tertiary); cursor: default; }
|
|
102
|
-
.chisel-color-close { margin-left: auto; font-size: 18px; line-height: 1; color: var(--chisel-text-tertiary); }
|
|
103
|
-
.chisel-color-close:hover, .chisel-color-saved-row button:hover { color: var(--chisel-text-primary); }
|
|
104
|
-
.chisel-color-field { position: relative; height: 132px; overflow: hidden; border-radius: 9px; cursor: crosshair; touch-action: none; background-image: linear-gradient(90deg, #fff, rgba(255, 255, 255, 0)), linear-gradient(0deg, #000, rgba(0, 0, 0, 0)); }
|
|
105
|
-
.chisel-color-field-cursor { position: absolute; width: 12px; height: 12px; border: 2px solid #fff; border-radius: 999px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); transform: translate(-50%, -50%); pointer-events: none; }
|
|
106
|
-
.chisel-color-hue { position: relative; height: 12px; border-radius: 999px; background: linear-gradient(90deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00); cursor: pointer; touch-action: none; }
|
|
107
|
-
.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 rgba(0, 0, 0, 0.28); transform: translate(-50%, -50%); pointer-events: none; }
|
|
108
|
-
.chisel-color-alpha { position: relative; height: 12px; overflow: visible; border-radius: 999px; background-color: #fff; background-image: linear-gradient(45deg, rgba(0,0,0,0.12) 25%, transparent 25%), linear-gradient(-45deg, rgba(0,0,0,0.12) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.12) 75%), linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.12) 75%); background-size: 8px 8px; background-position: 0 0, 0 4px, 4px -4px, -4px 0; cursor: pointer; touch-action: none; }
|
|
109
|
-
.chisel-color-alpha::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, transparent, var(--chisel-alpha-color)); pointer-events: none; }
|
|
110
|
-
.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; }
|
|
111
|
-
.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 rgba(0, 0, 0, 0.22); transform: translate(-50%, -50%); pointer-events: none; }
|
|
112
|
-
.chisel-color-gradient-preview { height: 28px; border: 1px solid var(--chisel-border); border-radius: var(--chisel-radius); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28); }
|
|
113
|
-
.chisel-color-stop-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
|
|
114
|
-
.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); }
|
|
115
|
-
.chisel-color-stop-button:hover { background: var(--chisel-surface-hover); color: var(--chisel-text-primary); }
|
|
116
|
-
.chisel-color-stop-button[data-active="true"] { background: var(--chisel-surface-active); color: var(--chisel-text-primary); }
|
|
117
|
-
.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 rgba(255, 255, 255, 0.28); }
|
|
118
|
-
.chisel-color-format-row { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 6px; }
|
|
119
|
-
.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; }
|
|
120
|
-
.chisel-color-format-select { padding: 0 8px; cursor: pointer; }
|
|
121
|
-
.chisel-color-format-input { padding: 0 9px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
|
|
122
|
-
.chisel-color-format-input[data-invalid="true"] { color: var(--chisel-danger-color); }
|
|
123
|
-
.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; }
|
|
124
|
-
.chisel-color-extra-row span, .chisel-color-upload-row span:first-child { flex-shrink: 0; }
|
|
125
|
-
.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; }
|
|
126
|
-
.chisel-color-upload-row { cursor: pointer; transition: background var(--chisel-motion), color var(--chisel-motion), transform var(--chisel-motion); }
|
|
127
|
-
.chisel-color-upload-row:hover { background: var(--chisel-surface-hover); color: var(--chisel-text-primary); }
|
|
128
|
-
.chisel-color-upload-row input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
|
|
129
|
-
.chisel-color-upload-name { min-width: 0; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; color: var(--chisel-text-tertiary); }
|
|
130
|
-
.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; }
|
|
131
|
-
.chisel-slider[data-units-open="true"] { z-index: 20; overflow: visible; }
|
|
132
|
-
.chisel-slider input[type="range"] { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; opacity: 0; pointer-events: none; cursor: pointer; }
|
|
133
|
-
.chisel-slider-label { position: absolute; top: 50%; left: 10px; pointer-events: none; transform: translateY(calc(-50% - 0.5px)); z-index: 2; }
|
|
134
|
-
.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; }
|
|
135
|
-
.chisel-root .chisel-slider-value-input:focus { cursor: text; }
|
|
136
|
-
.chisel-slider-value-input[data-invalid="true"] { border-color: rgba(170, 48, 48, 0.38); background: rgba(170, 48, 48, 0.08); color: var(--chisel-danger-color); }
|
|
137
|
-
.chisel-slider-hashmarks { position: absolute; inset: 0; pointer-events: none; }
|
|
138
|
-
.chisel-slider-hashmark { position: absolute; top: 50%; width: 1px; height: 8px; border-radius: 999px; background: transparent; transform: translate(-50%, -50%); transition: background 0.2s; }
|
|
139
|
-
.chisel-slider:hover .chisel-slider-hashmark { background: var(--chisel-surface-hover); }
|
|
140
|
-
.chisel-slider-fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--chisel-surface-active); pointer-events: none; transition: background 0.15s; }
|
|
141
|
-
.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 0.15s, transform 0.15s; }
|
|
142
|
-
.chisel-slider:hover .chisel-slider-handle { opacity: var(--chisel-handle-opacity, 1); }
|
|
143
|
-
.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 rgba(0, 0, 0, 0.1); animation: chisel-pop-in var(--chisel-motion); cursor: default; }
|
|
144
|
-
.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); }
|
|
145
|
-
.chisel-unit-option:hover { background: var(--chisel-surface-hover); color: var(--chisel-text-primary); }
|
|
146
|
-
.chisel-unit-option[data-active="true"] { background: var(--chisel-surface-active); color: var(--chisel-text-primary); }
|
|
147
|
-
.chisel-actions { display: flex; flex-direction: column; gap: 6px; padding-bottom: 10px; }
|
|
148
|
-
.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); }
|
|
149
|
-
@keyframes chisel-pop-in { from { opacity: 0; transform: translateY(-3px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
|
|
150
|
-
@media (prefers-reduced-motion: reduce) {
|
|
151
|
-
.chisel-root, .chisel-root * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
|
|
152
|
-
}
|
|
153
|
-
@media (max-width: 760px) {
|
|
154
|
-
.chisel-root { --chisel-row-height: 44px; }
|
|
155
|
-
.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; }
|
|
156
|
-
.chisel-panel-inner { width: 100%; max-height: 58dvh; }
|
|
157
|
-
.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; }
|
|
158
|
-
.chisel-color-tabs { min-height:40px; height: 44px; }
|
|
159
|
-
.chisel-color-hue, .chisel-color-alpha { height: 44px; }
|
|
160
|
-
.chisel-unit-menu { grid-template-columns: repeat(4, minmax(44px, 1fr)); width: 206px; }
|
|
161
|
-
}
|
|
162
|
-
@media (forced-colors: active) {
|
|
163
|
-
.chisel-panel-inner, .chisel-preset-dropdown, .chisel-color-popover { forced-color-adjust: auto; border: 1px solid CanvasText; background: Canvas; }
|
|
164
|
-
.chisel-box { border-color: Highlight; }
|
|
165
|
-
}
|
|
166
|
-
`})}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=()=>{st(),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=()=>{st(),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 st(){let e=++$a;Ke=!0,window.setTimeout(()=>{$a===e&&(Ke=!1)},0)}function jt(e=ut(window.location.pathname,window.location.search)){return`vse:versions:${e}`}function Jt(e,a){return`vse:versions:${e}${a}`}function ut(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=Xa(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 Ja(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 ke(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=(Xe.get(e)??0)+1;Xe.set(e,a),window.setTimeout(()=>{Xe.get(e)===a&&Xe.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 g=new Set(f.flatMap(S=>Object.keys(S.styles)));f.some(S=>S.asset)&&g.add("backgroundImage");for(let S of g){let A=i.styles[S]??"";c.style[S]!==A&&(c.style[S]=A)}}for(let[n,i]of Object.entries(e.elements)){let c=dt(i);if(c){ke(c,n,t),ce(c),typeof i.text=="string"&&c.textContent!==i.text&&(c.textContent=i.text);for(let[f,g]of Object.entries(i.styles))c.style[f]!==g&&(c.style[f]=g);if(i.asset){let f=o.get(be(e.id,n)),g=f?Re(f):"";c.style.backgroundImage!==g&&(c.style.backgroundImage=g)}}}}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 be(e,a){return`${e}:${a}`}function Qa(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 g=n.styles[c]??"";Yt(c,i.style[c],f)&&(i.style[c]=g)}if(r.asset){let c=t.get(be(e.id,o));c&&i.style.backgroundImage===Re(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 dt(e){let a=e.sourceHint?wa(e.sourceHint):void 0;return _a(a)??_a(e.selector)}function _a(e){if(e)try{let a=document.querySelector(e);return a instanceof HTMLElement?a:void 0}catch{return}}function Ya(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:it(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(`
|
|
167
|
-
`)}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=dt(n);return{selector:n.selector,sourceHint:n.sourceHint,tagName:c?.tagName.toLowerCase(),ancestry:c?it(c):void 0,textBefore:i?.text,textAfter:n.text,asset:n.asset,styleChanges:Object.fromEntries(Object.entries(n.styles).map(([f,g])=>[f,{before:i?.styles[f]??null,after:g}]))}});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(`
|
|
168
|
-
`)}function De(e){let a=ft(e);if(a)return et(a)?a:void 0;let t=ro(e);if(t)return et(t)?t:void 0}function ro(e){let a=e.parentElement?.closest("[data-chisel-id], [data-ai-edit], [data-component]");if(!(!(a instanceof HTMLElement)||a===e))return ft(a)}function ft(e){return e.dataset.chiselId??e.dataset.aiEdit??e.dataset.component}function et(e){return document.querySelectorAll(wa(e)).length===1}function wa(e){let a=Ia(e);return`[data-chisel-id="${a}"], [data-ai-edit="${a}"], [data-component="${a}"]`}function $e(e){let a=De(e);if(a)return wa(a);if(e.id)return`#${Ia(e.id)}`;let t=[],o=e;for(;o&&o!==document.body&&t.length<5;){let r=o.tagName.toLowerCase(),n=Array.from(o.classList).filter(Boolean).slice(0,2);n.length&&(r+=n.map(c=>`.${Ia(c)}`).join(""));let i=o.parentElement;if(i){let c=o.tagName,f=Array.from(i.children).filter(g=>g.tagName===c);f.length>1&&(r+=`:nth-of-type(${f.indexOf(o)+1})`)}t.unshift(r),o=i}return t.join(" > ")}function it(e){let a=[],t=e;for(;t&&t!==document.body&&a.length<6;){let o=(t.textContent??"").trim().replace(/\s+/g," ").slice(0,80);a.push(`${t.tagName.toLowerCase()}${t.id?`#${t.id}`:""}${o?` "${o}"`:""}`),t=t.parentElement}return a}function ie(e){return{x:J(e.x),y:J(e.y),width:J(e.width),height:J(e.height),top:J(e.top),right:J(e.right),bottom:J(e.bottom),left:J(e.left)}}function Be(e){return!!e.closest("[data-chisel-root='true']")}function lo(e){let a=e.closest("[data-chisel-id], [data-ai-edit], [data-component]");return a instanceof HTMLElement?a:e}function so(){return Array.from(document.body.querySelectorAll("*")).filter(e=>{if(Be(e)||e.closest("nextjs-portal")||["script","style","link","meta","noscript"].includes(e.tagName.toLowerCase()))return!1;let a=e.getBoundingClientRect(),t=getComputedStyle(e);return a.width>0&&a.height>0&&t.display!=="none"&&t.visibility!=="hidden"})}function at(e){let a=De(e),t=a?`source hint ${a}`:`selector confidence ${e.id?"high":"low"}`,o=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,60);return`${e.tagName.toLowerCase()}, ${t}${o?`, ${o}`:""}`}function ka(e){let a=Array.from(e.currentTarget.querySelectorAll('[role="option"]')).filter(r=>r.getAttribute("aria-disabled")!=="true");if(!a.length)return;let t=Math.max(0,a.indexOf(document.activeElement)),o;if(e.key==="ArrowDown"||e.key==="ArrowRight")o=(t+1)%a.length;else if(e.key==="ArrowUp"||e.key==="ArrowLeft")o=(t-1+a.length)%a.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=a.length-1;else if(e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let r=a.find(n=>(n.textContent??"").trim().toLowerCase().startsWith(e.key.toLowerCase()));r&&(o=a.indexOf(r))}o!==void 0&&(a[o]?.focus(),e.preventDefault())}function tt(e){return!(e.children.length>0||Nt.has(e.tagName.toLowerCase()))}function Ia(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/["\\#.:,[\]>~+*^$|= ]/g,"\\$&")}function Me(e){let a=Te(e);if(a)return a;let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(t)return`#${[t[1],t[2],t[3]].map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`;let o=nt(e);if(!o||o===e)return"#ffffff";let r=o.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/i);return r?`#${[r[1],r[2],r[3]].map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`:"#ffffff"}function nt(e){if(typeof document>"u")return;let a=document.createElement("span");if(a.style.color=e,!a.style.color)return;a.style.position="absolute",a.style.visibility="hidden",document.body.appendChild(a);let t=getComputedStyle(a).color;return a.remove(),t}function Te(e){let a=e.trim(),t=a.match(/^#([0-9a-f]{3})$/i);if(t)return`#${t[1].split("").map(o=>`${o}${o}`).join("")}`.toUpperCase();if(/^#[0-9a-f]{6}$/i.test(a))return a.toUpperCase()}function ba(e){let t=(Te(e)??"#FFFFFF").slice(1);return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}}function uo({r:e,g:a,b:t}){let o=e/255,r=a/255,n=t/255,i=Math.max(o,r,n),c=Math.min(o,r,n),f=i-c,g=0;return f!==0&&(i===o?g=(r-n)/f%6:i===r?g=(n-o)/f+2:g=(o-r)/f+4),g=Math.round(g*60),g<0&&(g+=360),{h:g,s:i===0?0:J(f/i*100),v:J(i*100)}}function fo({r:e,g:a,b:t}){let o=e/255,r=a/255,n=t/255,i=Math.max(o,r,n),c=Math.min(o,r,n),f=(i+c)/2,g=i-c;if(g===0)return{h:0,s:0,l:Math.round(f*100)};let S=g/(1-Math.abs(2*f-1)),A=0;return i===o?A=(r-n)/g%6:i===r?A=(n-o)/g+2:A=(o-r)/g+4,A=Math.round(A*60),A<0&&(A+=360),{h:A,s:Math.round(S*100),l:Math.round(f*100)}}function ta(e,a,t){let o=t/100*(a/100),r=o*(1-Math.abs(e/60%2-1)),n=t/100-o,i=Math.floor(e/60)%6;return`#${([[o,r,0],[r,o,0],[0,o,r],[0,r,o],[r,0,o],[o,0,r]][i]??[o,0,r]).map(f=>Math.round((f+n)*255).toString(16).padStart(2,"0")).join("")}`.toUpperCase()}function sa(e){return(e??"").replace(/\s+/g," ").trim()}function Ze(e){return e.split(",")[0]?.replace(/^["']|["']$/g,"").trim()}function io(e){let a=[],t=new Set,o=r=>{let n=Ze(r.value)?.toLowerCase()??r.label.toLowerCase();t.has(n)||(t.add(n),a.push(r))};for(let r of Ut)o(r);if(e&&!a.some(r=>ua(e,r.value))){let r=Ze(e);r&&a.unshift({label:r,value:e})}return a}function no(e,a){return a.find(t=>ua(e,t.value))}function ua(e,a){let t=Ze(e)?.toLowerCase(),o=Ze(a)?.toLowerCase();return t&&o&&t===o?!0:sa(e)===sa(a)}function ot(e){let a=e.trim();if(a&&qe("color",a))return a}function rt(e){return Te(e)??e}function lt(e){let a=e.trim();if(!a.toLowerCase().startsWith("linear-gradient(")||!a.endsWith(")"))return;let t=a.slice(a.indexOf("(")+1,-1),o=co(t);if(!(o.length<3))return{start:o[1].trim(),end:o.slice(2).join(", ").trim()}}function ga(e){let a=e.trim();if(!a.toLowerCase().startsWith("url(")||!a.endsWith(")"))return;let t=a.slice(a.indexOf("(")+1,-1).trim(),o=t[0];return(o==='"'||o==="'")&&t.endsWith(o)&&(t=t.slice(1,-1)),t.replace(/\\(["'\\])/g,"$1")}function co(e){let a=[],t="",o=0,r;for(let n=0;n<e.length;n+=1){let i=e[n],c=e[n-1];if(r){t+=i,i===r&&c!=="\\"&&(r=void 0);continue}if(i==='"'||i==="'"){r=i,t+=i;continue}if(i==="("&&(o+=1),i===")"&&(o=Math.max(0,o-1)),i===","&&o===0){a.push(t.trim()),t="";continue}t+=i}return t.trim()&&a.push(t.trim()),a}function Fe(e){let a=e.trim().toLowerCase();return a.startsWith("hsl")?"HSL":a.startsWith("rgba")?"RGBA":a.startsWith("rgb")?"RGB":"Hex"}function po(e,a,t){let o=(Te(e)??Me(e)).toUpperCase(),{r,g:n,b:i}=ba(o);if(t==="RGB")return`rgb(${r}, ${n}, ${i})`;if(t==="RGBA")return ct(o,a);if(t==="HSL"){let{h:c,s:f,l:g}=fo({r,g:n,b:i});return a<1?`hsl(${c} ${f}% ${g}% / ${pe(a)})`:`hsl(${c} ${f}% ${g}%)`}return o}function mo(e){let t=(nt(e)??e).match(/rgba?\([^,]+,\s*[^,]+,\s*[^,]+(?:,\s*([^)]+))?\)/i);if(!t?.[1])return 1;let o=Number.parseFloat(t[1]);return Number.isFinite(o)?Y(o,0,1):1}function ct(e,a){let{r:t,g:o,b:r}=ba(e);return`rgba(${t}, ${o}, ${r}, ${pe(a)})`}function oa(e,a){return`linear-gradient(135deg, ${e}, ${a})`}function Re(e){return`url("${e.trim().replace(/["\\]/g,"\\$&")}")`}function ho(e){return e.startsWith("linear-gradient(")||e.startsWith("url(")}function da(e,a,t,o=a.unit){let r=e.trim();if(!r)return;let i=wo(r,t)??ko(r,a,o);if(qe(a.cssProperty,i))return i}function qe(e,a){return typeof CSS>"u"||typeof CSS.supports!="function"?!0:CSS.supports(e,a)}function Lo(e){return/^-?(?:\d+|\d*\.\d+)(px|rem|em)(px|rem|em)$/i.test(e.trim())}function xo(e){let a=[];qe(e.cssProperty,"1")&&a.push("");for(let t of qt)qe(e.cssProperty,`1${t}`)&&a.push(t);return a}function Io(e,a,t,o,r){let n=da(e,t,o,r);if(!n)return;let i=go(n);if(!i)return;if(i.unit===a)return n;let c=Co(i.value,i.unit,t,o);if(c===void 0)return;let f=So(c,a,t,o);if(f===void 0)return;let g=a?`${pe(J(f))}${a}`:pe(J(f));return qe(t.cssProperty,g)?g:void 0}function go(e){let a=e.trim().match(/^(-?(?:\d+|\d*\.\d+))([a-z%]*)$/i);if(!a)return;let t=Number(a[1]);if(Number.isFinite(t))return{value:t,unit:a[2].toLowerCase()}}function Co(e,a,t,o){if(!a)return t.cssProperty==="line-height"?e*pt(o):t.cssProperty==="opacity"?e:void 0;let r=je(a,o,t);return r===void 0?void 0:e*r}function So(e,a,t,o){if(!a)return t.cssProperty==="line-height"?e/pt(o):t.cssProperty==="opacity"?e:void 0;let r=je(a,o,t);return r===void 0||r===0?void 0:e/r}function wo(e,a){let t=e.match(/^(-?(?:\d+|\d*\.\d+))(px|rem|em)(px|rem|em)$/i);if(!t)return;let o=Number(t[1]),r=t[2].toLowerCase(),n=t[3].toLowerCase();if(!Number.isFinite(o)||r===n)return;let i=je(r,a),c=je(n,a);if(!i||!c)return;let g=o*i/c;return`${pe(J(g))}${n}`}function ko(e,a,t){return!bo(e)||!t||qe(a.cssProperty,e)&&a.unit===""?e:`${e}${t}`}function bo(e){return/^-?(?:\d+|\d*\.\d+)$/.test(e)}function yo(e,a){return e.trim().match(/(-?(?:\d+|\d*\.\d+))([a-z%]+)$/i)?.[2]??a.unit}function ra(e){return e==="ArrowUp"||e==="ArrowRight"||e==="ArrowDown"||e==="ArrowLeft"}function Ca(e){return e==="ArrowUp"||e==="ArrowRight"}function Po(e,a,t,o,r,n){let i=e.trim().match(/^(-?(?:\d+|\d*\.\d+))([a-z%]*)$/i);if(!i)return;let c=Number(i[1]);if(!Number.isFinite(c))return;let f=i[2]||o,g=J(c+(n?r:-r)),S=f?`${pe(g)}${f}`:pe(g);return da(S,a,t,f)}function je(e,a,t){if(e==="px")return 1;if(e==="rem"){let o=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(o)&&o>0?o:16}if(e==="em"){let o=t?.cssProperty==="font-size"?a.parentElement??a:a,r=parseFloat(getComputedStyle(o).fontSize);return Number.isFinite(r)&&r>0?r:je("rem",a)}}function pt(e){let a=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(a)&&a>0?a:16}function Y(e,a,t){return Math.min(t,Math.max(a,e))}function Ao(e,a,t){return t<=a?0:Y((e-a)/(t-a)*100,0,100)}function vo(e,a,t){let o=a.width>0?Y((e-a.left)/a.width,0,1):0,r=t.min+o*(t.max-t.min);return Fo(r,t.step,t.min)}function Fo(e,a,t){if(a<=0)return e;let o=Math.round((e-t)/a)*a+t,r=String(a).includes(".")?String(a).split(".")[1].length:0;return Number(o.toFixed(r))}function J(e){return Math.round(e*100)/100}function pe(e){return Number.isInteger(e)?String(e):e.toFixed(2)}export{wr as Chisel,Sr as EditableRegion};
|
|
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) :focus{outline:none}.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-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-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-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
|
+
`;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
|
+
`})}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
|
+
`)}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(`
|
|
5
|
+
`)}function De(e){let a=st(e);if(a)return Qa(a)?a:void 0;let t=ro(e);if(t)return Qa(t)?t:void 0}function ro(e){let a=e.parentElement?.closest("[data-chisel-id], [data-ai-edit], [data-component]");if(!(!(a instanceof HTMLElement)||a===e))return st(a)}function st(e){return e.dataset.chiselId??e.dataset.aiEdit??e.dataset.component}function Qa(e){return document.querySelectorAll(wa(e)).length===1}function wa(e){let a=ga(e);return`[data-chisel-id="${a}"], [data-ai-edit="${a}"], [data-component="${a}"]`}function $e(e){let a=De(e);if(a)return wa(a);if(e.id)return`#${ga(e.id)}`;let t=[],o=e;for(;o&&o!==document.body&&t.length<5;){let r=o.tagName.toLowerCase(),n=Array.from(o.classList).filter(Boolean).slice(0,2);n.length&&(r+=n.map(c=>`.${ga(c)}`).join(""));let i=o.parentElement;if(i){let c=o.tagName,f=Array.from(i.children).filter(I=>I.tagName===c);f.length>1&&(r+=`:nth-of-type(${f.indexOf(o)+1})`)}t.unshift(r),o=i}return t.join(" > ")}function ut(e){let a=[],t=e;for(;t&&t!==document.body&&a.length<6;){let o=(t.textContent??"").trim().replace(/\s+/g," ").slice(0,80);a.push(`${t.tagName.toLowerCase()}${t.id?`#${t.id}`:""}${o?` "${o}"`:""}`),t=t.parentElement}return a}function ie(e){return{x:J(e.x),y:J(e.y),width:J(e.width),height:J(e.height),top:J(e.top),right:J(e.right),bottom:J(e.bottom),left:J(e.left)}}function Re(e){return!!e.closest("[data-chisel-root='true']")}function lo(e){let a=e.closest("[data-chisel-id], [data-ai-edit], [data-component]");return a instanceof HTMLElement?a:e}function so(){return Array.from(document.body.querySelectorAll("*")).filter(e=>{if(Re(e)||e.closest("nextjs-portal")||["script","style","link","meta","noscript"].includes(e.tagName.toLowerCase()))return!1;let a=e.getBoundingClientRect(),t=getComputedStyle(e);return a.width>0&&a.height>0&&t.display!=="none"&&t.visibility!=="hidden"})}function _a(e){let a=De(e),t=a?`source hint ${a}`:`selector confidence ${e.id?"high":"low"}`,o=(e.textContent??"").trim().replace(/\s+/g," ").slice(0,60);return`${e.tagName.toLowerCase()}, ${t}${o?`, ${o}`:""}`}function ba(e){let a=Array.from(e.currentTarget.querySelectorAll('[role="option"]')).filter(r=>r.getAttribute("aria-disabled")!=="true");if(!a.length)return;let t=Math.max(0,a.indexOf(document.activeElement)),o;if(e.key==="ArrowDown"||e.key==="ArrowRight")o=(t+1)%a.length;else if(e.key==="ArrowUp"||e.key==="ArrowLeft")o=(t-1+a.length)%a.length;else if(e.key==="Home")o=0;else if(e.key==="End")o=a.length-1;else if(e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let r=a.find(n=>(n.textContent??"").trim().toLowerCase().startsWith(e.key.toLowerCase()));r&&(o=a.indexOf(r))}o!==void 0&&(a[o]?.focus(),e.preventDefault())}function Ya(e){return!(e.children.length>0||Nt.has(e.tagName.toLowerCase()))}function ga(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):e.replace(/["\\#.:,[\]>~+*^$|= ]/g,"\\$&")}function Be(e){let a=Te(e);if(a)return a;let t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/i);if(t)return`#${[t[1],t[2],t[3]].map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`;let o=dt(e);if(!o||o===e)return"#ffffff";let r=o.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/i);return r?`#${[r[1],r[2],r[3]].map(n=>Number(n).toString(16).padStart(2,"0")).join("")}`:"#ffffff"}function dt(e){if(typeof document>"u")return;let a=document.createElement("span");if(a.style.color=e,!a.style.color)return;a.style.position="absolute",a.style.visibility="hidden",document.body.appendChild(a);let t=getComputedStyle(a).color;return a.remove(),t}function Te(e){let a=e.trim(),t=a.match(/^#([0-9a-f]{3})$/i);if(t)return`#${t[1].split("").map(o=>`${o}${o}`).join("")}`.toUpperCase();if(/^#[0-9a-f]{6}$/i.test(a))return a.toUpperCase()}function ka(e){let t=(Te(e)??"#FFFFFF").slice(1);return{r:Number.parseInt(t.slice(0,2),16),g:Number.parseInt(t.slice(2,4),16),b:Number.parseInt(t.slice(4,6),16)}}function uo({r:e,g:a,b:t}){let o=e/255,r=a/255,n=t/255,i=Math.max(o,r,n),c=Math.min(o,r,n),f=i-c,I=0;return f!==0&&(i===o?I=(r-n)/f%6:i===r?I=(n-o)/f+2:I=(o-r)/f+4),I=Math.round(I*60),I<0&&(I+=360),{h:I,s:i===0?0:J(f/i*100),v:J(i*100)}}function fo({r:e,g:a,b:t}){let o=e/255,r=a/255,n=t/255,i=Math.max(o,r,n),c=Math.min(o,r,n),f=(i+c)/2,I=i-c;if(I===0)return{h:0,s:0,l:Math.round(f*100)};let S=I/(1-Math.abs(2*f-1)),v=0;return i===o?v=(r-n)/I%6:i===r?v=(n-o)/I+2:v=(o-r)/I+4,v=Math.round(v*60),v<0&&(v+=360),{h:v,s:Math.round(S*100),l:Math.round(f*100)}}function ta(e,a,t){let o=t/100*(a/100),r=o*(1-Math.abs(e/60%2-1)),n=t/100-o,i=Math.floor(e/60)%6;return`#${([[o,r,0],[r,o,0],[0,o,r],[0,r,o],[r,0,o],[o,0,r]][i]??[o,0,r]).map(f=>Math.round((f+n)*255).toString(16).padStart(2,"0")).join("")}`.toUpperCase()}function sa(e){return(e??"").replace(/\s+/g," ").trim()}function Ze(e){return e.split(",")[0]?.replace(/^["']|["']$/g,"").trim()}function io(e){let a=[],t=new Set,o=r=>{let n=Ze(r.value)?.toLowerCase()??r.label.toLowerCase();t.has(n)||(t.add(n),a.push(r))};for(let r of Ht)o(r);if(e&&!a.some(r=>ua(e,r.value))){let r=Ze(e);r&&a.unshift({label:r,value:e})}return a}function no(e,a){return a.find(t=>ua(e,t.value))}function ua(e,a){let t=Ze(e)?.toLowerCase(),o=Ze(a)?.toLowerCase();return t&&o&&t===o?!0:sa(e)===sa(a)}function et(e){let a=e.trim();if(a&&qe("color",a))return a}function at(e){return Te(e)??e}function tt(e){let a=e.trim();if(!a.toLowerCase().startsWith("linear-gradient(")||!a.endsWith(")"))return;let t=a.slice(a.indexOf("(")+1,-1),o=co(t);if(!(o.length<3))return{start:o[1].trim(),end:o.slice(2).join(", ").trim()}}function Ia(e){let a=e.trim();if(!a.toLowerCase().startsWith("url(")||!a.endsWith(")"))return;let t=a.slice(a.indexOf("(")+1,-1).trim(),o=t[0];return(o==='"'||o==="'")&&t.endsWith(o)&&(t=t.slice(1,-1)),t.replace(/\\(["'\\])/g,"$1")}function co(e){let a=[],t="",o=0,r;for(let n=0;n<e.length;n+=1){let i=e[n],c=e[n-1];if(r){t+=i,i===r&&c!=="\\"&&(r=void 0);continue}if(i==='"'||i==="'"){r=i,t+=i;continue}if(i==="("&&(o+=1),i===")"&&(o=Math.max(0,o-1)),i===","&&o===0){a.push(t.trim()),t="";continue}t+=i}return t.trim()&&a.push(t.trim()),a}function Ae(e){let a=e.trim().toLowerCase();return a.startsWith("hsl")?"HSL":a.startsWith("rgba")?"RGBA":a.startsWith("rgb")?"RGB":"Hex"}function po(e,a,t){let o=(Te(e)??Be(e)).toUpperCase(),{r,g:n,b:i}=ka(o);if(t==="RGB")return`rgb(${r}, ${n}, ${i})`;if(t==="RGBA")return ft(o,a);if(t==="HSL"){let{h:c,s:f,l:I}=fo({r,g:n,b:i});return a<1?`hsl(${c} ${f}% ${I}% / ${pe(a)})`:`hsl(${c} ${f}% ${I}%)`}return o}function mo(e){let t=(dt(e)??e).match(/rgba?\([^,]+,\s*[^,]+,\s*[^,]+(?:,\s*([^)]+))?\)/i);if(!t?.[1])return 1;let o=Number.parseFloat(t[1]);return Number.isFinite(o)?Y(o,0,1):1}function ft(e,a){let{r:t,g:o,b:r}=ka(e);return`rgba(${t}, ${o}, ${r}, ${pe(a)})`}function oa(e,a){return`linear-gradient(135deg, ${e}, ${a})`}function Fe(e){return`url("${e.trim().replace(/["\\]/g,"\\$&")}")`}function ho(e){return e.startsWith("linear-gradient(")||e.startsWith("url(")}function da(e,a,t,o=a.unit){let r=e.trim();if(!r)return;let i=wo(r,t)??bo(r,a,o);if(qe(a.cssProperty,i))return i}function qe(e,a){return typeof CSS>"u"||typeof CSS.supports!="function"?!0:CSS.supports(e,a)}function Lo(e){return/^-?(?:\d+|\d*\.\d+)(px|rem|em)(px|rem|em)$/i.test(e.trim())}function xo(e){let a=[];qe(e.cssProperty,"1")&&a.push("");for(let t of qt)qe(e.cssProperty,`1${t}`)&&a.push(t);return a}function go(e,a,t,o,r){let n=da(e,t,o,r);if(!n)return;let i=Io(n);if(!i)return;if(i.unit===a)return n;let c=Co(i.value,i.unit,t,o);if(c===void 0)return;let f=So(c,a,t,o);if(f===void 0)return;let I=a?`${pe(J(f))}${a}`:pe(J(f));return qe(t.cssProperty,I)?I:void 0}function Io(e){let a=e.trim().match(/^(-?(?:\d+|\d*\.\d+))([a-z%]*)$/i);if(!a)return;let t=Number(a[1]);if(Number.isFinite(t))return{value:t,unit:a[2].toLowerCase()}}function Co(e,a,t,o){if(!a)return t.cssProperty==="line-height"?e*it(o):t.cssProperty==="opacity"?e:void 0;let r=je(a,o,t);return r===void 0?void 0:e*r}function So(e,a,t,o){if(!a)return t.cssProperty==="line-height"?e/it(o):t.cssProperty==="opacity"?e:void 0;let r=je(a,o,t);return r===void 0||r===0?void 0:e/r}function wo(e,a){let t=e.match(/^(-?(?:\d+|\d*\.\d+))(px|rem|em)(px|rem|em)$/i);if(!t)return;let o=Number(t[1]),r=t[2].toLowerCase(),n=t[3].toLowerCase();if(!Number.isFinite(o)||r===n)return;let i=je(r,a),c=je(n,a);if(!i||!c)return;let I=o*i/c;return`${pe(J(I))}${n}`}function bo(e,a,t){return!ko(e)||!t||qe(a.cssProperty,e)&&a.unit===""?e:`${e}${t}`}function ko(e){return/^-?(?:\d+|\d*\.\d+)$/.test(e)}function yo(e,a){return e.trim().match(/(-?(?:\d+|\d*\.\d+))([a-z%]+)$/i)?.[2]??a.unit}function ra(e){return e==="ArrowUp"||e==="ArrowRight"||e==="ArrowDown"||e==="ArrowLeft"}function Ca(e){return e==="ArrowUp"||e==="ArrowRight"}function Po(e,a,t,o,r,n){let i=e.trim().match(/^(-?(?:\d+|\d*\.\d+))([a-z%]*)$/i);if(!i)return;let c=Number(i[1]);if(!Number.isFinite(c))return;let f=i[2]||o,I=J(c+(n?r:-r)),S=f?`${pe(I)}${f}`:pe(I);return da(S,a,t,f)}function je(e,a,t){if(e==="px")return 1;if(e==="rem"){let o=parseFloat(getComputedStyle(document.documentElement).fontSize);return Number.isFinite(o)&&o>0?o:16}if(e==="em"){let o=t?.cssProperty==="font-size"?a.parentElement??a:a,r=parseFloat(getComputedStyle(o).fontSize);return Number.isFinite(r)&&r>0?r:je("rem",a)}}function it(e){let a=parseFloat(getComputedStyle(e).fontSize);return Number.isFinite(a)&&a>0?a:16}function Y(e,a,t){return Math.min(t,Math.max(a,e))}function vo(e,a,t){return t<=a?0:Y((e-a)/(t-a)*100,0,100)}function Mo(e,a,t){let o=a.width>0?Y((e-a.left)/a.width,0,1):0,r=t.min+o*(t.max-t.min);return Ao(r,t.step,t.min)}function Ao(e,a,t){if(a<=0)return e;let o=Math.round((e-t)/a)*a+t,r=String(a).includes(".")?String(a).split(".")[1].length:0;return Number(o.toFixed(r))}function J(e){return Math.round(e*100)/100}function pe(e){return Number.isInteger(e)?String(e):e.toFixed(2)}export{Sr as Chisel,Cr as EditableRegion};
|
|
169
6
|
/*! Bundled license information:
|
|
170
7
|
|
|
171
8
|
lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
function
|
|
1
|
+
function c(t){return{version:1,content:t.split(`
|
|
2
2
|
`).map(e=>({type:"paragraph",children:[{text:e}]}))}}function a(t){return t.content.map(e=>e.children.map(i=>"type"in i?i.text||i.url:i.text).join("")).join(`
|
|
3
|
-
`)}function
|
|
3
|
+
`)}function l(t){let e=t.content.slice();for(;e.length;){let i=e[e.length-1],n=i.children.slice();for(;n.length;){let o=n[n.length-1],m="type"in o?o.text||o.url:o.text,r=m.trimEnd();if(r)return n[n.length-1]=r===m?o:{...o,text:r},e[e.length-1]={...i,children:n},{...t,content:e};n.pop()}e.pop()}return c("")}var d=5242880,x=20971520,p=["image/jpeg","image/png","image/gif","image/webp","image/avif","image/bmp"],s=["video/mp4","video/webm","video/quicktime"],y=[...p,...s].join(",");function u(t){let e=p.includes(t.type);return!e&&!s.includes(t.type)?"Choose a JPG, PNG, GIF, WebP, AVIF, BMP, MP4, WebM, or MOV file.":!Number.isSafeInteger(t.size)||t.size<=0?"This file is empty or invalid.":t.size>(e?5242880:20971520)?`${e?"Images must be 5 MB":"Videos must be 20 MB"} or smaller.`:null}export{a as bodyText,c as commentBody,d as imageLimit,p as imageTypes,y as mediaAccept,u as mediaFileError,l as trimCommentBody,x as videoLimit,s as videoTypes};
|