efficient-shell 15.6.0 → 15.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +11 -5
  2. package/dist/{Browser-MBT76EKF.js → Browser-5QLDJ74Z.js} +13 -13
  3. package/dist/Calculator-6WNTZLWL.js +29 -0
  4. package/dist/{CurrencyConverter-UAZYLLHT.js → CurrencyConverter-C4KCZWUM.js} +10 -10
  5. package/dist/{Files-G5VBN3GD.js → Files-VFRXPQLV.js} +46 -46
  6. package/dist/{Notepad-23YBRLDH.js → Notepad-S5JMXH2O.js} +9 -9
  7. package/dist/PomodoroTimer-BGTCWT53.js +91 -0
  8. package/dist/{Preview-4VKAQ4TY.js → Preview-HTFTEL7K.js} +19 -19
  9. package/dist/{Stock-6YYK6VWP.js → Stock-LIOPTQG5.js} +6 -6
  10. package/dist/{Weather-2OU3LEWQ.js → Weather-K3BVAFRV.js} +18 -18
  11. package/dist/{WorldClock-PYJ4762U.js → WorldClock-RHAHXLW4.js} +6 -6
  12. package/dist/ai/index.js +8 -8
  13. package/dist/apps/ImageAnnotator.js +1 -1
  14. package/dist/apps/index.js +1 -1
  15. package/dist/bin/browser-check.js +1 -1
  16. package/dist/bin/media-host-check.js +1 -1
  17. package/dist/bin/ui-check.js +1 -1
  18. package/dist/brand.css +1 -1
  19. package/dist/chunk-3AUPCKBR.js +1 -0
  20. package/dist/chunk-6FOLK4HD.js +1 -0
  21. package/dist/{chunk-6ZNJ6JU5.js → chunk-E4WVF6AS.js} +6 -6
  22. package/dist/{chunk-OQAGCYR7.js → chunk-EA423N2F.js} +3 -3
  23. package/dist/chunk-GD5NGS6D.js +89 -0
  24. package/dist/chunk-GZ4AMXEU.js +1 -0
  25. package/dist/{chunk-N3T5BE2T.js → chunk-OHPDB4UN.js} +4 -4
  26. package/dist/{chunk-3C2VY2VF.js → chunk-RRWQBWLW.js} +1 -1
  27. package/dist/chunk-WGDVYCQX.js +69 -0
  28. package/dist/{chunk-OZNCUWYB.js → chunk-XZKVGJIB.js} +1 -1
  29. package/dist/{chunk-NICH2O4C.js → chunk-YFVQKS5U.js} +1 -1
  30. package/dist/chunk-ZLB5GRL6.js +1 -0
  31. package/dist/format/index.d.ts +15 -1
  32. package/dist/format/index.js +1 -1
  33. package/dist/forms/LinkPicker.js +1 -1
  34. package/dist/forms/MediaLibrary.js +1 -1
  35. package/dist/hooks/index.d.ts +42 -1
  36. package/dist/hooks/index.js +1 -1
  37. package/dist/icons/index.js +1 -1
  38. package/dist/index.d.ts +117 -75
  39. package/dist/index.js +662 -662
  40. package/dist/motion.css +9 -4
  41. package/dist/routine-index.json +1 -1
  42. package/dist/shell/LanguageSelect.js +1 -1
  43. package/dist/telemetry/index.js +1 -1
  44. package/dist/ui/index.js +1 -1
  45. package/dist/value-index.json +1 -1
  46. package/dist/version.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/Calculator-PAMITD4N.js +0 -29
  49. package/dist/PomodoroTimer-QFF2FTAG.js +0 -91
  50. package/dist/chunk-IN36HWJK.js +0 -1
  51. package/dist/chunk-TDUOBP55.js +0 -69
  52. package/dist/chunk-XRWUNOI3.js +0 -92
@@ -0,0 +1,69 @@
1
+ import{useUndoableState as e}from"./chunk-GZ4AMXEU.js";import{fitBoxScale as t}from"./chunk-M6UKCZHT.js";import{UndoContext as r}from"./chunk-3AUPCKBR.js";import{toast_default as n}from"./chunk-I2NVBDKH.js";import{useShellStrings as o}from"./chunk-NRHG4R2Q.js";import{forwardRef as i,useRef as a,useState as l,useContext as s,useMemo as c,useEffect as d,useImperativeHandle as h}from"react";import{jsx as u,jsxs as p,Fragment as y}from"react/jsx-runtime";var x=["#ef4444","#f97316","#eab308","#22c55e","#3b82f6","#8b5cf6","#000000","#ffffff"],m=[{id:"system",name:"fontSystem",css:"-apple-system, system-ui, sans-serif"},{id:"serif",name:"fontSerif",css:'Georgia, "Times New Roman", serif'},{id:"mono",name:"fontMono",css:'ui-monospace, "SF Mono", Menlo, monospace'},{id:"cursive",name:"fontCursive",css:'"Brush Script MT", "Comic Sans MS", cursive'}],g=()=>Math.random().toString(36).slice(2,9),w=i(function({src:i,filename:w,onApply:b,onCancel:v},D){const $=a(null),E=a(null),I=a(null),S=a(null),W=o().annotator,B=a(W);B.current=W;const[R,j]=l("select"),[H,U]=l(x[0]),[T,F]=l(4),[A,O]=l(24),[K,V]=l(m[0].id),[Z,G]=l(!0),[X,q]=l(!1),[Y,_]=l(!1),[Q,J]=l(null),[ee,te]=l(null),[re,ne]=l(6),[oe,ie]=l(12),[ae,le]=l(null),[se,ce]=l(null),[de,he]=l(null),[ue,pe]=l(1),[ye,xe]=l(null),[me,ge]=l(null),[we,fe]=l(null),be=a(0),ve=a(!1),[ke,Me]=e([],{label:"annotation",coalesceKey:ve.current?`drag-${be.current}`:null}),Ne=s(r),Ce=a(null),[Le,ze]=l(!1),De=c(()=>de?{w:de.w*ue,h:de.h*ue}:null,[de,ue]),Pe=De&&se?De.w/se.w:1,$e=c(()=>ke.find(e=>e.id===ae)??null,[ke,ae]);d(()=>{"select"===R&&$e&&("color"in $e&&U($e.color),"stroke"in $e&&F($e.stroke),"rect"===$e.type&&ie($e.radius),"text"===$e.type&&(O($e.size),V($e.font),G($e.bold),q($e.italic),_($e.underline),J($e.borderColor),te($e.background),ne($e.padding)))},[ae]),d(()=>{const e=new Image;e.crossOrigin="anonymous",e.onload=()=>{S.current=e,ce({w:e.naturalWidth,h:e.naturalHeight}),Ne?.baseline(),Me([]),le(null)},e.onerror=()=>n.error(B.current.loadFailed),e.src=i},[i]),d(()=>{if(!se)return;const e=()=>{const e=$.current;if(!e)return;const r=e.getBoundingClientRect(),n=Math.max(0,r.width-32),o=Math.max(0,r.height-32);if(0===n||0===o)return;const i=t({width:n,height:o},{width:se.w,height:se.h},1);he({w:se.w*i,h:se.h*i})};e();const r=new ResizeObserver(e);return $.current&&r.observe($.current),()=>r.disconnect()},[se]);const Ee=c(()=>ke.filter(e=>"mosaic"===e.type),[ke]);d(()=>{const e=S.current,t=E.current;if(!e||!t||!se)return;t.width=se.w,t.height=se.h;const r=t.getContext("2d");r.drawImage(e,0,0);for(const e of Ee)P(r,e)},[se,Ee,de]);const Ie=e=>{const t=I.current;if(!t)return{x:0,y:0};const r=t.createSVGPoint();r.x=e.clientX,r.y=e.clientY;const n=t.getScreenCTM();if(!n)return{x:0,y:0};const o=r.matrixTransform(n.inverse());return{x:o.x,y:o.y}},Se=e=>{be.current+=1,ve.current=!0,Ce.current=e,ze(!0)};d(()=>{if(!Le)return;const e=e=>{const t=Ce.current;if(!t)return;const r=Ie(e);if("draw"===t.kind)xe(N(R,t.start,r,H,T,oe));else if("pen"===t.kind){const e=t.points[t.points.length-1];(Math.abs(r.x-e.x)>1||Math.abs(r.y-e.y)>1)&&(t.points.push(r),xe({id:"",type:"draw",points:t.points.slice(),color:H,stroke:T}))}else if("crop"===t.kind)fe(z(t.start,r));else if("move"===t.kind){const e=r.x-t.start.x,n=r.y-t.start.y;Me(r=>r.map(r=>r.id===t.id?C(t.original,e,n):r))}else"resize"===t.kind&&Me(e=>e.map(e=>e.id===t.id?function(e,t,r){if("arrow"===e.type)return"start"===t?{...e,x1:r.x,y1:r.y}:"end"===t?{...e,x2:r.x,y2:r.y}:e;if("text"===e.type||"draw"===e.type)return e;const n=e.x,o=e.x+e.w,i=e.y,a=e.y+e.h;let l=n,s=i,c=o,d=a;"nw"===t&&(l=r.x,s=r.y);"ne"===t&&(c=r.x,s=r.y);"se"===t&&(c=r.x,d=r.y);"sw"===t&&(l=r.x,d=r.y);const h=z({x:l,y:s},{x:c,y:d});return{...e,x:h.x,y:h.y,w:h.w,h:h.h}}(t.original,t.corner,r):e))},t=()=>{const e=Ce.current;if(Ce.current=null,ve.current=!1,ze(!1),"draw"===e?.kind)xe(e=>{if(!e||("arrow"===(t=e).type?Math.abs(t.x2-t.x1)<4&&Math.abs(t.y2-t.y1)<4:"draw"===t.type?t.points.length<2:"w"in t&&"h"in t&&(t.w<4||t.h<4)))return null;var t;const r={...e,id:g()};return Me(e=>[...e,r]),le(r.id),j("select"),null});else if("pen"===e?.kind){if(e.points.length<2)return void xe(null);const t={id:g(),type:"draw",points:e.points,color:H,stroke:T};Me(e=>[...e,t]),le(t.id),j("select"),xe(null)}};return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[Le,R,H,T,oe]);d(()=>{const e=e=>{document.activeElement&&/^(INPUT|TEXTAREA)$/.test(document.activeElement.tagName)||ae&&("Delete"===e.key||"Backspace"===e.key?(e.preventDefault(),Me(e=>e.filter(e=>e.id!==ae)),le(null)):"Escape"===e.key&&le(null))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ae]);const We=e=>{const t=!{bold:Z,italic:X,underline:Y}[e];"bold"===e&&G(t),"italic"===e&&q(t),"underline"===e&&_(t),ae&&Me(r=>r.map(r=>r.id===ae&&"text"===r.type?{...r,[e]:t}:r))},Be=e=>{J(e),ae&&Me(t=>t.map(t=>t.id===ae&&"text"===t.type?{...t,borderColor:e}:t))},Re=e=>{te(e),ae&&Me(t=>t.map(t=>t.id===ae&&"text"===t.type?{...t,background:e}:t))},je=e=>{if(!me)return;const t=e??me.value;if(!t.trim())return me.editingId&&Me(e=>e.filter(e=>e.id!==me.editingId)),void ge(null);if(me.editingId)Me(e=>e.map(e=>e.id===me.editingId&&"text"===e.type?{...e,text:t}:e));else{const e={id:g(),type:"text",x:me.x,y:me.y,text:t,color:H,size:A,font:K,bold:Z,italic:X,underline:Y,borderColor:Q,background:ee,padding:re};Me(t=>[...t,e]),le(e.id),j("select")}ge(null)},He=async()=>{const e=E.current,t=I.current;if(!e||!t||!se)return null;const r=document.createElement("canvas");r.width=se.w,r.height=se.h;const n=r.getContext("2d");n.drawImage(e,0,0);const o=t.cloneNode(!0);o.querySelectorAll("[data-chrome]").forEach(e=>e.remove());const i=(new XMLSerializer).serializeToString(o),a=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(a),s=new Image;return await new Promise(e=>{s.onload=()=>e(),s.onerror=()=>e(),s.src=l}),n.drawImage(s,0,0,se.w,se.h),URL.revokeObjectURL(l),r};h(D,()=>({save:async()=>{const e=await He();e&&e.toBlob(e=>{if(!e)return void n.error(B.current.exportFailed);const t=URL.createObjectURL(e),r=document.createElement("a");r.href=t;const o=w.replace(/\.[^.]+$/,"");r.download=`${o}-annotated.png`,r.click(),URL.revokeObjectURL(t)},"image/png")},copy:async()=>{if(!("clipboard"in navigator)||"undefined"==typeof ClipboardItem)return void n.error(B.current.clipboardUnsupported);const e=await He();e&&e.toBlob(async e=>{if(e)try{await navigator.clipboard.write([new ClipboardItem({"image/png":e})]),n.success(B.current.copied)}catch{n.error(B.current.copyRefused)}else n.error(B.current.copyFailed)},"image/png")}}),[se,w]);const Ue=c(()=>[{id:"select",label:W.toolSelect,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3l7 17 2-7 7-2L5 3z"})})},{id:"draw",label:W.toolDraw,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L6.832 19.82a4.5 4.5 0 01-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 011.13-1.897L16.863 4.487z"})})},{id:"rect",label:W.toolRect,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("rect",{x:"4",y:"6",width:"16",height:"12",rx:"3"})})},{id:"circle",label:W.toolEllipse,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("ellipse",{cx:"12",cy:"12",rx:"8",ry:"6"})})},{id:"arrow",label:W.toolArrow,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 19L19 5m0 0h-7m7 0v7"})})},{id:"mosaic",label:W.toolMosaic,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4h6v6H4zM14 4h6v6h-6zM4 14h6v6H4zM14 14h6v6h-6z"})})},{id:"text",label:W.toolText,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M12 6v14M9 20h6"})})},{id:"crop",label:W.toolCrop,icon:/* @__PURE__ */u("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:/* @__PURE__ */u("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 2v15a1 1 0 001 1h15M2 6h15a1 1 0 011 1v15"})})}],[W]),Te=e=>"p-2 rounded transition-colors "+(e?"bg-blue-500 text-on-accent":"text-ink hover:bg-gray-200"),Fe=$e?.type??("select"===R?null:R),Ae="rect"===Fe||"circle"===Fe||"arrow"===Fe||"draw"===Fe,Oe="rect"===Fe,Ke="text"===Fe;/* @__PURE__ */
2
+ return p("div",{className:"flex flex-col h-full bg-gray-100",children:[
3
+ /* @__PURE__ */p("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-line bg-surface shrink-0 flex-wrap text-xs",children:[Ue.map(e=>/* @__PURE__ */u("button",{onClick:()=>{j(e.id),le(null)},title:e.label,className:Te(R===e.id),children:e.icon},e.id)),
4
+ /* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
5
+ /* @__PURE__ */u("div",{className:"flex items-center gap-1",children:x.map(e=>/* @__PURE__ */u("button",{onClick:()=>(e=>{U(e),ae&&Me(t=>t.map(t=>t.id!==ae||"mosaic"===t.type?t:{...t,color:e}))})(e),title:e,className:"h-5 w-5 rounded-full border "+(H===e?"ring-2 ring-blue-500 ring-offset-1":"border-gray-300"),style:{background:e}},e))}),Ae&&/* @__PURE__ */p(y,{children:[
6
+ /* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
7
+ /* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
8
+ /* @__PURE__ */u("span",{children:W.weight}),
9
+ /* @__PURE__ */u("input",{type:"range",min:1,max:20,step:1,value:T,onChange:e=>{return t=Number(e.target.value),F(t),void(ae&&Me(e=>e.map(e=>e.id!==ae?e:"rect"===e.type||"circle"===e.type||"arrow"===e.type||"draw"===e.type?{...e,stroke:t}:e)));var t},className:"w-16 accent-blue-500"}),
10
+ /* @__PURE__ */u("span",{className:"tabular-nums w-5 text-right",children:T})]})]}),Oe&&/* @__PURE__ */p(y,{children:[
11
+ /* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
12
+ /* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
13
+ /* @__PURE__ */u("span",{children:W.radius}),
14
+ /* @__PURE__ */u("input",{type:"range",min:0,max:48,step:1,value:oe,onChange:e=>{return t=Number(e.target.value),ie(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"rect"===e.type?{...e,radius:t}:e)));var t},className:"w-16 accent-blue-500"}),
15
+ /* @__PURE__ */u("span",{className:"tabular-nums w-6 text-right",children:oe})]})]}),Ke&&/* @__PURE__ */p(y,{children:[
16
+ /* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
17
+ /* @__PURE__ */u("select",{value:K,onChange:e=>{return t=e.target.value,V(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"text"===e.type?{...e,font:t}:e)));var t},className:"text-xs border border-gray-300 rounded px-1 py-0.5 bg-white",children:m.map(e=>/* @__PURE__ */u("option",{value:e.id,children:W[e.name]},e.id))}),
18
+ /* @__PURE__ */u("button",{onClick:()=>We("bold"),className:Te(Z),title:W.bold,children:/* @__PURE__ */u("span",{className:"font-bold",children:W.boldLetter})}),
19
+ /* @__PURE__ */u("button",{onClick:()=>We("italic"),className:Te(X),title:W.italic,children:/* @__PURE__ */u("span",{className:"italic",children:W.italicLetter})}),
20
+ /* @__PURE__ */u("button",{onClick:()=>We("underline"),className:Te(Y),title:W.underline,children:/* @__PURE__ */u("span",{className:"underline",children:W.underlineLetter})}),
21
+ /* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
22
+ /* @__PURE__ */u("span",{children:W.size}),
23
+ /* @__PURE__ */u("input",{type:"range",min:10,max:96,step:1,value:A,onChange:e=>{return t=Number(e.target.value),O(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"text"===e.type?{...e,size:t}:e)));var t},className:"w-16 accent-blue-500"}),
24
+ /* @__PURE__ */u("span",{className:"tabular-nums w-7 text-right",children:A})]}),
25
+ /* @__PURE__ */p("label",{className:"flex items-center gap-1 text-gray-600",children:[
26
+ /* @__PURE__ */u("span",{children:W.border}),Q?/* @__PURE__ */p(y,{children:[
27
+ /* @__PURE__ */u("input",{type:"color",value:Q,onChange:e=>Be(e.target.value),title:W.borderColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
28
+ /* @__PURE__ */u("button",{onClick:()=>Be(null),title:W.removeBorder,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */u("button",{onClick:()=>Be(H),title:W.addBorder,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:W.add})]}),
29
+ /* @__PURE__ */p("label",{className:"flex items-center gap-1 text-gray-600",children:[
30
+ /* @__PURE__ */u("span",{children:W.fill}),ee?/* @__PURE__ */p(y,{children:[
31
+ /* @__PURE__ */u("input",{type:"color",value:ee,onChange:e=>Re(e.target.value),title:W.fillColor,className:"h-5 w-6 rounded border border-gray-300 bg-white p-0 cursor-pointer"}),
32
+ /* @__PURE__ */u("button",{onClick:()=>Re(null),title:W.removeFill,className:"px-0.5 text-gray-400 hover:text-gray-700",children:"✕"})]}):/* @__PURE__ */u("button",{onClick:()=>Re("#ffffff"),title:W.addFill,className:"px-2 py-0.5 rounded border border-line-strong text-gray-600 hover:bg-gray-100",children:W.add})]}),
33
+ /* @__PURE__ */p("label",{className:"flex items-center gap-2 text-gray-600",children:[
34
+ /* @__PURE__ */u("span",{children:W.padding}),
35
+ /* @__PURE__ */u("input",{type:"range",min:0,max:40,step:1,value:re,onChange:e=>{return t=Number(e.target.value),ne(t),void(ae&&Me(e=>e.map(e=>e.id===ae&&"text"===e.type?{...e,padding:t}:e)));var t},className:"w-14 accent-blue-500"}),
36
+ /* @__PURE__ */u("span",{className:"tabular-nums w-6 text-right",children:re})]})]}),
37
+ /* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
38
+ /* @__PURE__ */u("button",{onClick:()=>pe(e=>Math.max(.25,Math.round(100*(e-.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:W.zoomOut,children:"−"}),
39
+ /* @__PURE__ */p("span",{className:"text-gray-600 tabular-nums w-10 text-center",children:[Math.round(100*ue),"%"]}),
40
+ /* @__PURE__ */u("button",{onClick:()=>pe(e=>Math.min(4,Math.round(100*(e+.25))/100)),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:W.zoomIn,children:"+"}),
41
+ /* @__PURE__ */u("button",{onClick:()=>pe(1),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",title:W.fitHint,children:W.fit}),
42
+ /* @__PURE__ */u("div",{className:"h-5 w-px bg-gray-300 mx-1"}),
43
+ /* @__PURE__ */u("button",{onClick:()=>{Me(e=>e.slice(0,-1)),le(null)},disabled:0===ke.length,className:"px-2 py-1 rounded hover:bg-gray-200 disabled:opacity-30 text-gray-700",children:W.undo}),
44
+ /* @__PURE__ */p("div",{className:"ml-auto flex items-center gap-2",children:[we&&/* @__PURE__ */p(y,{children:[
45
+ /* @__PURE__ */u("button",{onClick:()=>{if(!we||!S.current||!se)return;const e=we,t=document.createElement("canvas");t.width=Math.round(e.w),t.height=Math.round(e.h);const r=t.getContext("2d"),n=document.createElement("canvas");n.width=se.w,n.height=se.h;const o=n.getContext("2d");o.drawImage(S.current,0,0);for(const e of Ee)P(o,e);r.drawImage(n,e.x,e.y,e.w,e.h,0,0,e.w,e.h);const i=new Image;i.onload=()=>{S.current=i,ce({w:i.naturalWidth,h:i.naturalHeight}),Me(t=>t.filter(e=>"mosaic"!==e.type).map(t=>C(t,-e.x,-e.y)).filter(e=>function(e,t,r){const n=L(e);return n.x+n.w>0&&n.y+n.h>0&&n.x<t&&n.y<r}(e,i.naturalWidth,i.naturalHeight))),fe(null)},i.src=t.toDataURL("image/png")},className:"px-2 py-1 rounded bg-blue-500 text-white hover:bg-blue-600",children:W.applyCrop}),
46
+ /* @__PURE__ */u("button",{onClick:()=>fe(null),className:"px-2 py-1 rounded hover:bg-gray-200 text-gray-700",children:W.cancel})]}),b&&!we&&/* @__PURE__ */p(y,{children:[v&&/* @__PURE__ */u("button",{onClick:v,className:"px-3 py-1 rounded hover:bg-gray-200 text-gray-700 text-xs font-medium",children:W.cancel}),
47
+ /* @__PURE__ */u("button",{onClick:async()=>{const e=await He();e?e.toBlob(e=>{e?b(e):n.error(B.current.exportFailed)},"image/png"):n.error(B.current.exportFailed)},className:"px-3 py-1 rounded bg-blue-500 text-white hover:bg-blue-600 text-xs font-medium",children:W.apply})]})]})]}),
48
+ /* @__PURE__ */u("div",{ref:$,className:"flex-1 overflow-auto bg-gray-200 flex items-center justify-center p-4 relative",children:De&&se&&/* @__PURE__ */p("div",{className:"relative shadow-lg rounded overflow-hidden bg-white shrink-0",style:{width:De.w,height:De.h},children:[
49
+ /* @__PURE__ */u("canvas",{ref:E,style:{position:"absolute",inset:0,width:"100%",height:"100%",display:"block"}}),
50
+ /* @__PURE__ */p("svg",{ref:I,viewBox:`0 0 ${se.w} ${se.h}`,preserveAspectRatio:"none",style:{position:"absolute",inset:0,width:"100%",height:"100%",touchAction:"none",cursor:"select"===R?"default":"text"===R?"text":"crosshair"},onPointerDown:e=>{if("select"===R)return void le(null);if("text"===R){if(me)return void je();const t=Ie(e);return void ge({x:t.x,y:t.y,value:""})}const t=Ie(e);if("crop"!==R){if("draw"===R)return Se({kind:"pen",points:[t]}),void xe({id:"",type:"draw",points:[t],color:H,stroke:T});xe(N(R,t,t,H,T,oe)),Se({kind:"draw",start:t})}else Se({kind:"crop",start:t})},children:[ke.map(e=>/* @__PURE__ */u(f,{anno:e,selected:ae===e.id,zoom:ue,onPointerDown:t=>((e,t)=>{"select"===R&&(e.stopPropagation(),le(t.id),Se({kind:"move",id:t.id,start:Ie(e),original:t}))})(t,e),onDoubleClick:()=>{var t;"text"===(t=e).type&&ge({x:t.x,y:t.y,value:t.text,editingId:t.id})},onHandlePointerDown:(t,r)=>((e,t,r)=>{e.stopPropagation(),Se({kind:"resize",id:t.id,corner:r,start:Ie(e),original:t})})(t,e,r)},e.id)),ye&&/* @__PURE__ */u(f,{anno:{...ye,id:"__preview"},preview:!0}),we&&/* @__PURE__ */u(k,{rect:we,imageSize:se})]}),me&&/* @__PURE__ */u(M,{pendingText:me,color:H,size:A,font:m.find(e=>e.id===K)?.css??m[0].css,bold:Z,italic:X,underline:Y,borderColor:Q,background:ee,padding:re,scale:Pe,onChange:e=>ge({...me,value:e}),onCommit:je,onCancel:()=>ge(null)})]})}),
51
+ /* @__PURE__ */u("div",{className:"px-3 py-2 border-t border-line bg-surface text-2xs text-ink-faint shrink-0",children:"select"===R?ae?W.hintSelected:W.hintSelect:"text"===R?W.hintText:"crop"===R?W.hintCrop:"draw"===R?W.hintDraw:W.hintShape})]})});function f({anno:e,selected:t,preview:r,zoom:n=1,onPointerDown:o,onDoubleClick:i,onHandlePointerDown:a}){const l=L(e),s=o?{onPointerDown:o,pointerEvents:"all",style:{cursor:"move"}}:{},c=i?{onDoubleClick:i}:{};let d;if("rect"===e.type)d=/* @__PURE__ */u("rect",{x:e.x,y:e.y,width:e.w,height:e.h,rx:e.radius,ry:e.radius,fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("circle"===e.type)d=/* @__PURE__ */u("ellipse",{cx:e.x+e.w/2,cy:e.y+e.h/2,rx:e.w/2,ry:e.h/2,fill:"none",stroke:e.color,strokeWidth:e.stroke,...s});else if("arrow"===e.type)d=/* @__PURE__ */u(v,{anno:e,interactive:s});else if("draw"===e.type)d=/* @__PURE__ */u("path",{d:D(e.points),fill:"none",stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round",strokeLinejoin:"round",...s});else if("mosaic"===e.type)d=/* @__PURE__ */u("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"rgba(0,0,0,0.001)",stroke:"none",strokeWidth:t?2:0,strokeDasharray:t?"6,4":void 0,...s,style:t?{...s.style,stroke:"var(--rosh-annotator-selection)"}:s.style});else{const t=m.find(t=>t.id===e.font)?.css??m[0].css,r=e.padding??0,n=!!e.borderColor||!!e.background,o=L(e),i=e.borderColor?Math.max(1,Math.round(e.size/12)):0;d=/* @__PURE__ */p("g",{...s,...c,children:[n&&/* @__PURE__ */u("rect",{x:o.x-r,y:o.y-r,width:Math.max(0,o.w)+2*r,height:Math.max(0,o.h)+2*r,rx:Math.min(8,r),ry:Math.min(8,r),fill:e.background??"none",stroke:e.borderColor??"none",strokeWidth:i}),
52
+ /* @__PURE__ */u("text",{x:e.x,y:e.y+e.size,fill:e.color,fontSize:e.size,fontWeight:e.bold?700:400,fontStyle:e.italic?"italic":"normal",textDecoration:e.underline?"underline":void 0,fontFamily:t,style:{userSelect:"none"},children:e.text.split("\n").map((t,r)=>/* @__PURE__ */u("tspan",{x:e.x,dy:0===r?0:1.2*e.size,children:t},r))})]})}/* @__PURE__ */
53
+ return p("g",{children:[d,t&&!r&&/* @__PURE__ */p(y,{children:[
54
+ /* @__PURE__ */u("rect",{"data-chrome":"selection",x:l.x-4,y:l.y-4,width:l.w+8,height:l.h+8,fill:"none",strokeWidth:2/n,strokeDasharray:`${6/n},${4/n}`,pointerEvents:"none",style:{stroke:"var(--rosh-annotator-selection)"}}),a&&/* @__PURE__ */u(b,{anno:e,zoom:n,onHandlePointerDown:a})]})]})}function b({anno:e,zoom:t,onHandlePointerDown:r}){const n=6/t,o=1.5/t,i=e=>({fill:"white",strokeWidth:o,pointerEvents:"all",style:{cursor:e,stroke:"var(--rosh-annotator-selection)"},"data-chrome":"handle"});if("arrow"===e.type)/* @__PURE__ */
55
+ return p(y,{children:[
56
+ /* @__PURE__ */u("circle",{cx:e.x1,cy:e.y1,r:n,...i("grab"),onPointerDown:e=>r(e,"start")}),
57
+ /* @__PURE__ */u("circle",{cx:e.x2,cy:e.y2,r:n,...i("grab"),onPointerDown:e=>r(e,"end")})]});if("text"===e.type||"draw"===e.type)return null;const a=e.x,l=e.y,s=e.w,c=e.h;/* @__PURE__ */
58
+ return p(y,{children:[
59
+ /* @__PURE__ */u("circle",{cx:a,cy:l,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"nw")}),
60
+ /* @__PURE__ */u("circle",{cx:a+s,cy:l,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"ne")}),
61
+ /* @__PURE__ */u("circle",{cx:a+s,cy:l+c,r:n,...i("nwse-resize"),onPointerDown:e=>r(e,"se")}),
62
+ /* @__PURE__ */u("circle",{cx:a,cy:l+c,r:n,...i("nesw-resize"),onPointerDown:e=>r(e,"sw")})]})}function v({anno:e,interactive:t}){const r=Math.max(12,4*e.stroke),n=Math.atan2(e.y2-e.y1,e.x2-e.x1),o=n+Math.PI-Math.PI/7,i=n+Math.PI+Math.PI/7,a=`M${e.x2},${e.y2} L${e.x2+r*Math.cos(o)},${e.y2+r*Math.sin(o)} L${e.x2+r*Math.cos(i)},${e.y2+r*Math.sin(i)} Z`;/* @__PURE__ */
63
+ return p("g",{...t,children:[
64
+ /* @__PURE__ */u("line",{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:e.color,strokeWidth:e.stroke,strokeLinecap:"round"}),
65
+ /* @__PURE__ */u("path",{d:a,fill:e.color})]})}function k({rect:e,imageSize:t}){/* @__PURE__ */
66
+ return p("g",{pointerEvents:"none",children:[
67
+ /* @__PURE__ */u("path",{d:`M0,0 H${t.w} V${t.h} H0 Z M${e.x},${e.y} V${e.y+e.h} H${e.x+e.w} V${e.y} Z`,fillRule:"evenodd",style:{fill:"var(--rosh-annotator-crop-scrim)"}}),
68
+ /* @__PURE__ */u("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:"none",stroke:"white",strokeWidth:2,strokeDasharray:"8,6"})]})}function M({pendingText:e,color:t,size:r,font:n,bold:i,italic:l,underline:s,borderColor:c,background:h,padding:p,scale:y,onChange:x,onCommit:m,onCancel:g}){const w=a(null),f=o().annotator;d(()=>{const e=requestAnimationFrame(()=>{w.current?.focus(),w.current?.select?.()});return()=>cancelAnimationFrame(e)},[]);const b=()=>m(w.current?.value),v=c?Math.max(1,Math.round(r/12)):0;/* @__PURE__ */
69
+ return u("div",{style:{position:"absolute",left:e.x*y+"px",top:e.y*y+"px",transform:"translateY(-2px)",zIndex:5},onPointerDown:e=>e.stopPropagation(),children:/* @__PURE__ */u("textarea",{ref:w,value:e.value,onChange:e=>x(e.target.value),onBlur:b,onKeyDown:e=>{"Escape"===e.key?(e.preventDefault(),g()):"Enter"!==e.key||e.shiftKey||(e.preventDefault(),b())},placeholder:f.textPlaceholder,rows:1,className:"rosh-focus-ring resize-none shadow-(--elevation-panel)",style:{color:t,fontSize:r*y+"px",fontFamily:n,fontWeight:i?700:400,fontStyle:l?"italic":"normal",textDecoration:s?"underline":void 0,minWidth:80,padding:p*y+"px",borderRadius:Math.min(8,p)*y+"px",border:c?`${v*y}px solid ${c}`:"1px dashed var(--rosh-annotator-edit-hint)",background:h??"var(--rosh-annotator-edit-surface)"}})})}function N(e,t,r,n,o,i){if("rect"===e){const e=z(t,r);return{id:"",type:"rect",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o,radius:i}}if("circle"===e){const e=z(t,r);return{id:"",type:"circle",x:e.x,y:e.y,w:e.w,h:e.h,color:n,stroke:o}}if("arrow"===e)return{id:"",type:"arrow",x1:t.x,y1:t.y,x2:r.x,y2:r.y,color:n,stroke:o};if("mosaic"===e){const e=z(t,r);return{id:"",type:"mosaic",x:e.x,y:e.y,w:e.w,h:e.h}}return null}function C(e,t,r){return"arrow"===e.type?{...e,x1:e.x1+t,y1:e.y1+r,x2:e.x2+t,y2:e.y2+r}:"draw"===e.type?{...e,points:e.points.map(e=>({x:e.x+t,y:e.y+r}))}:(e.type,{...e,x:e.x+t,y:e.y+r})}function L(e){if("arrow"===e.type){return{x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),w:Math.abs(e.x2-e.x1),h:Math.abs(e.y2-e.y1)}}if("draw"===e.type){if(0===e.points.length)return{x:0,y:0,w:0,h:0};let t=e.points[0].x,r=e.points[0].x,n=e.points[0].y,o=e.points[0].y;for(const i of e.points)i.x<t&&(t=i.x),i.x>r&&(r=i.x),i.y<n&&(n=i.y),i.y>o&&(o=i.y);return{x:t,y:n,w:r-t,h:o-n}}if("text"===e.type){const t=e.text.split("\n"),r=t.reduce((e,t)=>Math.max(e,t.length),0);return{x:e.x,y:e.y,w:r*e.size*.55,h:t.length*e.size*1.2}}return{x:e.x,y:e.y,w:e.w,h:e.h}}function z(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),w:Math.abs(e.x-t.x),h:Math.abs(e.y-t.y)}}function D(e){if(0===e.length)return"";let t=`M ${e[0].x} ${e[0].y}`;for(let r=1;r<e.length;r++)t+=` L ${e[r].x} ${e[r].y}`;return t}function P(e,t){const r=Math.round(Math.max(0,t.x)),n=Math.round(Math.max(0,t.y)),o=Math.round(Math.min(e.canvas.width-r,t.w)),i=Math.round(Math.min(e.canvas.height-n,t.h));if(o<2||i<2)return;const a=e.getImageData(r,n,o,i);for(let e=0;e<i;e+=12)for(let t=0;t<o;t+=12){let r=0,n=0,l=0,s=0,c=0;const d=Math.min(12,o-t),h=Math.min(12,i-e);for(let i=0;i<h;i++)for(let h=0;h<d;h++){const d=4*((e+i)*o+(t+h));r+=a.data[d],n+=a.data[d+1],l+=a.data[d+2],s+=a.data[d+3],c++}r=Math.round(r/c),n=Math.round(n/c),l=Math.round(l/c),s=Math.round(s/c);for(let i=0;i<h;i++)for(let c=0;c<d;c++){const d=4*((e+i)*o+(t+c));a.data[d]=r,a.data[d+1]=n,a.data[d+2]=l,a.data[d+3]=s}}e.putImageData(a,r,n)}export{w as ImageAnnotator_default};
@@ -1 +1 @@
1
- import{client_default as a}from"./chunk-XRWUNOI3.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
1
+ import{client_default as a}from"./chunk-GD5NGS6D.js";var t=()=>a.get("/auth/numbering-configs/").then(a=>a.data?.results??a.data??[]),e="uploaded:wallpaper";function r(a,t){return"string"!=typeof a||!a||"none"===a||a.startsWith("#")?"":a===e?t||"":a}var l=()=>a.get("/auth/me/wallpaper/").then(a=>a.data),n=(t,e)=>{const r=new FormData;r.append("wallpaper",t);const l=e?{onUploadProgress:a=>e(a.total?Math.round(a.loaded/a.total*100):null)}:void 0;return a.post("/auth/me/wallpaper/",r,l).then(a=>a.data)},p=()=>a.delete("/auth/me/wallpaper/").then(a=>a.data);function o(a){const t=a?.response?.status,e=a?.response?.data,r=Array.isArray(e?.wallpaper)?e.wallpaper[0]:void 0;return r||(413===t?"That picture is too large to use as a wallpaper.":415===t?"That file is not a picture this can use as a wallpaper.":"The wallpaper could not be saved. Please try again.")}export{e as WALLPAPER_PREF_TOKEN,p as deleteWallpaper,t as getNumberingConfigs,l as getWallpaper,n as uploadWallpaper,r as wallpaperSrc,o as wallpaperUploadError};
@@ -1 +1 @@
1
- import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-IN36HWJK.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},Z=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},F=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,F,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{Z(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,F,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],N=[800,1800],B=e=>{document.prerendering?E(()=>B(e)):"complete"!==document.readyState?addEventListener("load",()=>B(e),!0):setTimeout(e)};var U=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,H=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,O=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},J=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,K=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,W=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,D=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&H.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&U.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;Z(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,N,t.reportAllChanges);B(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,N,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,N,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&O.test(e.app),n="string"==typeof e.release&&O.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:O.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(J,"[redacted]").replace(K,"[redacted]").replace(W,"[url]").replace(V,"[id]").replace(D,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
1
+ import{setBoundaryErrorReporter as e}from"./chunk-KNUR2UEG.js";import{VERSION as t}from"./chunk-6FOLK4HD.js";var n=-1,i=()=>n,a=e=>{addEventListener("pageshow",t=>{t.persisted&&(n=t.timeStamp,e(t))},!0)},r=(e,t,n,i)=>{let a,r;return o=>{var s,c;t.value>=0&&(o||i)&&(r=t.value-(a??0),(r||void 0===a)&&(a=t.value,t.delta=r,t.rating=(s=t.value)>(c=n)[1]?"poor":s>c[0]?"needs-improvement":"good",e(t)))}},o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},s=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},c=()=>s()?.activationStart??0,d=-1,l=/* @__PURE__ */new Set,u=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,f=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of l)e();isFinite(d)||(d="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",f,!0))}},h=(e=!1)=>{if(e&&(d=1/0),d<0){const e=c(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime;d=t??u(),addEventListener("visibilitychange",f,!0),addEventListener("prerenderingchange",f,!0),a(()=>{setTimeout(()=>{d=u()})})}return{get firstHiddenTime(){return d},onHidden(e){l.add(e)}}},g=(e,t=-1,n,a=0,r,o,d)=>{const l=s(),u=l?.navigationId||0;let f="navigate";return n?f=n:i()>=0?f="back-forward-cache":l&&(document.prerendering||c()>0?f="prerender":document.wasDiscarded?f="restore":l.type&&(f=l.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:f,navigationId:a||u,navigationInteractionId:r,navigationURL:o||l?.name,navigationStartTime:d||0}},v=/* @__PURE__ */new WeakMap;function p(e,t){let n=v.get(t);return n||(n=/* @__PURE__ */new WeakMap,v.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}var m,y=class{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}},T=(e,t,n={})=>{try{const i=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(i.length>0){const e=new PerformanceObserver(e=>{queueMicrotask(()=>{const n=e.getEntries();i.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(const t of i)e.observe({type:t,buffered:!0,...n});return e}}catch{}},w=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,I=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){const t=e.keys().next().value;void 0!==t&&e.delete(t)}},b=e=>{let t=!1;return()=>{t||(e(),t=!0)}},C=class{l},E=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},L=[1800,3e3],P=(e,t={})=>{const n=w(t);E(()=>{const s=p(t,C),d=h();let l,u=g("FCP");const f=T(["paint"],e=>{for(const t of e)"first-contentful-paint"===t.name&&(f.disconnect(),t.startTime<d.firstHiddenTime&&(u.value=Math.max(t.startTime-c(),0),u.entries.push(t),u.navigationId=t.navigationId||u.navigationId,l(!0)))});f&&(l=r(e,u,L,t.reportAllChanges),a(n=>{u=g("FCP",-1,"back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),l=r(e,u,L,t.reportAllChanges),o(()=>{u.value=performance.now()-n.timeStamp,l(!0)})})),n&&T(["soft-navigation"],n=>{n.forEach(n=>{s.l&&n.navigationId&&I(s.l,n);const i=Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0);u=g("FCP",i,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),l=r(e,u,L,t.reportAllChanges),l(!0)})},t)})},A=[.1,.25],k=0,S=1/0,z=0,M=e=>{for(const t of e)t.interactionId&&(S=Math.min(S,t.interactionId),z=Math.max(z,t.interactionId),k=z?(z-S)/7+1:0)},$=()=>m?k:performance.interactionCount??0,_=class{u=0;v=[];m=/* @__PURE__ */new Map;p;T;_(){return $()-this.u}M(){this.u=$(),this.v.length=0,this.m.clear()}L(e){const t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return!t||-1!==n||"soft-navigation"!==e&&"back-forward-cache"!==e?this.v[n]:{P:8,id:-1,entries:[]}}h(e){if(this.p?.(e),!e.interactionId)return;const t=this.v.at(-1);let n=this.m.get(e.interactionId);if(n||this.v.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>t.P-e.P),this.v.length>10){const e=this.v.splice(10);for(const t of e)this.m.delete(t.id)}this.T?.(n)}}},F=e=>{const t="requestIdleCallback"in globalThis?1e3:0,n=globalThis.requestIdleCallback||setTimeout,i=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{const a=b(e);let r=-1;const o=()=>{i(r),a()};addEventListener("visibilitychange",o,{once:!0,capture:!0}),r=n(()=>{removeEventListener("visibilitychange",o,{capture:!0}),a()},{timeout:t})}},Z=[200,500],R=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=h();E(()=>{"interactionCount"in performance||m||(m=T(["event"],M,{durationThreshold:0}));let o,s=g("INP");const c=p(t,_),d=(n,i,a,d,l)=>{c.M(),s=g("INP",-1,n,i,a,d,l),o=r(e,s,Z,t.reportAllChanges)},l=()=>{const e=c.L(s.navigationType);e&&e.P!==s.value&&(s.value=e.P,s.entries=e.entries,o())},u=e=>{l(),o(!0),d("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},f=(e,t=!1)=>{F(()=>{for(const t of e)"soft-navigation"!==t.entryType?c.h(t):u(t);l(),t&&o(!0)})},h=["event","first-input"];w(t)&&h.push("soft-navigation");const v=T(h,f,{...t,durationThreshold:t.durationThreshold??40});o=r(e,s,Z,t.reportAllChanges),v&&(n.onHidden(()=>{f(v.takeRecords(),!0)}),a(()=>{d("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,i())}))})},j=class{p;l;h(e){this.p?.(e)}},x=[2500,4e3],B=[800,1800],N=e=>{document.prerendering?E(()=>N(e)):"complete"!==document.readyState?addEventListener("load",()=>N(e),!0):setTimeout(e)};var O=/^[A-Za-z0-9/_:.\-[\]{}*@~]+$/,U=/^[A-Za-z_$][A-Za-z0-9_$.]*$/,H=/^[A-Za-z0-9][A-Za-z0-9.+_-]*$/;var q=class{constructor(e){this.head=e}head;events=[];waiting=/* @__PURE__ */new Map;seen=/* @__PURE__ */new Set;get size(){return this.events.length}addVital(e){this.events.push(e)}addError(e){const t=function(e){return e.frames.length?`${e.name}|${e.frames.join("|")}`:`${e.name}|${e.message.replace(/\d/g,"0")}`}(e),n=this.waiting.get(t);return n?(n.count=Math.min(1e3,n.count+e.count),!0):!(this.seen.has(t)||this.seen.size>=20)&&(this.seen.add(t),this.waiting.set(t,e),this.events.push(e),!0)}drain(){const e=this.events;this.events=[],this.waiting.clear();const t=[],n=JSON.stringify({...this.head,events:[]}).length;let i=[],a=n;for(const r of e){const e=JSON.stringify(r).length+1;n+e>30720||((50===i.length||a+e>30720)&&(t.push({...this.head,events:i}),i=[],a=n),i.push(r),a+=e)}return i.length&&t.push({...this.head,events:i}),t}},K=/[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}/g,J=/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}(?:\.[A-Za-z0-9_-]*)?|\b[Bb]earer\s+[A-Za-z0-9._~+/=-]{8,}/g,D=/\b[a-z][a-z0-9+.-]*:\/\/\S+/gi,V=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,W=/\d{4,}/g,G=/(^|[/:])(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=$|[/:])/gi,Q=/^[a-z][a-z0-9+.-]*:\/\/[^/]*/i,X=/(?:\(|@|\bat\s+)?((?:[a-z][a-z0-9+.-]*:\/\/|\/)[^\s()@]*?):(\d+):(\d+)\)?\s*$/i;function Y(e,t,n){const i=e.replace(Q,"").split(/[?#]/,1)[0];return i?`${i}:${t}:${n}`.slice(0,256):null}function ee(e){if("string"!=typeof e)return[];const t=[];for(const n of e.split("\n")){const e=X.exec(n.trim()),i=e&&Y(e[1],e[2],e[3]);if(i&&t.push(i),5===t.length)break}return t}function te(e){const t=e instanceof Error?e.name:void 0;return"string"==typeof t&&t.length<=64&&U.test(t)?t:"Error"}function ne(e){if("string"!=typeof e)return"unknown";const t=e.trim().replace(Q,"").split(/[?#]/,1)[0].replace(G,(e,t)=>":"===t?":id":`${t}:id`);return t&&t.length<=128&&!t.includes("//")&&O.test(t)?t:"unknown"}var ie={flush(){},reportError(){},stop(){}},ae=null,re=/* @__PURE__ */new Set(["LCP","FCP","TTFB"]);function oe(e,t,n){const i=function(e){if(e.anonymous)return{credentials:"omit",headers:{"Content-Type":"application/json"}};const t=e.getAccessToken();return t?{credentials:"same-origin",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}:null}(t);if(!i)return;const a=t.anonymous?"/api/storefront-analytics/web-vitals/":"/api/client-telemetry/web-batches/";n(t.endpoint??a,{...i,method:"POST",keepalive:!0,body:JSON.stringify(e)}).catch(e=>{console.debug("[efficient-shell] client telemetry batch dropped:",e)})}function se(e){((e,t={})=>{let n=!1;const s=w(t);E(()=>{let d,l=h(),u=g("LCP");const f=p(t,j),v=(i,a,o,s,c)=>{u=g("LCP",-1,i,a,o,s,c),d=r(e,u,x,t.reportAllChanges),n=!1,"soft-navigation"===i&&(l=h(!0))},m=e=>{f.l&&e.navigationId&&I(f.l,e),n||d(!0),v("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);const t=e.getLargestInteractionContentfulPaint?.();t&&y([t])},y=e=>{t.reportAllChanges||s||(e=e.slice(-1));for(const t of e){if(!t)continue;if("soft-navigation"===t.entryType){m(t);continue}let e=0,n=[],i=t.startTime;if("largest-contentful-paint"===t.entryType)e=Math.max(t.startTime-c(),0),f.h(t),n=[t];else if("interaction-contentful-paint"===t.entryType){const a=t;if(!u.navigationId)continue;if("interactionId"in a&&a.interactionId!=u.navigationInteractionId)continue;i=a.largestContentfulPaint?.renderTime||0,e=Math.max(i-t.startTime,0),a.largestContentfulPaint&&(f.h(a.largestContentfulPaint),n=[a.largestContentfulPaint])}i<l.firstHiddenTime&&(u.value=e,u.entries=n,d())}},w=["largest-contentful-paint"];s&&w.push("interaction-contentful-paint","soft-navigation");const b=T(w,y);if(b){d=r(e,u,x,t.reportAllChanges);const c=["keydown","click","visibilitychange"],l=e=>{if(e.isTrusted&&!n){const e=u.id;F(()=>{if(!n){if(!s){b.disconnect();for(const e of c)removeEventListener(e,l,{capture:!0})}e===u.id&&(n=!0,d(!0))}})}};for(const e of c)addEventListener(e,l,{capture:!0});a(a=>{v("back-forward-cache",u.navigationId,u.navigationInteractionId,u.navigationURL,i()),d=r(e,u,x,t.reportAllChanges),o(()=>{u.value=performance.now()-a.timeStamp,n=!0,d(!0)})})}})})(e),R(e),((e,t={})=>{const n=h();P(b(()=>{let s,c=g("CLS",0);const d=p(t,y),l=(n,i,a,o,l)=>{c=g("CLS",0,n,i,a,o,l),d.i=0,s=r(e,c,A,t.reportAllChanges)},u=(e=!1)=>{d.i>c.value&&(c.value=d.i,c.entries=d.o),s(e)},f=e=>{u(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},h=e=>{for(const t of e)"soft-navigation"!==t.entryType?d.h(t):f(t);u()},v=["layout-shift"];w(t)&&v.push("soft-navigation");const m=T(v,h);m&&(s=r(e,c,A,t.reportAllChanges),n.onHidden(()=>{h(m.takeRecords()),s(!0)}),a(()=>{l("back-forward-cache",c.navigationId,c.navigationInteractionId,c.navigationURL,i()),o(s)}),setTimeout(s))}))})(e),P(e),((e,t={})=>{const n=w(t);let o=g("TTFB"),d=r(e,o,B,t.reportAllChanges);N(()=>{const l=s();if(l){const s=l.responseStart;o.value=Math.max(s-c(),0),o.entries=[l],d(!0),a(()=>{o=g("TTFB",0,"back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,i()),d=r(e,o,B,t.reportAllChanges),d(!0)}),n&&T(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&(o=g("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),o.entries=[n],d=r(e,o,B,t.reportAllChanges),d(!0))})},t)}})})(e)}function ce(n){if(ae?.stop(),ae=null,!1===n.enabled||"undefined"==typeof window||"undefined"==typeof document)return ie;if(!function(e){const t="string"==typeof e.app&&H.test(e.app),n="string"==typeof e.release&&H.test(e.release);return t&&n||console.warn("[efficient-shell] client telemetry not started: `app` and `release` must be version-like strings."),t&&n}(n))return ie;const i=function(e){const t=e.vitalsSampleRate??1;return t>0&&(t>=1||(e.random??Math.random)()<t)}(n);if(n.anonymous&&!i)return ie;const a=n.fetch??window.fetch.bind(window),r=new q({app:n.app,release:n.release,shell_version:H.test(t)?t:""}),o=ne(n.routeKey()),s=function(e=("undefined"==typeof window?void 0:window)){if(!e)return"desktop";const t="function"==typeof e.matchMedia&&e.matchMedia("(pointer: coarse)").matches,n=e.innerWidth;return n<600?"mobile":t&&n<1280?"tablet":"desktop"}(window);let c=!1;const d=()=>{for(const e of r.drain())oe(e,n,a)},l=e=>{c||n.anonymous||(r.addError(e),r.size>=50&&d())},u=(e,t)=>{return{type:"error",source:t,name:te(e),message:(a=e,i=a instanceof Error?a.message:"string"==typeof a?a:a&&"object"==typeof a&&"string"==typeof a.message?a.message:"",i.slice(0,640).replace(K,"[redacted]").replace(J,"[redacted]").replace(D,"[url]").replace(V,"[id]").replace(W,"[n]").replace(/\s+/g," ").trim().slice(0,160)),frames:ee(e instanceof Error?e.stack:void 0),route:ne(n.routeKey()),count:1};var i,a};i&&(n.observeVitals??se)(e=>{c||(r.addVital(function(e,t,n,i){return{type:"vital",name:e.name,value:e.value,route:re.has(e.name)?t:n(),navigation:e.navigationType??"navigate",device:i}}(e,o,()=>ne(n.routeKey()),s)),r.size>=50&&d())});const f=n.anonymous?()=>{}:function(t,n){const i=e=>{const{error:i,message:a,filename:r,lineno:o,colno:s}=e;if(null!=i)return void t(n(i,"onerror"));const c=r?ee(`at ${r}:${o??0}:${s??0}`):[];t({...n(a??"","onerror"),frames:c})},a=e=>t(n(e.reason,"unhandledrejection"));window.addEventListener("error",i),window.addEventListener("unhandledrejection",a);const r=e(e=>t(n(e,"boundary")));return()=>{window.removeEventListener("error",i),window.removeEventListener("unhandledrejection",a),r()}}(l,u),h=()=>{"hidden"===document.visibilityState&&d()};document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",d);const g=window.setInterval(d,n.flushIntervalMs??6e4),v={flush:d,reportError:e=>l(u(e,"boundary")),stop(){c||(d(),c=!0,f(),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",d),window.clearInterval(g),ae===v&&(ae=null))}};return ae=v,v}export{ce as startClientTelemetry};
@@ -0,0 +1 @@
1
+ import{UndoContext as e}from"./chunk-3AUPCKBR.js";import{useContext as t,useRef as r,useMemo as n,useEffect as o}from"react";var u={past:[],future:[]};function c(e,t){switch(t.type){case"record":{const r=e.past[e.past.length-1];if(null!==t.step.coalesceKey&&r?.coalesceKey===t.step.coalesceKey)return 0===e.future.length?e:{...e,future:[]};const n=[...e.past,t.step];return{past:n.length>100?n.slice(n.length-100):n,future:[]}}case"undo":return 0===e.past.length?e:{past:e.past.slice(0,-1),future:[t.redoStep,...e.future]};case"redo":return 0===e.future.length?e:{past:[...e.past,t.undoStep],future:e.future.slice(1)};case"clear":return 0===e.past.length&&0===e.future.length?e:u}}var s=/* @__PURE__ */new Set(["INPUT","TEXTAREA","SELECT"]);function a(e){if(!e.metaKey&&!e.ctrlKey||e.altKey)return null;const t=e.key.toLowerCase(),r="z"===t?e.shiftKey?"redo":"undo":"y"!==t||!e.ctrlKey||e.metaKey||e.shiftKey?null:"redo";if(!r)return null;const n=e.target;if(n?.isContentEditable)return null;if(n?.tagName&&s.has(n.tagName.toUpperCase()))return null;const o=n?.closest?.("[contenteditable]");return o&&"false"!==o.getAttribute("contenteditable")||n?.closest?.('[role="textbox"]')?null:r}function l(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;if(Array.isArray(e)!==Array.isArray(t))return!1;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function f(u,c=[]){const s=t(e),l=r(u);l.current=u;const f=n(()=>({undo:()=>l.current.undo(),redo:()=>l.current.redo(),canUndo:()=>l.current.canUndo(),canRedo:()=>l.current.canRedo()}),[]),i=s?.addSource,d=s?.bindKeys;o(()=>{const e=c.filter(e=>!!e);if(i&&d){const t=[i(f),...e.map(e=>d(e))];return()=>{for(const e of t)e()}}const t=e=>{const t=a(e);t&&("undo"===t?f.canUndo():f.canRedo())&&(e.preventDefault(),"undo"===t?f.undo():f.redo())},r=[window,...e];for(const e of r)e.addEventListener("keydown",t);return()=>{for(const e of r)e.removeEventListener("keydown",t)}},[i,d,f,...c])}export{u as emptyUndoState,a as matchUndoHotkey,l as sameValue,c as undoReducer,f as useUndoHistory};
@@ -84,6 +84,8 @@ declare const PIN_STICK_VAR = "--motion-pin-stick";
84
84
  declare const PIN_TRACK_POSITION_VAR = "--motion-pin-track-position";
85
85
  /** The stack order of a box marked `PIN_ABOVE_ATTR` (default 30: over the later sections, under a host header and its page overlays). */
86
86
  declare const PIN_ABOVE_Z_VAR = "--motion-pin-above-z";
87
+ /** A track's end: 1 = the next section slides over the frame (default), 0 = the frame scrolls away with the page (`pinAttrs` `end`). */
88
+ declare const PIN_OVER_VAR = "--motion-pin-over";
87
89
  interface ScrollValue {
88
90
  readonly effect: ScrollEffect;
89
91
  /** Percent, inside `SCROLL_ZOOM`. */
@@ -100,6 +102,16 @@ interface ScrollValue {
100
102
  */
101
103
  declare const PIN_FORMS: readonly ["track", "stick"];
102
104
  type PinForm = (typeof PIN_FORMS)[number];
105
+ /**
106
+ * How a track ends. `over`: the next section slides over the frame in the
107
+ * track's last screen (default, the look every stored pin has). `away`: no
108
+ * slide-over screen; when the effect screens end, the frame goes up with the
109
+ * page and the next section follows right under it.
110
+ */
111
+ declare const PIN_ENDS: readonly ["over", "away"];
112
+ type PinEnd = (typeof PIN_ENDS)[number];
113
+ /** A stored pin end, read: anything but `away` is `over`. */
114
+ declare function readPinEnd(v: unknown): PinEnd;
103
115
  interface PinValue {
104
116
  readonly on: boolean;
105
117
  /** Screens, inside `PIN_LENGTH`. */
@@ -142,10 +154,12 @@ declare function pinStickVars(stick: boolean): Record<string, string>;
142
154
  * stick form reads `--motion-pin-position` (it ignores `--motion-pin-on`).
143
155
  * `above` marks a stuck box that stays painted above the sections after it
144
156
  * (a bar); a track takes the mark only where a view draws it stuck.
157
+ * `end: 'away'` writes `--motion-pin-over: 0` (a track only): no slide-over.
145
158
  */
146
159
  declare function pinAttrs(value: PinValue, form?: PinForm, options?: {
147
160
  readonly stick?: boolean;
148
161
  readonly above?: boolean;
162
+ readonly end?: PinEnd;
149
163
  }): {
150
164
  attrs: Record<string, string>;
151
165
  style: Record<string, string>;
@@ -205,4 +219,4 @@ type HoverKind = (typeof HOVER_KINDS)[number];
205
219
  /** The kinds of {@link HOVER_KINDS} in `offered`, in the list's order. */
206
220
  declare function hoverKindsOf<K extends HoverKind>(offered: readonly K[]): readonly K[];
207
221
 
208
- export { HOVER_KINDS, type HoverKind, type LayoutNode, MotionRange, PIN_ABOVE_ATTR, PIN_ABOVE_Z_VAR, PIN_ATTR, PIN_FORMS, PIN_FRAME_ATTR, PIN_LENGTH, PIN_LENGTH_VAR, PIN_ON_VAR, PIN_POSITION_VAR, PIN_STICK_VAR, PIN_TOP_VAR, PIN_TRACK_POSITION_VAR, type PinForm, type PinValue, SCROLL_ATTR, SCROLL_EFFECTS, SCROLL_EFFECTS_WITH_ZOOM, SCROLL_END, SCROLL_END_VAR, SCROLL_ORIGIN_VAR, SCROLL_PROGRESS_VAR, SCROLL_START, SCROLL_START_VAR, SCROLL_ZOOM, SCROLL_ZOOM_VAR, type ScrollBox, type ScrollEffect, type ScrollValue, armScrollProgress, hoverKindsOf, layoutBox, pinAttrs, pinStickVars, readPin, readScroll, scrollAttrs, scrollProgress };
222
+ export { HOVER_KINDS, type HoverKind, type LayoutNode, MotionRange, PIN_ABOVE_ATTR, PIN_ABOVE_Z_VAR, PIN_ATTR, PIN_ENDS, PIN_FORMS, PIN_FRAME_ATTR, PIN_LENGTH, PIN_LENGTH_VAR, PIN_ON_VAR, PIN_OVER_VAR, PIN_POSITION_VAR, PIN_STICK_VAR, PIN_TOP_VAR, PIN_TRACK_POSITION_VAR, type PinEnd, type PinForm, type PinValue, SCROLL_ATTR, SCROLL_EFFECTS, SCROLL_EFFECTS_WITH_ZOOM, SCROLL_END, SCROLL_END_VAR, SCROLL_ORIGIN_VAR, SCROLL_PROGRESS_VAR, SCROLL_START, SCROLL_START_VAR, SCROLL_ZOOM, SCROLL_ZOOM_VAR, type ScrollBox, type ScrollEffect, type ScrollValue, armScrollProgress, hoverKindsOf, layoutBox, pinAttrs, pinStickVars, readPin, readPinEnd, readScroll, scrollAttrs, scrollProgress };
@@ -1 +1 @@
1
- export{slugify}from"../chunk-24AL3CDS.js";import{ENTRANCE_ATTR as t}from"../chunk-YYGA4Y6E.js";export{ENTRANCE_ATTR,ENTRANCE_DELAY_VAR,ENTRANCE_DURATION_VAR,ENTRANCE_FROM,ENTRANCE_FROM_ATTR,ENTRANCE_FROM_DEFAULT,ENTRANCE_KINDS,ENTRANCE_KINDS_WITH_FROM,ENTRANCE_STATE_ATTR,armEntrance,entranceAttrs,playEntrance,readEntrance}from"../chunk-YYGA4Y6E.js";export{HOVER_MOTION,MOTION_EASING,MOTION_GROUPS,MOTION_TIMING,motionSeconds,rotateDegrees}from"../chunk-AIJ3G6BD.js";export{hexWithAlpha,mixHex,rgbToHex}from"../chunk-CJSZW3OS.js";export{addShowWhenFacts,isShown,lazyShowWhenContext,showWhenFactReaders,showWhenFactsContext,showWhenOf,shownForOption,truthy,withRowRules,withRowsShownWhen,withShowWhen,withShowWhenFacts}from"../chunk-HCP7WOAL.js";export{gridColumnCount}from"../chunk-VNNVG4NR.js";export{BORDER_LINE_STYLES}from"../chunk-NOMWJTN2.js";export{FOCAL_DEFAULT,FOCAL_NUDGE_COARSE,FOCAL_NUDGE_STEP,focalFromRect,formatFocal,nudgeFocal,parseFocal}from"../chunk-25RR3GQW.js";export{contrastRatio,hexToRgb,parseHexColor,readableInk,relativeLuminance}from"../chunk-S6OB6HJB.js";export{escapeHtml}from"../chunk-G6DKCCWH.js";export{currencyDecimals,currencySymbol,formatBytes,formatMoney,setCurrencyFormats,timeAgo}from"../chunk-OJI4ROSD.js";export{DATE_FORMAT_OPTIONS,TZ_AUTO,dayKeyInZone,formatDate,formatDateTime,formatTime,getUserDateFormat,getUserTimezone,instantOnDayKey,knownZone,setUserDateFormat,setUserTimezone,syncTimezoneFromProfile,userToday,userZone}from"../chunk-NHKT5IH6.js";export{EMPTY_VALUE}from"../chunk-36BRD5J3.js";export{fromDateKey,toDateKey}from"../chunk-JRQMX4PK.js";import"../chunk-LF27WIN2.js";import{parseOption as e}from"../chunk-YPXONNBV.js";export{parseOption}from"../chunk-YPXONNBV.js";export{ROOT_THEME_ATTRIBUTES,rootIsDark,watchRootTheme}from"../chunk-LNXBTK7Q.js";var o=["none","zoom-in","zoom-out","fade-in","fade-out","move-up","move-down","reveal","parallax"],n=["zoom-in","zoom-out"],r=(t,e,o,n)=>({default:t,min:e,max:o,step:n}),i=r(30,0,100,10),s=r(0,0,100,5),a=r(100,0,100,5),m=r(2,0,4,.5),u="data-motion-scroll",c="data-motion-pin",f="data-motion-pin-frame",l="data-motion-pin-above",h="--motion-zoom",p="--motion-origin",d="--motion-scroll-start",N="--motion-scroll-end",T="--motion-p",E="--motion-pin-on",y="--motion-pin-top",A="--motion-pin-length",R="--motion-pin-position",g="--motion-pin-stick",O="--motion-pin-track-position",S="--motion-pin-above-z",w=["track","stick"],x=/^\s*-?\d+(\.\d+)?\s*$/;function F(t,e){const o="number"==typeof e?e:"string"==typeof e&&x.test(e)?Number(e):Number.NaN;if(!Number.isFinite(o))return t.default;const n=Math.min(t.max,Math.max(t.min,o)),r=Math.round(Number((n/t.step).toFixed(6)));return Number((r*t.step).toFixed(3))}function _(t,n,r,m){const u=e(o,"none",t),c=F(s,r),f=F(a,m);return{effect:u,zoom:F(i,n),start:Math.min(c,f),end:Math.max(c,f)}}function k(t,e){if("none"===t.effect)return{attrs:{},style:{}};const o={};var r;return r=t.effect,n.includes(r)&&(o[h]=String(Number((1+t.zoom/100).toFixed(3))),e&&(o[p]=e)),t.start!==s.default&&(o[d]=String(t.start)),t.end!==a.default&&(o[N]=String(t.end)),{attrs:{[u]:t.effect},style:o}}function C(t,e){return{on:!0===t,length:F(m,e)}}function v(t){return t?{[g]:"1",[O]:"sticky"}:{[g]:"0",[O]:"relative"}}function D(t,e="track",o={}){if(!t.on)return{attrs:{},style:{}};const n=!0===o.above?{[l]:""}:{};if("stick"===e)return{attrs:{[c]:"stick",...n},style:{}};const r=t.length===m.default?{}:{[A]:String(t.length)};return{attrs:{[c]:"",...n},style:!0===o.stick?{...r,...v(!0)}:r}}function I(t,e,o,n){let r;if(e){const t=e.length*e.vh;r=t>0?((e.stop??0)-e.top)/t:1}else r=(t.vh-t.top)/(t.vh+t.height);const i=o/100,s=n/100,a=s>i?(r-i)/(s-i):r>=s?1:0;return Math.min(1,Math.max(0,Number(a.toFixed(4))))}var M=(t,e)=>{const o=Number.parseFloat(t);return Number.isFinite(o)?o:e};function j(e=document){const o=()=>{};if("undefined"==typeof window||"undefined"==typeof CSS)return o;if(CSS.supports("animation-timeline: view()"))return o;let n=0;const r=()=>{n=0;const o=window.innerHeight||document.documentElement.clientHeight,r=[];for(const n of e.querySelectorAll(`[${u}]`)){if(n.hasAttribute(t))continue;const e=getComputedStyle(n),i=n.closest(`[${c}]:not([${c}="stick"])`),u=i?getComputedStyle(i):null,l=!!u&&(0===M(u.getPropertyValue(E),1)||0!==M(u.getPropertyValue(g),0)),h=b(l&&i?i:n,o),p=i?.querySelector(`[${f}]`),T=i&&!l?{...b(i,o),length:M(u.getPropertyValue(A),m.default),stop:p?M(getComputedStyle(p).top,0):0}:null;r.push({el:n,p:I({top:h.top,height:h.height,vh:o},T,M(e.getPropertyValue(d),s.default),M(e.getPropertyValue(N),a.default))})}for(const{el:t,p:e}of r)t.style.setProperty(T,String(e))},i=()=>{n||(n=requestAnimationFrame(r))};return r(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),()=>{n&&cancelAnimationFrame(n),window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}}function b(t,e,o=("undefined"==typeof window?0:window.scrollY)){let n=0;for(let e=t;e;e=e.offsetParent)n+=e.offsetTop;return{top:n-o,height:t.offsetHeight,vh:e}}var L=["none","nextImage","rotate","zoom","lift","mono"];function P(t){return L.filter(e=>t.includes(e))}export{L as HOVER_KINDS,l as PIN_ABOVE_ATTR,S as PIN_ABOVE_Z_VAR,c as PIN_ATTR,w as PIN_FORMS,f as PIN_FRAME_ATTR,m as PIN_LENGTH,A as PIN_LENGTH_VAR,E as PIN_ON_VAR,R as PIN_POSITION_VAR,g as PIN_STICK_VAR,y as PIN_TOP_VAR,O as PIN_TRACK_POSITION_VAR,u as SCROLL_ATTR,o as SCROLL_EFFECTS,n as SCROLL_EFFECTS_WITH_ZOOM,a as SCROLL_END,N as SCROLL_END_VAR,p as SCROLL_ORIGIN_VAR,T as SCROLL_PROGRESS_VAR,s as SCROLL_START,d as SCROLL_START_VAR,i as SCROLL_ZOOM,h as SCROLL_ZOOM_VAR,j as armScrollProgress,P as hoverKindsOf,b as layoutBox,D as pinAttrs,v as pinStickVars,C as readPin,_ as readScroll,k as scrollAttrs,I as scrollProgress};
1
+ export{slugify}from"../chunk-24AL3CDS.js";import{ENTRANCE_ATTR as t}from"../chunk-YYGA4Y6E.js";export{ENTRANCE_ATTR,ENTRANCE_DELAY_VAR,ENTRANCE_DURATION_VAR,ENTRANCE_FROM,ENTRANCE_FROM_ATTR,ENTRANCE_FROM_DEFAULT,ENTRANCE_KINDS,ENTRANCE_KINDS_WITH_FROM,ENTRANCE_STATE_ATTR,armEntrance,entranceAttrs,playEntrance,readEntrance}from"../chunk-YYGA4Y6E.js";export{HOVER_MOTION,MOTION_EASING,MOTION_GROUPS,MOTION_TIMING,motionSeconds,rotateDegrees}from"../chunk-AIJ3G6BD.js";export{hexWithAlpha,mixHex,rgbToHex}from"../chunk-CJSZW3OS.js";export{addShowWhenFacts,isShown,lazyShowWhenContext,showWhenFactReaders,showWhenFactsContext,showWhenOf,shownForOption,truthy,withRowRules,withRowsShownWhen,withShowWhen,withShowWhenFacts}from"../chunk-HCP7WOAL.js";export{gridColumnCount}from"../chunk-VNNVG4NR.js";export{BORDER_LINE_STYLES}from"../chunk-NOMWJTN2.js";export{FOCAL_DEFAULT,FOCAL_NUDGE_COARSE,FOCAL_NUDGE_STEP,focalFromRect,formatFocal,nudgeFocal,parseFocal}from"../chunk-25RR3GQW.js";export{contrastRatio,hexToRgb,parseHexColor,readableInk,relativeLuminance}from"../chunk-S6OB6HJB.js";export{escapeHtml}from"../chunk-G6DKCCWH.js";export{currencyDecimals,currencySymbol,formatBytes,formatMoney,setCurrencyFormats,timeAgo}from"../chunk-OJI4ROSD.js";export{DATE_FORMAT_OPTIONS,TZ_AUTO,dayKeyInZone,formatDate,formatDateTime,formatTime,getUserDateFormat,getUserTimezone,instantOnDayKey,knownZone,setUserDateFormat,setUserTimezone,syncTimezoneFromProfile,userToday,userZone}from"../chunk-NHKT5IH6.js";export{EMPTY_VALUE}from"../chunk-36BRD5J3.js";export{fromDateKey,toDateKey}from"../chunk-JRQMX4PK.js";import"../chunk-LF27WIN2.js";import{parseOption as e}from"../chunk-YPXONNBV.js";export{parseOption}from"../chunk-YPXONNBV.js";export{ROOT_THEME_ATTRIBUTES,rootIsDark,watchRootTheme}from"../chunk-LNXBTK7Q.js";var o=["none","zoom-in","zoom-out","fade-in","fade-out","move-up","move-down","reveal","parallax"],n=["zoom-in","zoom-out"],r=(t,e,o,n)=>({default:t,min:e,max:o,step:n}),i=r(30,0,100,10),a=r(0,0,100,5),s=r(100,0,100,5),m=r(2,0,4,.5),u="data-motion-scroll",c="data-motion-pin",f="data-motion-pin-frame",l="data-motion-pin-above",h="--motion-zoom",p="--motion-origin",d="--motion-scroll-start",N="--motion-scroll-end",T="--motion-p",E="--motion-pin-on",y="--motion-pin-top",A="--motion-pin-length",R="--motion-pin-position",g="--motion-pin-stick",w="--motion-pin-track-position",O="--motion-pin-above-z",S="--motion-pin-over",x=["track","stick"],F=["over","away"];function _(t){return e(F,"over",t)}var k=/^\s*-?\d+(\.\d+)?\s*$/;function v(t,e){const o="number"==typeof e?e:"string"==typeof e&&k.test(e)?Number(e):Number.NaN;if(!Number.isFinite(o))return t.default;const n=Math.min(t.max,Math.max(t.min,o)),r=Math.round(Number((n/t.step).toFixed(6)));return Number((r*t.step).toFixed(3))}function C(t,n,r,m){const u=e(o,"none",t),c=v(a,r),f=v(s,m);return{effect:u,zoom:v(i,n),start:Math.min(c,f),end:Math.max(c,f)}}function D(t,e){if("none"===t.effect)return{attrs:{},style:{}};const o={};var r;return r=t.effect,n.includes(r)&&(o[h]=String(Number((1+t.zoom/100).toFixed(3))),e&&(o[p]=e)),t.start!==a.default&&(o[d]=String(t.start)),t.end!==s.default&&(o[N]=String(t.end)),{attrs:{[u]:t.effect},style:o}}function I(t,e){return{on:!0===t,length:v(m,e)}}function M(t){return t?{[g]:"1",[w]:"sticky"}:{[g]:"0",[w]:"relative"}}function j(t,e="track",o={}){if(!t.on)return{attrs:{},style:{}};const n=!0===o.above?{[l]:""}:{};if("stick"===e)return{attrs:{[c]:"stick",...n},style:{}};const r={...t.length===m.default?{}:{[A]:String(t.length)},..."away"===o.end?{[S]:"0"}:{}};return{attrs:{[c]:"",...n},style:!0===o.stick?{...r,...M(!0)}:r}}function b(t,e,o,n){let r;if(e){const t=e.length*e.vh;r=t>0?((e.stop??0)-e.top)/t:1}else r=(t.vh-t.top)/(t.vh+t.height);const i=o/100,a=n/100,s=a>i?(r-i)/(a-i):r>=a?1:0;return Math.min(1,Math.max(0,Number(s.toFixed(4))))}var L=(t,e)=>{const o=Number.parseFloat(t);return Number.isFinite(o)?o:e};function P(e=document){const o=()=>{};if("undefined"==typeof window||"undefined"==typeof CSS)return o;if(CSS.supports("animation-timeline: view()"))return o;let n=0;const r=()=>{n=0;const o=window.innerHeight||document.documentElement.clientHeight,r=[];for(const n of e.querySelectorAll(`[${u}]`)){if(n.hasAttribute(t))continue;const e=getComputedStyle(n),i=n.closest(`[${c}]:not([${c}="stick"])`),u=i?getComputedStyle(i):null,l=!!u&&(0===L(u.getPropertyValue(E),1)||0!==L(u.getPropertyValue(g),0)),h=W(l&&i?i:n,o),p=i?.querySelector(`[${f}]`),T=i&&!l?{...W(i,o),length:L(u.getPropertyValue(A),m.default),stop:p?L(getComputedStyle(p).top,0):0}:null;r.push({el:n,p:b({top:h.top,height:h.height,vh:o},T,L(e.getPropertyValue(d),a.default),L(e.getPropertyValue(N),s.default))})}for(const{el:t,p:e}of r)t.style.setProperty(T,String(e))},i=()=>{n||(n=requestAnimationFrame(r))};return r(),window.addEventListener("scroll",i,{passive:!0}),window.addEventListener("resize",i,{passive:!0}),()=>{n&&cancelAnimationFrame(n),window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}}function W(t,e,o=("undefined"==typeof window?0:window.scrollY)){let n=0;for(let e=t;e;e=e.offsetParent)n+=e.offsetTop;return{top:n-o,height:t.offsetHeight,vh:e}}var z=["none","nextImage","rotate","zoom","lift","mono"];function H(t){return z.filter(e=>t.includes(e))}export{z as HOVER_KINDS,l as PIN_ABOVE_ATTR,O as PIN_ABOVE_Z_VAR,c as PIN_ATTR,F as PIN_ENDS,x as PIN_FORMS,f as PIN_FRAME_ATTR,m as PIN_LENGTH,A as PIN_LENGTH_VAR,E as PIN_ON_VAR,S as PIN_OVER_VAR,R as PIN_POSITION_VAR,g as PIN_STICK_VAR,y as PIN_TOP_VAR,w as PIN_TRACK_POSITION_VAR,u as SCROLL_ATTR,o as SCROLL_EFFECTS,n as SCROLL_EFFECTS_WITH_ZOOM,s as SCROLL_END,N as SCROLL_END_VAR,p as SCROLL_ORIGIN_VAR,T as SCROLL_PROGRESS_VAR,a as SCROLL_START,d as SCROLL_START_VAR,i as SCROLL_ZOOM,h as SCROLL_ZOOM_VAR,P as armScrollProgress,H as hoverKindsOf,W as layoutBox,j as pinAttrs,M as pinStickVars,I as readPin,_ as readPinEnd,C as readScroll,D as scrollAttrs,b as scrollProgress};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{TextLinkField,LinkPicker as default}from"../chunk-N3T5BE2T.js";import"../chunk-DVKOVZJ2.js";import"../chunk-EQKUFYX6.js";import"../chunk-W7HTHKN2.js";import"../chunk-EO5RLFRX.js";import"../chunk-GML6FVPA.js";import"../chunk-2NMW66P5.js";import"../chunk-UJUTS6LJ.js";import"../chunk-Z5TE3MEG.js";import"../chunk-D7MRZZVV.js";import"../chunk-AYZY3YNC.js";import"../chunk-UGTRSRIW.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import"../chunk-APFDZ2HG.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";
2
+ export{TextLinkField,LinkPicker as default}from"../chunk-OHPDB4UN.js";import"../chunk-DVKOVZJ2.js";import"../chunk-W7HTHKN2.js";import"../chunk-EO5RLFRX.js";import"../chunk-GML6FVPA.js";import"../chunk-EQKUFYX6.js";import"../chunk-2NMW66P5.js";import"../chunk-UJUTS6LJ.js";import"../chunk-Z5TE3MEG.js";import"../chunk-D7MRZZVV.js";import"../chunk-AYZY3YNC.js";import"../chunk-UGTRSRIW.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import"../chunk-APFDZ2HG.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{MEDIA_FILES_DRAG_TYPE,MEDIA_FILE_DRAG_TYPE,MEDIA_FOLDER_DRAG_TYPE,MediaLibrary as default,readMediaFileDrag}from"../chunk-6ZNJ6JU5.js";import"../chunk-BTMZ5MUY.js";import"../chunk-5B7CLXHC.js";import"../chunk-MQNSKFZY.js";import"../chunk-CGUMJZUB.js";import"../chunk-IC72MGON.js";import"../chunk-DEV3ZHPP.js";import"../chunk-W3454ZES.js";import"../chunk-SACUSHVN.js";import"../chunk-WREUA43Q.js";import"../chunk-UFJR63AO.js";import"../chunk-GRAFJD3L.js";import"../chunk-OK2J6WSC.js";import"../chunk-B4Y5NGHR.js";import"../chunk-EULBBS5L.js";import"../chunk-W7HTHKN2.js";import"../chunk-EO5RLFRX.js";import"../chunk-GML6FVPA.js";import"../chunk-6KBDNYRW.js";import"../chunk-2NMW66P5.js";import"../chunk-VLKDWKVR.js";import"../chunk-OLFYNMTD.js";import"../chunk-LACL4MAR.js";import"../chunk-XYVFJLAU.js";import"../chunk-CGZBDI6C.js";import"../chunk-TALQMTCE.js";import"../chunk-EFKJLUYP.js";import"../chunk-MF7OELXP.js";import"../chunk-OSMRYND3.js";import"../chunk-D7MRZZVV.js";import"../chunk-AYZY3YNC.js";import"../chunk-TAIH2VIW.js";import"../chunk-TAB3K2WF.js";import"../chunk-TNGIXSTM.js";import"../chunk-EIFNESXS.js";import"../chunk-PO2KNVCC.js";import"../chunk-CJ4OEY3T.js";import"../chunk-5QHNDAZ6.js";import"../chunk-TEQ5ZPAL.js";import"../chunk-VWGWZY7A.js";import"../chunk-DBQNYJZ6.js";import"../chunk-L2WQOJ3T.js";import"../chunk-UGTRSRIW.js";import"../chunk-F3ZOO23R.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import"../chunk-APFDZ2HG.js";import"../chunk-ABIWAS5K.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-BWJZTHZ6.js";import"../chunk-FAPZFMS3.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-I2NVBDKH.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-MAFUXCPZ.js";import"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";
2
+ export{MEDIA_FILES_DRAG_TYPE,MEDIA_FILE_DRAG_TYPE,MEDIA_FOLDER_DRAG_TYPE,MediaLibrary as default,readMediaFileDrag}from"../chunk-E4WVF6AS.js";import"../chunk-BTMZ5MUY.js";import"../chunk-5B7CLXHC.js";import"../chunk-MQNSKFZY.js";import"../chunk-CGUMJZUB.js";import"../chunk-IC72MGON.js";import"../chunk-DEV3ZHPP.js";import"../chunk-W3454ZES.js";import"../chunk-SACUSHVN.js";import"../chunk-WREUA43Q.js";import"../chunk-VLKDWKVR.js";import"../chunk-OLFYNMTD.js";import"../chunk-LACL4MAR.js";import"../chunk-UFJR63AO.js";import"../chunk-GRAFJD3L.js";import"../chunk-OK2J6WSC.js";import"../chunk-B4Y5NGHR.js";import"../chunk-EULBBS5L.js";import"../chunk-W7HTHKN2.js";import"../chunk-EO5RLFRX.js";import"../chunk-GML6FVPA.js";import"../chunk-6KBDNYRW.js";import"../chunk-2NMW66P5.js";import"../chunk-XYVFJLAU.js";import"../chunk-CGZBDI6C.js";import"../chunk-TALQMTCE.js";import"../chunk-EFKJLUYP.js";import"../chunk-MF7OELXP.js";import"../chunk-OSMRYND3.js";import"../chunk-D7MRZZVV.js";import"../chunk-TAIH2VIW.js";import"../chunk-TAB3K2WF.js";import"../chunk-AYZY3YNC.js";import"../chunk-TNGIXSTM.js";import"../chunk-EIFNESXS.js";import"../chunk-PO2KNVCC.js";import"../chunk-CJ4OEY3T.js";import"../chunk-5QHNDAZ6.js";import"../chunk-TEQ5ZPAL.js";import"../chunk-VWGWZY7A.js";import"../chunk-DBQNYJZ6.js";import"../chunk-L2WQOJ3T.js";import"../chunk-UGTRSRIW.js";import"../chunk-F3ZOO23R.js";import"../chunk-NJY4HPNB.js";import"../chunk-PM6HY5BH.js";import"../chunk-DWGYC7OD.js";import"../chunk-APFDZ2HG.js";import"../chunk-ABIWAS5K.js";import"../chunk-P56YLT73.js";import"../chunk-URHGHXDN.js";import"../chunk-5QFPTDQF.js";import"../chunk-A4ROXNUF.js";import"../chunk-TSZPGDU3.js";import"../chunk-ISVODSRP.js";import"../chunk-J75ZT2JQ.js";import"../chunk-R2VKEMZH.js";import"../chunk-BWJZTHZ6.js";import"../chunk-FAPZFMS3.js";import"../chunk-CIZAUBWA.js";import"../chunk-PGN5ME7B.js";import"../chunk-5QRHQCRG.js";import"../chunk-62LW225J.js";import"../chunk-TAHHZGRH.js";import"../chunk-KEFNQEXZ.js";import"../chunk-PU2GJVMG.js";import"../chunk-3FININUU.js";import"../chunk-I2NVBDKH.js";import"../chunk-UQYNPYF4.js";import"../chunk-MRJKZWWV.js";import"../chunk-TWVUQUUD.js";import"../chunk-5FYDNH4Y.js";import"../chunk-LNXBTK7Q.js";import"../chunk-MAFUXCPZ.js";import"../chunk-NRHG4R2Q.js";import"../chunk-C3QOHMR6.js";
@@ -27,4 +27,45 @@ import { EffectCallback, DependencyList } from 'react';
27
27
  */
28
28
  declare function useBrowserLayoutEffect(effect: EffectCallback, deps?: DependencyList): void;
29
29
 
30
- export { useBrowserLayoutEffect };
30
+ /**
31
+ * A history that lives outside the shell's form stack — an editor's document
32
+ * store — answered by the shell's keys. Read at each key press, so the
33
+ * functions may close over live state and need not be stable.
34
+ */
35
+ interface UndoSource {
36
+ undo: () => void;
37
+ redo: () => void;
38
+ /** False leaves the key alone (no `preventDefault`), as an empty stack does:
39
+ * nothing to step to, or the document may not be written right now. */
40
+ canUndo: () => boolean;
41
+ canRedo: () => boolean;
42
+ }
43
+ /** Something that dispatches `keydown`: a frame's `Document`, or an element. */
44
+ type KeyTarget = Pick<EventTarget, 'addEventListener' | 'removeEventListener'>;
45
+
46
+ /**
47
+ * Put a history the shell does not hold under the shell's undo keys.
48
+ *
49
+ * The shell is the one owner of ⌘Z / Ctrl+Z (undo) and ⇧⌘Z / Ctrl+Shift+Z /
50
+ * Ctrl+Y (redo), and undo has no buttons. An editor that keeps its own history
51
+ * (efficient-easel's document store) does not bind the keys itself; it hands
52
+ * the history over:
53
+ *
54
+ * useUndoHistory(
55
+ * { undo: history.back, redo: history.forward,
56
+ * canUndo: () => canWrite() && history.hasPast,
57
+ * canRedo: () => canWrite() && history.hasFuture },
58
+ * [canvasFrameDocument],
59
+ * );
60
+ *
61
+ * Inside a window, the window's stack answers the keys with this history while
62
+ * the caller is mounted. `keyTargets` are other places a key can be pressed
63
+ * that never reach `window` — an iframe's document — and they answer for the
64
+ * same window; pass the same number of them on every render. Outside any `UndoProvider` (a page with no shell windows) the
65
+ * hook binds `window` and the targets itself, with the same key rule
66
+ * (`matchUndoHotkey`), so there is still one rule. A press in a text field is
67
+ * that field's own undo either way.
68
+ */
69
+ declare function useUndoHistory(source: UndoSource, keyTargets?: ReadonlyArray<KeyTarget | null | undefined>): void;
70
+
71
+ export { type KeyTarget, type UndoSource, useBrowserLayoutEffect, useUndoHistory };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{useBrowserLayoutEffect}from"../chunk-PU2GJVMG.js";
2
+ export{useUndoHistory}from"../chunk-ZLB5GRL6.js";export{useBrowserLayoutEffect}from"../chunk-PU2GJVMG.js";import"../chunk-3AUPCKBR.js";
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- export{ICON_NAMES,isIconName}from"../chunk-3C7JKJGL.js";export{BRAND_ICON_NAMES,isBrandIconName}from"../chunk-RQGLDRRF.js";export{BRAND_MAX_HEIGHT,BRAND_MIN_HEIGHT_PX,brandBox}from"../chunk-64ACCUNN.js";export{ICON_SET_FOR_THEME,THEME_ICON_SETS,iconSetFor,loadIconSet}from"../chunk-VQCKMT5F.js";export{Icon}from"../chunk-ISVODSRP.js";export{activeIconSet,iconSets,iconsVersion,registerIconSet,registerIcons,resolveIcon,setDefaultIconSet,setIconSet,subscribeIcons}from"../chunk-J75ZT2JQ.js";
2
+ export{ICON_NAMES,isIconName}from"../chunk-3C7JKJGL.js";export{ICON_SET_FOR_THEME,THEME_ICON_SETS,iconSetFor,loadIconSet}from"../chunk-VQCKMT5F.js";export{BRAND_ICON_NAMES,isBrandIconName}from"../chunk-RQGLDRRF.js";export{BRAND_MAX_HEIGHT,BRAND_MIN_HEIGHT_PX,brandBox}from"../chunk-64ACCUNN.js";export{Icon}from"../chunk-ISVODSRP.js";export{activeIconSet,iconSets,iconsVersion,registerIconSet,registerIcons,resolveIcon,setDefaultIconSet,setIconSet,subscribeIcons}from"../chunk-J75ZT2JQ.js";