@cntrl-site/components 1.0.101 → 1.0.102

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 (130) hide show
  1. package/README.md +25 -1
  2. package/dist/Burger-C6jI6C1c.js +661 -0
  3. package/dist/Burger-EMSn7TPB.mjs +1807 -0
  4. package/dist/ClickGallerie-D_O1XhAO.mjs +270 -0
  5. package/dist/ClickGallerie-M9xdGR1G.js +36 -0
  6. package/dist/Components/Burger/BurgerComponent.d.ts +0 -1
  7. package/dist/Components/ClickGallerie/ClickGallerieComponent.d.ts +0 -1
  8. package/dist/Components/FAQ/FAQComponent.d.ts +0 -1
  9. package/dist/Components/Form/FormComponent.d.ts +0 -1
  10. package/dist/Components/Grid/GridComponent.d.ts +0 -1
  11. package/dist/Components/Helix/HelixComponent.d.ts +0 -1
  12. package/dist/Components/Hive/HiveComponent.d.ts +0 -1
  13. package/dist/Components/LightboxJournal/LightboxJournalComponent.d.ts +0 -1
  14. package/dist/Components/LightboxStrip/LightboxStripComponent.d.ts +0 -1
  15. package/dist/Components/List/ListComponent.d.ts +0 -1
  16. package/dist/Components/Marquee/MarqueeComponent.d.ts +0 -1
  17. package/dist/Components/MarqueeText/MarqueeTextComponent.d.ts +0 -1
  18. package/dist/Components/Mercury/MercuryComponent.d.ts +0 -1
  19. package/dist/Components/OnelinerForm/OnelinerFormComponent.d.ts +0 -1
  20. package/dist/Components/Pretext/PretextComponent.d.ts +0 -1
  21. package/dist/Components/Scale/ScaleComponent.d.ts +0 -1
  22. package/dist/Components/SimpleButton/SimpleButtonComponent.d.ts +0 -1
  23. package/dist/Components/Slider20/Slider20Component.d.ts +0 -1
  24. package/dist/Components/TestimonialGrid/TestimonialGridComponent.d.ts +0 -1
  25. package/dist/Components/TestimonialSingle/TestimonialSingleComponent.d.ts +0 -1
  26. package/dist/Components/Waterfall/WaterfallComponent.d.ts +0 -1
  27. package/dist/ControlSlider-SiOt22l_.js +1 -0
  28. package/dist/ControlSlider-pZv7H6BU.mjs +334 -0
  29. package/dist/FAQ-C7823fyi.js +166 -0
  30. package/dist/FAQ-CZ39u4m8.mjs +588 -0
  31. package/dist/Form-BX5_41nb.mjs +472 -0
  32. package/dist/Form-Dn-6A1He.js +153 -0
  33. package/dist/Grid-CemGhf3F.js +374 -0
  34. package/dist/Grid-cfQsXW3b.mjs +1553 -0
  35. package/dist/Helix-2Vr-9WBa.js +43 -0
  36. package/dist/Helix-BmkAKT1G.mjs +315 -0
  37. package/dist/Hive-BC6zQBsv.js +321 -0
  38. package/dist/Hive-BGMWinrW.mjs +1425 -0
  39. package/dist/HiveLightboxTitles-DhEeFKWs.mjs +507 -0
  40. package/dist/HiveLightboxTitles-DlyptAaK.js +1 -0
  41. package/dist/ImageRevealSlider-BBWtFjUF.js +1 -0
  42. package/dist/ImageRevealSlider-BdFGyVEP.mjs +184 -0
  43. package/dist/Lightbox-CIss_nOG.js +1 -0
  44. package/dist/Lightbox-eP9qAZzL.mjs +665 -0
  45. package/dist/LightboxJournal-D59ex6wH.mjs +1613 -0
  46. package/dist/LightboxJournal-DAEZOPDi.js +523 -0
  47. package/dist/LightboxStrip-BDjI1jyH.js +386 -0
  48. package/dist/LightboxStrip-YspzBP8N.mjs +1574 -0
  49. package/dist/List-C32WImI3.js +377 -0
  50. package/dist/List-DW7fyJbf.mjs +1891 -0
  51. package/dist/Marquee-BYClHHws.mjs +551 -0
  52. package/dist/Marquee-vmHaTGIP.js +133 -0
  53. package/dist/MarqueeText-4Rip_sQX.mjs +515 -0
  54. package/dist/MarqueeText-E6OubMOG.js +132 -0
  55. package/dist/Mercury-BwF_XW2w.js +267 -0
  56. package/dist/Mercury-DuKJQ1Zo.mjs +1701 -0
  57. package/dist/OnelinerForm-BEu7_sho.mjs +434 -0
  58. package/dist/OnelinerForm-C2Y_XMCY.js +194 -0
  59. package/dist/Pretext-10CcyP1E.mjs +2762 -0
  60. package/dist/Pretext-DvQ3xsni.js +231 -0
  61. package/dist/PretextComponent-C3YFICy8.js +1 -0
  62. package/dist/PretextComponent-Ct0newmn.mjs +11624 -0
  63. package/dist/RichTextRenderer-B6WtTYlR.mjs +32 -0
  64. package/dist/RichTextRenderer-CIy6yI8U.js +1 -0
  65. package/dist/Scale-976sjO8e.js +111 -0
  66. package/dist/Scale-rLNT4KAk.mjs +345 -0
  67. package/dist/SimpleButton-C-o2W9bS.mjs +451 -0
  68. package/dist/SimpleButton-nGEcO2gB.js +243 -0
  69. package/dist/Slider20-C9o2REDl.js +272 -0
  70. package/dist/Slider20-Dm8BeCli.mjs +851 -0
  71. package/dist/SvgImage-B5mR9y6q.mjs +51 -0
  72. package/dist/SvgImage-DFlmxAoL.js +1 -0
  73. package/dist/TestimonialGrid-CPu4qQ6B.mjs +492 -0
  74. package/dist/TestimonialGrid-D4ieiz9e.js +90 -0
  75. package/dist/TestimonialSingle-CVu15ZtV.js +125 -0
  76. package/dist/TestimonialSingle-DLdnAVF7.mjs +391 -0
  77. package/dist/Waterfall-A0FjM2my.mjs +1400 -0
  78. package/dist/Waterfall-DnPDHbCL.js +287 -0
  79. package/dist/buildColorVars-CE2D5cQV.js +1 -0
  80. package/dist/buildColorVars-CLyWQm5K.mjs +21 -0
  81. package/dist/components-OE3ac1dr.js +1 -0
  82. package/dist/components-w-jHX-2U.mjs +2053 -0
  83. package/dist/components.css +1 -1
  84. package/dist/elements.d.ts +7 -0
  85. package/dist/elements.js +1 -0
  86. package/dist/elements.mjs +63 -0
  87. package/dist/elements.node.d.ts +6 -0
  88. package/dist/elements.node.js +1 -0
  89. package/dist/elements.node.mjs +21 -0
  90. package/dist/forking.d.ts +1 -0
  91. package/dist/formFieldValidation-DZl2KVaF.js +1 -0
  92. package/dist/formFieldValidation-DvihFrq5.mjs +21 -0
  93. package/dist/getColorAlpha-BVBY0N5x.mjs +39 -0
  94. package/dist/getColorAlpha-CoSseoCn.js +1 -0
  95. package/dist/getImageRect-BQhQXvT8.js +1 -0
  96. package/dist/getImageRect-CBMhFNHM.mjs +109 -0
  97. package/dist/index.d.ts +1 -0
  98. package/dist/index.js +1 -28862
  99. package/dist/index.mjs +16 -62473
  100. package/dist/loadSvgMaskUrl-DfF7ay6h.js +1 -0
  101. package/dist/loadSvgMaskUrl-xHgGYgPe.mjs +20 -0
  102. package/dist/panelAvailability-D179wwJx.mjs +27 -0
  103. package/dist/panelAvailability-DnOe0rQ4.js +1 -0
  104. package/dist/react-splide.esm-CabaEmHi.js +6 -0
  105. package/dist/react-splide.esm-DQqds4PL.mjs +1750 -0
  106. package/dist/readTestimonialTextMeasure-BIXpGFEt.mjs +13 -0
  107. package/dist/readTestimonialTextMeasure-CEPaB4Sy.js +1 -0
  108. package/dist/scalingValue-C9JH5L6O.mjs +6 -0
  109. package/dist/scalingValue-CSHYgTZl.js +1 -0
  110. package/dist/sources.d.ts +1 -0
  111. package/dist/sources.js +23753 -0
  112. package/dist/sources.mjs +23779 -0
  113. package/dist/textStylesToCss-05Mn6I_2.mjs +32 -0
  114. package/dist/textStylesToCss-CNN3zZTV.js +1 -0
  115. package/dist/types/Component.d.ts +0 -1
  116. package/dist/useLightboxScrollLock-Hf16Eq4g.js +1 -0
  117. package/dist/useLightboxScrollLock-VQ07s7EJ.mjs +18 -0
  118. package/dist/useLightboxSwipeDismiss-Br9uE5G0.js +1 -0
  119. package/dist/useLightboxSwipeDismiss-SGv6Ra33.mjs +95 -0
  120. package/dist/useScopedStyles-Bf6yohVQ.js +1 -0
  121. package/dist/useScopedStyles-DhBG3557.mjs +11 -0
  122. package/dist/utils-033j3qNL.js +1 -0
  123. package/dist/utils-FxC9rcxw.mjs +247 -0
  124. package/dist/utils.js +1 -1
  125. package/dist/utils.mjs +17 -11
  126. package/package.json +31 -2
  127. package/dist/index-2JTNRDR1.js +0 -1
  128. package/dist/index-DA8t6EZ4.mjs +0 -255
  129. package/dist/panelAvailability-CgSic84c.mjs +0 -126
  130. package/dist/panelAvailability-D8c7cdbu.js +0 -1
@@ -0,0 +1,231 @@
1
+ "use strict";var Eo=Object.create;var _n=Object.defineProperty;var Ao=Object.getOwnPropertyDescriptor;var ko=Object.getOwnPropertyNames;var Lo=Object.getPrototypeOf,bo=Object.prototype.hasOwnProperty;var Ro=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ko(e))!bo.call(t,i)&&i!==n&&_n(t,i,{get:()=>e[i],enumerable:!(o=Ao(e,i))||o.enumerable});return t};var at=(t,e,n)=>(n=t!=null?Eo(Lo(t)):{},Ro(e||!t||!t.__esModule?_n(n,"default",{value:t,enumerable:!0}):n,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("react/jsx-runtime"),u=require("react"),me=require("./scalingValue-CSHYgTZl.js"),No=require("./useScopedStyles-Bf6yohVQ.js"),eo=require("./textStylesToCss-CNN3zZTV.js"),Xo=require("react-dom"),Dn=120,Yn=3,_o=.12,Mn={x:0,y:0,width:100,height:100};function Me(t,e){return t.map(n=>n.map(o=>({x:(o.x-e.x)/e.width,y:(o.y-e.y)/e.height})))}function je(t){return t<0?0:t>1?1:t}function Tn(t,e){return t.filter(n=>n.length>0).map(n=>`M ${n.map(o=>`${o.x*e.width} ${o.y*e.height}`).join(" L ")} Z`).join(" ")}function Do(t,e){let n=1/0,o=1/0,i=-1/0,r=-1/0;for(const a of t)for(const f of a){const h=f.x*e.width,b=f.y*e.height;h<n&&(n=h),h>i&&(i=h),b<o&&(o=b),b>r&&(r=b)}const c=i-n,l=r-o;return!isFinite(c)||!isFinite(l)||c<=0||l<=0?null:{x:n,y:o,width:c,height:l}}function Yo(t){return t.map(([e,n])=>({x:e,y:n}))}function qe(t){let e=1/0,n=1/0,o=-1/0,i=-1/0;for(const l of t)for(const a of l)a.x<e&&(e=a.x),a.x>o&&(o=a.x),a.y<n&&(n=a.y),a.y>i&&(i=a.y);const r=o-e,c=i-n;return!isFinite(r)||!isFinite(c)||r<=0||c<=0?t:t.map(l=>l.map(a=>({x:(a.x-e)/r,y:(a.y-n)/c})))}function To(t,e){const n=[];for(const i of t)for(let r=0;r<i.length;r+=1){const c=i[r],l=i[(r+1)%i.length];(c.y<=e&&l.y>e||l.y<=e&&c.y>e)&&n.push(c.x+(e-c.y)/(l.y-c.y)*(l.x-c.x))}n.sort((i,r)=>i-r);const o=[];for(let i=0;i+1<n.length;i+=2){const r=je(n[i]),c=je(n[i+1]);c>r&&o.push({x0:r,x1:c})}return jo(o)}function jo(t){if(t.length<2)return t;const e=[...t].sort((o,i)=>o.x0-i.x0),n=[e[0]];for(let o=1;o<e.length;o+=1){const i=n[n.length-1],r=e[o];r.x0<=i.x1?i.x1=Math.max(i.x1,r.x1):n.push({...r})}return n}function Po(t,e){const n=[];let o=0,i=0;for(;o<t.length&&i<e.length;){const r=Math.max(t[o].x0,e[i].x0),c=Math.min(t[o].x1,e[i].x1);c>r&&n.push({x0:r,x1:c}),t[o].x1<e[i].x1?o+=1:i+=1}return n}function Ho(t){const e=[];let n=0;for(const o of t)o.x0>n&&e.push({x0:n,x1:o.x0}),n=Math.max(n,o.x1);return n<1&&e.push({x0:n,x1:1}),e}function Oo(t,e){const n=[];for(const o of t){if(e.x1<=o.x0||e.x0>=o.x1){n.push(o);continue}e.x0>o.x0&&n.push({x0:o.x0,x1:e.x0}),e.x1<o.x1&&n.push({x0:e.x1,x1:o.x1})}return n}function zo(t,e,n,o){let i=null;for(let r=0;r<Yn;r+=1){const c=je(e+(n-e)*r/Math.max(1,Yn-1)),l=To(t,c),a=o==="avoid"?Ho(l):l;if(i=i===null?a:Po(i,a),i.length===0)return[]}return i??[]}function jn(t,e="stretch",n=Mn){const o=t.trim();if(!o)return null;if(/^[Mm]/.test(o)){const c=te(o),l=Ce(c);if(l.length)return e==="viewbox"?Me(l,n):qe(l);if(typeof document>"u")return null;const a=o.split(/(?=[Mm])/).map(b=>b.trim()).filter(Boolean),f=document.createElementNS("http://www.w3.org/2000/svg","svg"),h=[];for(const b of a){const X=document.createElementNS("http://www.w3.org/2000/svg","path");X.setAttribute("d",b),f.appendChild(X);let F=0;try{F=X.getTotalLength()}catch{F=0}if(!F)continue;const y=[];for(let D=0;D<Dn;D+=1){const A=X.getPointAtLength(D/Dn*F);y.push({x:A.x,y:A.y})}h.push(y)}return h.length?e==="viewbox"?Me(h,n):qe(h):null}const i=o.split(/[\s,]+/).map(Number).filter(c=>!Number.isNaN(c));if(i.length<6)return null;const r=[];for(let c=0;c+1<i.length;c+=2)r.push({x:i[c],y:i[c+1]});return e==="viewbox"?Me([r],n):qe([r])}const Cn={bobbin:"M57.63,0 L57.63,37.24 L74.66,37.24 L74.66,56.07 L57.63,100 L33.84,100 L16.81,56.07 L16.81,37.24 L33.84,37.24 L33.84,0 Z",circle:"M50,0 C77.61,0 100,22.39 100,50 C100,77.61 77.61,100 50,100 C22.39,100 0,77.61 0,50 C0,22.39 22.39,0 50,0 Z",shield:"M0,0 L100,0 L100,50 L50,100 L0,50 Z",vase:"M25.37,0 L91.55,0 C91.55,0 74.8,25.14 83.07,50.03 C91.34,74.92 74.61,100 74.61,100 L8.43,100 C8.43,100 32.3,75.08 23.9,50 C15.5,24.92 25.37,0 25.37,0 Z",parallelogram:"M25.37,0 L91.55,0 L74.61,100 L8.43,100 Z",diamond:"M50,0 L80,50 L50,100 L20,50 Z"},Pe="0 0 100 100",He=100,on=16,Wo=12,vo=16,Qe=/([MmZzLlHhVvCcSsQqTtAa])([^MmZzLlHhVvCcSsQqTtAa]*)/g,Vo=/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g,Pn=Math.PI/4,Go=8,Ko=Math.PI/18,Zo=8,ye=24,ge=[];function qo(){return[{closed:!0,nodes:[{p:{x:0,y:0},in:null,out:null},{p:{x:1,y:0},in:null,out:null},{p:{x:1,y:1},in:null,out:null},{p:{x:0,y:1},in:null,out:null}]}]}function Je(t,e){return Ft(t,n=>({x:(n.x-e.x)/e.width,y:(n.y-e.y)/e.height}))}function Qo(t){const e=oe(t),n=e.maxX-e.minX,o=e.maxY-e.minY;return!isFinite(n)||!isFinite(o)||n<=0||o<=0?t:Ft(t,i=>({x:(i.x-e.minX)/n,y:(i.y-e.minY)/o}))}function Jo(t,e){if(!(e.width>0)||!(e.height>0))return t;const n=Math.min(e.width,e.height),o=(e.width-n)/2,i=(e.height-n)/2;return Ft(t,r=>({x:(o+r.x*n)/e.width,y:(i+r.y*n)/e.height}))}function Hn(t,e,n,o,i,r){let c=[];if(e&&e.length)c=Je(e,o);else{const l=t.trim();if(l&&/^[Mm]/.test(l)){const a=te(l);a.length&&(c=n==="viewbox"?Je(a,o):Qo(a))}if(!c.length){const a=i!=="custom"?Cn[i]:void 0;a?c=Je(te(a),Mn):c=qo()}}return i==="circle"?Jo(c,r):c}function On(t,e){return!(e.width>0)||!(e.height>0)||!t.length?"":le(Ft(t,n=>({x:n.x*e.width,y:n.y*e.height})))}function rn(t){const e=t==="rectangle"||t==="custom"?void 0:Cn[t];return e?Me(Ce(te(e)),Mn):[Yo([[0,0],[1,0],[1,1],[0,1]])]}function Uo(t){const e=t.match(Vo);return e?e.map(Number).filter(n=>!Number.isNaN(n)):[]}function Ot(t,e,n){return{x:t.x+(e.x-t.x)*n,y:t.y+(e.y-t.y)*n}}function cn(t,e){return{x:e.x*2-t.x,y:e.y*2-t.y}}function Rt(t){return{x:t.x,y:t.y}}function Bo(t){return{p:Rt(t.p),in:t.in?Rt(t.in):null,out:t.out?Rt(t.out):null}}function Jt(t){return t.map(e=>({closed:e.closed,nodes:e.nodes.map(Bo)}))}function Ft(t,e){return t.map(n=>({closed:n.closed,nodes:n.nodes.map(o=>({p:e(o.p),in:o.in?e(o.in):null,out:o.out?e(o.out):null}))}))}function sn(t,e,n,o=n){return Ft(t,i=>({x:e.x+(i.x-e.x)*n,y:e.y+(i.y-e.y)*o}))}function tr(t,e,n,o,i,r,c){let l=Math.abs(e),a=Math.abs(n);if(!l||!a||t.x===c.x&&t.y===c.y)return[{c1:Rt(t),c2:Rt(c),p:Rt(c)}];const f=o*Math.PI/180,h=Math.cos(f),b=Math.sin(f),X=(t.x-c.x)/2,F=(t.y-c.y)/2,y=h*X+b*F,D=-b*X+h*F,A=y*y/(l*l)+D*D/(a*a);if(A>1){const O=Math.sqrt(A);l*=O,a*=O}const H=i===r?-1:1,x=l*l*D*D+a*a*y*y,Y=Math.max(0,l*l*a*a-x),k=x===0?0:H*Math.sqrt(Y/x),Q=k*l*D/a,xt=-k*a*y/l,ut=h*Q-b*xt+(t.x+c.x)/2,dt=b*Q+h*xt+(t.y+c.y)/2,rt=Math.atan2((D-xt)/a,(y-Q)/l);let L=Math.atan2((-D-xt)/a,(-y-Q)/l)-rt;!r&&L>0&&(L-=Math.PI*2),r&&L<0&&(L+=Math.PI*2);const gt=Math.max(1,Math.ceil(Math.abs(L)/(Math.PI/2))),S=L/gt,g=4/3*Math.tan(S/4),C=(O,_)=>({x:ut+h*l*O-b*a*_,y:dt+b*l*O+h*a*_}),T=[];let W=rt;for(let O=0;O<gt;O+=1){const _=W+S,d=Math.cos(W),Z=Math.sin(W),q=Math.cos(_),it=Math.sin(_);T.push({c1:C(d-g*Z,Z+g*d),c2:C(q+g*it,it-g*q),p:O===gt-1?Rt(c):C(q,it)}),W=_}return T}function te(t){const e=(t??"").trim();if(!e)return[];const n=[];let o=[],i=!1,r={x:0,y:0},c={x:0,y:0},l=null,a=null;const f=()=>{if(i&&o.length>2){const F=o[0],y=o[o.length-1];Math.abs(F.p.x-y.p.x)<1e-6&&Math.abs(F.p.y-y.p.y)<1e-6&&(F.in=y.in??F.in,o.pop())}o.length>1&&n.push({nodes:o,closed:i}),o=[],i=!1},h=(F,y)=>{o.push({p:F,in:Ut(y??null,F),out:null}),r=F},b=F=>{if(!o.length)return;const y=o[o.length-1];y.out=Ut(F,y.p)};Qe.lastIndex=0;let X=Qe.exec(e);for(;X!==null;){const F=X[1],y=F.toUpperCase(),D=F!==y,A=Uo(X[2]),H=x=>D?{x:r.x+A[x],y:r.y+A[x+1]}:{x:A[x],y:A[x+1]};if(y==="Z")i=!0,f(),r=Rt(c),l=null,a=null;else if(y==="M"){for(let x=0;x+1<A.length;x+=2){const Y=H(x);x===0&&(f(),c=Rt(Y)),h(Y)}l=null,a=null}else if(y==="L"){for(let x=0;x+1<A.length;x+=2)h(H(x));l=null,a=null}else if(y==="H"){for(const x of A)h({x:D?r.x+x:x,y:r.y});l=null,a=null}else if(y==="V"){for(const x of A)h({x:r.x,y:D?r.y+x:x});l=null,a=null}else if(y==="C"){for(let x=0;x+5<A.length;x+=6){const Y=H(x),k=H(x+2),Q=H(x+4);b(Y),h(Q,k),l=k}a=null}else if(y==="S"){for(let x=0;x+3<A.length;x+=4){const Y=l?cn(l,r):Rt(r),k=H(x),Q=H(x+2);b(Y),h(Q,k),l=k}a=null}else if(y==="Q")for(let x=0;x+3<A.length;x+=4){const Y=H(x),k=H(x+2);b(Ot(r,Y,2/3)),h(k,Ot(k,Y,2/3)),a=Y,l=null}else if(y==="T")for(let x=0;x+1<A.length;x+=2){const Y=a?cn(a,r):Rt(r),k=H(x);b(Ot(r,Y,2/3)),h(k,Ot(k,Y,2/3)),a=Y,l=null}else if(y==="A")for(let x=0;x+6<A.length;x+=7){const Y=D?{x:r.x+A[x+5],y:r.y+A[x+6]}:{x:A[x+5],y:A[x+6]};for(const k of tr(r,A[x],A[x+1],A[x+2],A[x+3]!==0,A[x+4]!==0,Y))b(k.c1),h(k.p,k.c2);l=null,a=null}X=Qe.exec(e)}return f(),n}function qt(t){return`${Number(t.toFixed(2))}`}function Ut(t,e){return!t||Math.abs(t.x-e.x)<1e-6&&Math.abs(t.y-e.y)<1e-6?null:t}function no(t){return!!(Ut(t.in,t.p)||Ut(t.out,t.p))}function Se(t,e){return!Ut(t.out,t.p)&&!Ut(e.in,e.p)}function zn(t,e){if(Se(t,e))return`L${qt(e.p.x)},${qt(e.p.y)}`;const n=Ut(t.out,t.p)??t.p,o=Ut(e.in,e.p)??e.p;return`C${qt(n.x)},${qt(n.y)} ${qt(o.x)},${qt(o.y)} ${qt(e.p.x)},${qt(e.p.y)}`}function le(t){const e=[];for(const n of t){if(n.nodes.length<2)continue;const[o,...i]=n.nodes;e.push(`M${qt(o.p.x)},${qt(o.p.y)}`);let r=o;for(const c of i)e.push(zn(r,c)),r=c;if(n.closed){const c=zn(r,o);c.charAt(0)==="C"&&e.push(c),e.push("Z")}}return e.join(" ")}function oo(t){const e=[];for(let n=0;n+1<t.nodes.length;n+=1)e.push({from:t.nodes[n],to:t.nodes[n+1],index:n});if(t.closed&&t.nodes.length>2){const n=t.nodes.length-1;e.push({from:t.nodes[n],to:t.nodes[0],index:n})}return e}function an(t,e,n){if(Se(t,e))return Ot(t.p,e.p,n);const o=t.out??t.p,i=e.in??e.p,r=1-n,c=r*r*r,l=3*r*r*n,a=3*r*n*n,f=n*n*n;return{x:c*t.p.x+l*o.x+a*i.x+f*e.p.x,y:c*t.p.y+l*o.y+a*i.y+f*e.p.y}}function Ce(t){const e=[];for(const n of t){if(n.nodes.length<2)continue;const o=[];for(const i of oo(n)){if(Se(i.from,i.to)){o.push(Rt(i.from.p));continue}for(let r=0;r<on;r+=1)o.push(an(i.from,i.to,r/on))}n.closed||o.push(Rt(n.nodes[n.nodes.length-1].p)),o.length>2&&e.push(o)}return e}function oe(t){let e=1/0,n=1/0,o=-1/0,i=-1/0;for(const r of Ce(t))for(const c of r)c.x<e&&(e=c.x),c.x>o&&(o=c.x),c.y<n&&(n=c.y),c.y>i&&(i=c.y);return{minX:e,minY:n,maxX:o,maxY:i}}function er(t){const e=oe(t);return!isFinite(e.minX)||!isFinite(e.maxX)||!isFinite(e.minY)||!isFinite(e.maxY)?null:{x:(e.minX+e.maxX)/2,y:(e.minY+e.maxY)/2}}function ro(t,e,n){const o={x:(n.x-t.x)/6,y:(n.y-t.y)/6};return{in:{x:e.x-o.x,y:e.y-o.y},out:{x:e.x+o.x,y:e.y+o.y}}}function Sn(t){return t.filter(e=>e.length>2).map(e=>{if(e.length<=Wo)return{closed:!0,nodes:e.map(r=>({p:Rt(r),in:null,out:null}))};const n=Math.max(1,Math.round(e.length/vo)),o=[];for(let r=0;r<e.length;r+=n)o.push(e[r]);const i=o.length;return{closed:!0,nodes:o.map((r,c)=>({p:Rt(r),...ro(o[(c-1+i)%i],r,o[(c+1)%i])}))}})}function io(t,e,n=1){if(!t.length)return!1;const o=oe(t);if(!isFinite(o.minX)||!isFinite(o.maxX))return!1;const i=o.maxX-o.minX,r=o.maxY-o.minY;if(i<=e.width*2.5&&r<=e.height*2.5)return!1;const c=Math.max(n,e.width*.5),l=Math.max(n,e.height*.5);return o.minX<e.x-c||o.minY<e.y-l||o.maxX>e.x+e.width+c||o.maxY>e.y+e.height+l}function nr(t,e,n,o,i,r,c){const l=e.width>0?n.width/e.width:1,a=e.height>0?n.height/e.height:1;return!(r>0)||!(c>0)||!(l>0)||!(a>0)?t:Ft(t,f=>{const h=o+(f.x-e.x)*r,b=i+(f.y-e.y)*c;return{x:e.x+h/l,y:e.y+b/a}})}function or(t,e){if(!t.length)return t;const n=oe(t),o=n.maxX-n.minX,i=n.maxY-n.minY;if(!(o>0)||!(i>0)||n.minX>=e.x-1e-6&&n.minY>=e.y-1e-6&&n.maxX<=e.x+e.width+1e-6&&n.maxY<=e.y+e.height+1e-6)return t;const c=Math.min(e.width/o,e.height/i),l=e.x+(e.width-o*c)/2,a=e.y+(e.height-i*c)/2;return Ft(t,f=>({x:l+(f.x-n.minX)*c,y:a+(f.y-n.minY)*c}))}function rr(t){const e={x:0,y:0,width:He,height:He},n=t!=="custom"?Cn[t]:void 0,o=n?Ft(te(n),r=>({x:r.x/100*e.width+e.x,y:r.y/100*e.height+e.y})):Ft(Sn(rn("rectangle")),r=>({x:r.x*e.width+e.x,y:r.y*e.height+e.y})),i=or(o,e);return{shape:t,customPath:le(i),pathFit:"viewbox",pathViewBox:Pe}}function Ne(t,e){return e>0?Math.round(t/e)*e:t}function co(t,e,n,o){var f;const i=(f=t[e])==null?void 0:f.nodes[n];if(!i)return t;const r=o.x-i.p.x,c=o.y-i.p.y,l=Jt(t),a=l[e].nodes[n];return a.p={x:i.p.x+r,y:i.p.y+c},a.in&&(a.in={x:a.in.x+r,y:a.in.y+c}),a.out&&(a.out={x:a.out.x+r,y:a.out.y+c}),l}function ln(t,e,n,o){var r;if(!e.length)return t;const i=Jt(t);for(const{contour:c,node:l}of e){const a=(r=i[c])==null?void 0:r.nodes[l];a&&(a.p={x:a.p.x+n,y:a.p.y+o},a.in&&(a.in={x:a.in.x+n,y:a.in.y+o}),a.out&&(a.out={x:a.out.x+n,y:a.out.y+o}))}return i}function so(t,e){const n=new Map;for(const{contour:i,node:r}of e){const c=n.get(i)??[];c.push(r),n.set(i,c)}let o=t;return n.forEach((i,r)=>{const c=[...i].sort((l,a)=>a-l);for(const l of c)o=$n(o,r,l)}),o}function ao(t,e,n,o,i,r){var f;if(!((f=t[e])==null?void 0:f.nodes[n]))return t;const l=Jt(t),a=l[e].nodes[n];if(a[o]=Rt(i),r){const h=o==="in"?"out":"in";a[h]=cn(i,a.p)}return l}function lo(t,e,n,o){var c;const i=(c=t[e])==null?void 0:c.nodes[n];if(!i||!i[o])return t;const r=Jt(t);return r[e].nodes[n][o]=null,r}function ho(t,e,n,o){const i=t[e];if(!i)return{contours:t,nodeIndex:-1};const r=i.nodes[n],c=i.nodes[(n+1)%i.nodes.length];if(!r||!c)return{contours:t,nodeIndex:-1};const l=Jt(t),a=l[e].nodes,f=n+1;if(Se(r,c))return a.splice(f,0,{p:Ot(r.p,c.p,o),in:null,out:null}),{contours:l,nodeIndex:f};const h=r.out??r.p,b=c.in??c.p,X=Ot(r.p,h,o),F=Ot(h,b,o),y=Ot(b,c.p,o),D=Ot(X,F,o),A=Ot(F,y,o),H=Ot(D,A,o),x=(n+1)%i.nodes.length;return a[n].out=X,a[x].in=y,a.splice(f,0,{p:H,in:D,out:A}),{contours:l,nodeIndex:f}}function $n(t,e,n){const o=t[e];if(!o||o.nodes.length<=3)return t;const i=Jt(t);return i[e].nodes.splice(n,1),i}function hn(t,e,n){const o=t[e];if(!(o==null?void 0:o.nodes[n]))return t;const r=Jt(t),c=r[e].nodes,l=c[n],a=c.length,f=(n-1+a)%a,h=(n+1)%a,b=!!Ut(c[f].out,c[f].p),X=!!Ut(c[h].in,c[h].p);if(no(l)||b||X)return l.in=null,l.out=null,c[f].out=null,c[h].in=null,r;const F=ro(c[f].p,l.p,c[h].p);return l.in=F.in,l.out=F.out,r}function ir(t,e,n){const o=n.x-e.x,i=n.y-e.y,r=o*o+i*i,c=r===0?0:Math.max(0,Math.min(1,((t.x-e.x)*o+(t.y-e.y)*i)/r)),l={x:e.x+o*c,y:e.y+i*c};return{t:c,distance:Math.hypot(t.x-l.x,t.y-l.y),point:l}}function un(t,e){let n=null;return t.forEach((o,i)=>{for(const r of oo(o)){const c=Se(r.from,r.to)?1:on;for(let l=0;l<c;l+=1){const a=l/c,f=(l+1)/c,h=ir(e,an(r.from,r.to,a),an(r.from,r.to,f));(!n||h.distance<n.distance)&&(n={contour:i,segment:r.index,t:a+(f-a)*h.t,distance:h.distance,point:h.point})}}}),n}function cr(t,e){const n=[];return t.forEach((o,i)=>{o.nodes.forEach((r,c)=>{i===e.contour&&c===e.node||n.push(r.p)})}),n}function Wn(t,e,n){const o=e.filter((r,c)=>isFinite(r)&&e.findIndex(l=>Math.abs(l-r)<1e-6)===c),i=o.map(r=>({value:r,axis:r,from:null}));for(const r of t)i.push({value:r[n],axis:null,from:r});for(const r of o)for(const c of t)i.push({value:r*2-c[n],axis:r,from:c});return i}function vn(t,e,n,o,i){const r=o(e)[n];let c=null,l=1/0;for(const a of t){const f=n==="x"?{x:a.value,y:e.y}:{x:e.x,y:a.value},h=Math.abs(o(f)[n]-r);h>i||c&&h>=l||(c=a,l=h)}return c}function sr(t,e){return t.length===e.length&&t.every((n,o)=>n.kind===e[o].kind&&n.a.x===e[o].a.x&&n.a.y===e[o].a.y&&n.b.x===e[o].b.x&&n.b.y===e[o].b.y)}function ar(t){const e=Math.PI*2;return((t+Math.PI)%e+e)%e-Math.PI}function dn(t,e){const n=e.x-t.x,o=e.y-t.y,i=Math.hypot(n,o);return i<1e-6?null:{x:n/i,y:o/i}}function lr(t,e){const n=dn(t,e);return n?{kind:"align",a:{x:t.x-n.x*ye,y:t.y-n.y*ye},b:{x:e.x+n.x*ye,y:e.y+n.y*ye}}:{kind:"align",a:t,b:e}}function fn(t,e,n){return e==="x"?{kind:"center",a:{x:t,y:0},b:{x:t,y:n.height}}:{kind:"center",a:{x:0,y:t},b:{x:n.width,y:t}}}function Vn(t,e,n,o,i){if(t.axis===null)return lr(n,i(t.from??n));const r=e==="x"?{x:t.axis,y:0}:{x:0,y:t.axis};return fn(i(r)[e],e,o)}function hr(t,e,n,o,i){const r=[],c=i(t);return e&&t.x===e.value&&r.push(Vn(e,"x",c,o,i)),n&&t.y===n.value&&r.push(Vn(n,"y",c,o,i)),r}function ur(t,e,n,o){const i=t==null?void 0:t.nodes[e];if(!t||!i)return null;const r=o(i.p),c=n==="in"?i.out:i.in;if(c)return dn(o(c),r);const l=t.nodes.length,a=e+(n==="in"?1:-1);if(!t.closed&&(a<0||a>=l))return null;const f=t.nodes[(a+l)%l];if(!f)return null;const h=(n==="in"?f.in:f.out)??f.p;return dn(o(h),r)}function dr(t,e,n,o,i,r,c){const l=r(e),a=r(t),f=a.x-l.x,h=a.y-l.y,b=Math.hypot(f,h);if(b<1e-6)return{point:t,guides:ge};const X=Math.atan2(h,f),F=Math.round(X/Pn)*Pn;let y=i?F:null,D=!1;if(!i){const xt=[];n&&xt.push({angle:Math.atan2(n.y,n.x),smooth:!0}),xt.push({angle:F,smooth:!1});for(const ut of xt){const dt=ar(ut.angle-X);if(!(Math.abs(dt)>Ko)&&!(Math.abs(Math.sin(dt))*b>Go)){y=ut.angle,D=ut.smooth;break}}}const A=o!==null&&o>0&&Math.abs(b-o)<=Zo;if(y===null&&!A)return{point:t,guides:ge};const H=y??X,x=A?o:b,Y={x:Math.cos(H),y:Math.sin(H)},k=x+(y===null?0:ye),Q=A?x:D?ye:0;return{point:c({x:l.x+Y.x*x,y:l.y+Y.y*x}),guides:[{kind:"angle",a:{x:l.x-Y.x*Q,y:l.y-Y.y*Q},b:{x:l.x+Y.x*k,y:l.y+Y.y*k}}]}}const pn=.1,mn=8,fr=4,Gn=10,Oe=(t,e)=>{switch(e){case"nw":return{x:t.minX,y:t.minY};case"ne":return{x:t.maxX,y:t.minY};case"se":return{x:t.maxX,y:t.maxY};case"sw":return{x:t.minX,y:t.maxY}}},uo=t=>{switch(t){case"nw":return"se";case"ne":return"sw";case"se":return"nw";case"sw":return"ne"}},xn=(t,e)=>{const n=Oe(t,e),o=e==="nw"||e==="sw"?-1:1,i=e==="nw"||e==="ne"?-1:1;return{x:n.x+o*Gn,y:n.y+i*Gn}},yn=(t,e)=>!(e.width>0)||!(e.height>0)||!(t.width>0)||!(t.height>0)?1:Math.max(t.width/e.width,t.height/e.height),ae=(t,e,n)=>{const o=yn(t,e)*n;return{width:e.width*o,height:e.height*o}},Qt=(t,e,n)=>(t-e)*n,we=(t,e,n,o)=>{const i=t-e;if(Math.abs(i)<1e-6)return .5;const r=n/i;return(o==null?void 0:o.clamp)===!1?r:Math.abs(i)<fr?.5:je(r)},pr=(t,e,n,o,i,r)=>{const c=ae(t,n,r),l=t.x+Qt(t.width,c.width,o),a=t.y+Qt(t.height,c.height,i),f=yn(t,n),h=yn(e,n),b=Math.min(mn,Math.max(pn,h>0?r*(f/h):r)),X=ae(e,n,b);return{focalX:we(e.width,X.width,l-e.x,{clamp:!1}),focalY:we(e.height,X.height,a-e.y,{clamp:!1}),scale:b}},mr=6,xr=3,yr=2,Ue="­",gr=new RegExp("\\p{L}","gu"),Kn=20,wr={arb:"ar",azj:"az",bel:"be",bos:"bs",bul:"bg",ces:"cs",deu:"de",eng:"en",fas:"fa",fra:"fr",hau:"ha",hin:"hi",hrv:"hr",hun:"hu",ibo:"ig",ind:"id",ita:"it",jav:"jv",kaz:"kk",kin:"rw",lin:"ln",mar:"mr",nep:"ne",nld:"nl",nya:"ny",pol:"pl",por:"pt",ron:"ro",run:"rn",rus:"ru",som:"so",spa:"es",srp:"sr",sun:"su",swe:"sv",swh:"sw",tgl:"tl",tur:"tr",ukr:"uk",urd:"ur",uzn:"uz",vie:"vi",yor:"yo",zlm:"ms",zul:"zu"},gn={be:()=>import("./index-B1vNL0m-.js").then(t=>t.index),bg:()=>import("./index-kFrlcZxC.js").then(t=>t.index),cs:()=>import("./index-B6E31HBG.js").then(t=>t.index),de:()=>import("./index-CNFsG2yO.js").then(t=>t.index),en:()=>import("./index-x_p4zv7D.js").then(t=>t.index),"en-gb":()=>import("./index-BkmSPu6z.js").then(t=>t.index),es:()=>import("./index-CADju5Cy.js").then(t=>t.index),fr:()=>import("./index-Rwqfce2n.js").then(t=>t.index),hi:()=>import("./index-HhE2sJlU.js").then(t=>t.index),hr:()=>import("./index-DapMA5nM.js").then(t=>t.index),hu:()=>import("./index-kjKI70JX.js").then(t=>t.index),id:()=>import("./index-BlAuAthm.js").then(t=>t.index),it:()=>import("./index-BK-G0i5L.js").then(t=>t.index),mr:()=>import("./index-CIgabTwE.js").then(t=>t.index),nl:()=>import("./index-BrL2zv3x.js").then(t=>t.index),pl:()=>import("./index-DehKWXGA.js").then(t=>t.index),pt:()=>import("./index-C0cxTf5o.js").then(t=>t.index),ro:()=>import("./index-CJ0NMfJ3.js").then(t=>t.index),ru:()=>import("./index-gBhj9Tcu.js").then(t=>t.index),sr:()=>import("./index-1HMblVmZ.js").then(t=>t.index),sv:()=>import("./index-CDO1-R3j.js").then(t=>t.index),tr:()=>import("./index-CG_43X7q.js").then(t=>t.index),uk:()=>import("./index-Ypt3vHbi.js").then(t=>t.index)},fo=(t,e)=>{const n=t;return e(n)??e(n.default)??null};let Be=null;const Mr=()=>(Be??(Be=import("franc-min").then(t=>fo(t,e=>typeof e=="function"?e:void 0)).catch(t=>(console.warn("Pretext: failed to load franc-min, using the page language for hyphenation",t),Be=null,null))),Be),tn=new Map,Cr=t=>{let e=tn.get(t);return e||(e=gn[t]().then(n=>fo(n,o=>o==null?void 0:o.hyphenateSync)).catch(n=>(console.warn(`Pretext: failed to load "${t}" hyphenation patterns`,n),tn.delete(t),null)),tn.set(t,e)),e},Zn=t=>{if(!t)return null;const e=t.toLowerCase();if(gn[e])return e;const n=e.split("-")[0];return gn[n]?n:null},Sr=(t,e)=>{const n=e.trim();if(n.length<Kn)return;const o=t(n,{minLength:Kn});if(o!=="und")return wr[o]??o},$r={hyphenateSync:null};function Fr(t,e){const[n,o]=u.useState(null);return u.useEffect(()=>{if(!t)return;let i=!1;return Mr().then(async r=>{const c=r?Sr(r,e):void 0,l=typeof document<"u"?document.documentElement.lang:"",a=Zn(c)??Zn(l)??"en",f=await Cr(a);i||o({lang:c,hyphenateSync:f})}),()=>{i=!0}},[t,e]),t&&n?n:$r}const qn=t=>{var e;return((e=t.match(gr))==null?void 0:e.length)??0};function Ir(t,e){if(t.length<2||t.includes(Ue))return;const n=new Set;if(e){const i=e(t,{hyphenChar:Ue,minWordLength:mr});let r=0;for(let c=0;c<i.length;c+=1)i[c]===Ue?n.add(r):r+=1}for(let i=1;i<t.length-1;i+=1)t[i-1]==="-"&&n.add(i);const o=[...n].filter(i=>{const r=t[i-1]==="-";return i>0&&i<t.length&&qn(t.slice(0,i))>=(r?1:xr)&&qn(t.slice(i))>=(r?1:yr)}).sort((i,r)=>i-r);return o.length?o:void 0}const Qn=1.08,Xe=14,_e=8;function Er({P:t,box:e,bounds:n,natural:o,imageUrl:i,maskPath:r,stage:c,onStageChange:l,focalX:a,focalY:f,scale:h,onChange:b,onCommit:X}){const F=u.useRef(null),y=`pretext-image-ghost-${u.useId().replace(/:/g,"")}`,D=u.useRef(null),A=u.useRef(null),H=u.useRef({focalX:a,focalY:f,scale:h});H.current={focalX:a,focalY:f,scale:h};const x=c==="image";u.useEffect(()=>{var S;x&&((S=F.current)==null||S.focus({preventScroll:!0}))},[x]);const Y=u.useCallback((S,g)=>{var T;const C=(T=F.current)==null?void 0:T.getBoundingClientRect();return!C||C.width<=0||C.height<=0?{x:0,y:0}:{x:(S-C.left)/C.width*e.width,y:(g-C.top)/C.height*e.height}},[e.width,e.height]),k=S=>{var C,T;if(!o)return;S.stopPropagation(),S.preventDefault(),(C=F.current)==null||C.focus({preventScroll:!0});const g=ae(n,o,h);D.current={pointerId:S.pointerId,origin:Y(S.clientX,S.clientY),startX:Qt(n.width,g.width,a),startY:Qt(n.height,g.height,f),width:g.width,height:g.height,moved:!1},(T=F.current)==null||T.setPointerCapture(S.pointerId)},Q=(S,g)=>{var q,it;if(!o)return;S.stopPropagation(),S.preventDefault(),(q=F.current)==null||q.focus({preventScroll:!0});const C=ae(n,o,h),T=Qt(n.width,C.width,a),W=Qt(n.height,C.height,f),O={minX:T,minY:W,maxX:T+C.width,maxY:W+C.height},_=Oe(O,uo(g)),d=Oe(O,g),Z=Math.hypot(d.x-_.x,d.y-_.y);!isFinite(Z)||Z<=0||(A.current={pointerId:S.pointerId,anchor:_,startDistance:Z,startScale:h,startX:T,startY:W,moved:!1},(it=F.current)==null||it.setPointerCapture(S.pointerId))},xt=S=>{if(!o)return;const g=A.current;if(g&&S.pointerId===g.pointerId){S.stopPropagation(),S.preventDefault();const T=Y(S.clientX,S.clientY),W={x:T.x-n.x,y:T.y-n.y},O=Math.hypot(W.x-g.anchor.x,W.y-g.anchor.y),_=Math.min(mn,Math.max(pn,g.startScale*(O/g.startDistance)));if(!g.moved&&Math.abs(_-g.startScale)<1e-4)return;g.moved=!0;const d=_/g.startScale,Z=g.anchor.x+(g.startX-g.anchor.x)*d,q=g.anchor.y+(g.startY-g.anchor.y)*d,it=ae(n,o,_);b({focalX:we(n.width,it.width,Z),focalY:we(n.height,it.height,q),scale:_});return}const C=D.current;if(C&&S.pointerId===C.pointerId){S.stopPropagation(),S.preventDefault();const T=Y(S.clientX,S.clientY),W=T.x-C.origin.x,O=T.y-C.origin.y;if(!C.moved&&W===0&&O===0)return;C.moved=!0,b({focalX:we(n.width,C.width,C.startX+W),focalY:we(n.height,C.height,C.startY+O),scale:h})}},ut=S=>{var T,W;const g=D.current;if(g&&S.pointerId===g.pointerId){D.current=null,S.stopPropagation(),(T=F.current)!=null&&T.hasPointerCapture(g.pointerId)&&F.current.releasePointerCapture(g.pointerId),g.moved&&X(H.current);return}const C=A.current;C&&S.pointerId===C.pointerId&&(A.current=null,S.stopPropagation(),(W=F.current)!=null&&W.hasPointerCapture(C.pointerId)&&F.current.releasePointerCapture(C.pointerId),C.moved&&X(H.current))},dt=S=>{if(S.key==="Escape"){S.stopPropagation(),l("none");return}if(S.key==="="||S.key==="+"||S.key==="-"||S.key==="_"){S.preventDefault(),S.stopPropagation();const g=S.key==="="||S.key==="+",C=Math.min(mn,Math.max(pn,h*(g?Qn:1/Qn))),T={focalX:a,focalY:f,scale:C};b(T),X(T)}},rt=["nw","ne","se","sw"],yt={minX:n.x,minY:n.y,maxX:n.x+n.width,maxY:n.y+n.height},L=u.useMemo(()=>{const S=o??{width:n.width,height:n.height},g=ae(n,S,h);return!(g.width>0)||!(g.height>0)?null:{x:n.x+Qt(n.width,g.width,a),y:n.y+Qt(n.height,g.height,f),width:g.width,height:g.height}},[o,n.x,n.y,n.width,n.height,a,f,h]),gt=L?{minX:L.x,minY:L.y,maxX:L.x+L.width,maxY:L.y+L.height}:yt;return I.jsxs("svg",{ref:F,className:`${t}-editor${x?` ${t}-editor-armed`:""}`,width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,tabIndex:0,onKeyDown:dt,onPointerMove:xt,onPointerUp:ut,onPointerCancel:ut,onLostPointerCapture:ut,"data-pretext-image-editor":!0,children:[I.jsx("rect",{className:`${t}-editor-surface`,width:e.width,height:e.height,onPointerDown:()=>l("none")}),x&&i&&L&&r&&I.jsxs(I.Fragment,{children:[I.jsx("defs",{children:I.jsxs("mask",{id:y,maskUnits:"userSpaceOnUse",x:L.x,y:L.y,width:L.width,height:L.height,children:[I.jsx("rect",{x:L.x,y:L.y,width:L.width,height:L.height,fill:"#FFFFFF"}),I.jsx("path",{d:r,fillRule:"evenodd",fill:"#000000"})]})}),I.jsx("image",{className:`${t}-editor-ghost`,href:i??void 0,x:L.x,y:L.y,width:L.width,height:L.height,preserveAspectRatio:"none",mask:`url(#${y})`}),I.jsx("rect",{className:`${t}-editor-image-bounds`,x:L.x,y:L.y,width:L.width,height:L.height})]}),x&&I.jsxs(I.Fragment,{children:[I.jsx("rect",{className:`${t}-editor-bbox`,x:n.x,y:n.y,width:n.width,height:n.height}),I.jsx("rect",{className:`${t}-editor-body`,x:n.x,y:n.y,width:n.width,height:n.height,onPointerDown:k}),rt.map(S=>{const g=xn(gt,S),C=S==="ne"||S==="sw";return I.jsxs("g",{children:[I.jsx("rect",{className:`${t}-editor-scale`,x:g.x-_e/2,y:g.y-_e/2,width:_e,height:_e}),I.jsx("rect",{className:`${t}-editor-scale-grab${C?` ${t}-editor-scale-grab-nesw`:""}`,x:g.x-Xe/2,y:g.y-Xe/2,width:Xe,height:Xe,onPointerDown:T=>Q(T,S)})]},S)})]})]})}const wn=10,Ar=wn*2,Zt=7,kr=4,xe=9,Lr=3.5,Jn=1.08,br=.05,De=14,Rr=1,Ye=14,Te=8;function Nr({P:t,box:e,viewBox:n,contours:o,snap:i,stretchToBox:r,uniformStretch:c=!1,stage:l,onStageChange:a,onSelectionChange:f,onChange:h,onCommit:b}){const X=u.useRef(null),F=u.useRef(null),y=u.useRef(o);y.current=o;const D=u.useRef(null),A=u.useRef(null),H=u.useRef(null),x=u.useRef(null),[Y,k]=u.useState([]),[Q,xt]=u.useState(ge),[ut,dt]=u.useState(null),rt=u.useCallback(s=>{xt(M=>sr(M,s)?M:s)},[]),yt=l==="shape";u.useEffect(()=>{var s;yt&&((s=X.current)==null||s.focus({preventScroll:!0}))},[yt]),u.useEffect(()=>{yt||k(s=>s.length?[]:s)},[yt]);const L=Y.length>0;u.useEffect(()=>{f==null||f(L)},[L,f]),u.useEffect(()=>()=>f==null?void 0:f(!1),[f]);const gt=n.width>0?e.width/n.width:1,S=n.height>0?e.height/n.height:1,g=Math.min(gt,S),C=r&&c?g:gt,T=r&&c?g:S,W=r&&c?(e.width-n.width*g)/2:0,O=r&&c?(e.height-n.height*g)/2:0,_=u.useCallback(s=>r?{x:W+(s.x-n.x)*C,y:O+(s.y-n.y)*T}:{x:s.x-n.x,y:s.y-n.y},[r,n,C,T,W,O]),d=u.useCallback(s=>r?{x:n.x+(C>0?(s.x-W)/C:0),y:n.y+(T>0?(s.y-O)/T:0)}:{x:n.x+s.x,y:n.y+s.y},[r,n,C,T,W,O]),Z=u.useMemo(()=>d({x:e.width/2,y:e.height/2}),[d,e.width,e.height]),q=u.useCallback((s,M)=>{var R;const w=(R=X.current)==null?void 0:R.getBoundingClientRect();if(!w||w.width<=0||w.height<=0)return{x:0,y:0};if(r){const N=(s-w.left)/w.width*e.width,m=(M-w.top)/w.height*e.height;return{x:n.x+(C>0?(N-W)/C:0),y:n.y+(T>0?(m-O)/T:0)}}return{x:n.x+(s-w.left),y:n.y+(M-w.top)}},[r,n,e.width,e.height,C,T,W,O]),it=u.useCallback((s,M)=>{var R;const w=(R=X.current)==null?void 0:R.getBoundingClientRect();return!w||w.width<=0||w.height<=0?{x:0,y:0}:{x:(s-w.left)/w.width*e.width,y:(M-w.top)/w.height*e.height}},[e.width,e.height]),nt=u.useCallback((s,M)=>{const w=c&&!(M!=null&&M.preserveShape)?nr(s,n,e,W,O,C,T):s;b(w,M)},[b,c,n,e,W,O,C,T]),ft=u.useCallback(()=>{dt(null)},[]),v=u.useCallback((s,M,w)=>{if(!w||D.current||A.current||H.current||x.current){ft();return}const R=it(s,M),N=Ft(y.current,_);for(const j of N)for(const B of j.nodes)if(Math.hypot(B.p.x-R.x,B.p.y-R.y)<=xe){ft();return}const m=un(N,R);if(!m||m.distance>wn){ft();return}const P=N[m.contour],z=P==null?void 0:P.nodes[m.segment],tt=P==null?void 0:P.nodes[(m.segment+1)%((P==null?void 0:P.nodes.length)??1)],$=!!(z&&tt&&!Se(z,tt));dt(j=>j&&j.curved===$&&Math.hypot(j.point.x-m.point.x,j.point.y-m.point.y)<.25?j:{point:m.point,curved:$})},[it,_,ft]),St=s=>{var Tt;const M=s.metaKey||s.ctrlKey,w=H.current;if(w&&s.pointerId===w.pointerId){if(s.stopPropagation(),s.preventDefault(),w.startDistance<=0)return;const ht=q(s.clientX,s.clientY),V=Math.hypot(ht.x-w.origin.x,ht.y-w.origin.y),ct=Math.max(br,V/w.startDistance);if(!w.moved&&Math.abs(ct-1)<1e-4)return;w.moved=!0,h(sn(w.startContours,w.origin,ct));return}const R=A.current;if(R&&s.pointerId===R.pointerId){s.stopPropagation(),s.preventDefault();const ht=q(s.clientX,s.clientY),{bbox:V}=R,ct=V.maxX-V.minX,Mt=V.maxY-V.minY,Gt=ht.x-R.origin.x,Yt=ht.y-R.origin.y;let Pt=Gt,vt=Yt;if(isFinite(ct)&&isFinite(Mt))if(r){let Et=n.x,kt=n.x+n.width,ee=n.y,Lt=n.y+n.height;c&&(C>0&&(Et=n.x+(0-W)/C,kt=n.x+(e.width-W)/C),T>0&&(ee=n.y+(0-O)/T,Lt=n.y+(e.height-O)/T));const he=Math.min(Et,kt-ct),ue=Math.max(Et,kt-ct),$e=Math.min(ee,Lt-Mt),Kt=Math.max(ee,Lt-Mt),ie=Math.min(ue,Math.max(he,V.minX+Gt)),st=Math.min(Kt,Math.max($e,V.minY+Yt));Pt=ie-V.minX,vt=st-V.minY}else{const Et=V.minX-n.x,kt=V.minY-n.y,ee=Math.min(0,e.width-ct),Lt=Math.max(0,e.width-ct),he=Math.min(0,e.height-Mt),ue=Math.max(0,e.height-Mt),$e=Math.min(Lt,Math.max(ee,Et+Gt)),Kt=Math.min(ue,Math.max(he,kt+Yt));Pt=$e-Et,vt=Kt-kt}const re=[];if(!M&&isFinite(ct)&&isFinite(Mt)){const Et=_({x:V.minX+ct/2+Pt,y:V.minY+Mt/2+vt}),kt={x:e.width/2,y:e.height/2};Math.abs(Et.x-kt.x)<=De&&(Pt=Z.x-V.minX-ct/2,re.push(fn(kt.x,"x",e))),Math.abs(Et.y-kt.y)<=De&&(vt=Z.y-V.minY-Mt/2,re.push(fn(kt.y,"y",e)))}if(!R.moved&&Pt===0&&vt===0)return;R.moved=!0,rt(re.length?re:ge),h(Ft(R.startContours,Et=>({x:Et.x+Pt,y:Et.y+vt})),{carryImage:!0});return}const N=x.current;if(N&&s.pointerId===N.pointerId){s.stopPropagation(),s.preventDefault();const ht=q(s.clientX,s.clientY);let V=ht.x-N.origin.x,ct=ht.y-N.origin.y;if(s.shiftKey&&(Math.abs(V)>Math.abs(ct)?ct=0:V=0),!N.moved&&V===0&&ct===0)return;N.moved=!0,h(ln(N.startContours,N.selection,V,ct));return}const m=D.current;if(!m||s.pointerId!==m.pointerId){v(s.clientX,s.clientY,Y.length>0||yt);return}ft(),s.stopPropagation(),s.preventDefault();const P=q(s.clientX,s.clientY);if(m.kind==="anchor"){const ht={x:m.anchor.x+(P.x-m.origin.x),y:m.anchor.y+(P.y-m.origin.y)},V=M?[]:cr(y.current,{contour:m.contour,node:m.node}),ct=M||!m.center?[]:[m.center],Mt=vn(Wn(V,ct.map(Pt=>Pt.x),"x"),ht,"x",_,De),Gt=vn(Wn(V,ct.map(Pt=>Pt.y),"y"),ht,"y",_,De),Yt=M?ht:{x:(Mt==null?void 0:Mt.value)??Ne(ht.x,i),y:(Gt==null?void 0:Gt.value)??Ne(ht.y,i)};if(s.shiftKey&&(Math.abs(Yt.x-m.anchor.x)>Math.abs(Yt.y-m.anchor.y)?Yt.y=m.anchor.y:Yt.x=m.anchor.x),!m.moved&&Yt.x===m.anchor.x&&Yt.y===m.anchor.y)return;m.moved=!0,rt(hr(Yt,Mt,Gt,e,_)),h(co(y.current,m.contour,m.node,Yt));return}const z=(Tt=y.current[m.contour])==null?void 0:Tt.nodes[m.node],tt=m.mirror&&!s.altKey,$=tt||M?null:m.kind==="in"?z==null?void 0:z.out:z==null?void 0:z.in,j=z?_(z.p):null,B=$?_($):null,wt=z&&(!M||s.shiftKey)?dr(P,z.p,tt||M?null:ur(y.current[m.contour],m.node,m.kind,_),j&&B?Math.hypot(B.x-j.x,B.y-j.y):null,s.shiftKey,_,d):{point:P,guides:ge},et=wt.guides.length?wt.point:M?P:{x:Ne(P.x,i),y:Ne(P.y,i)},Dt=m.kind==="in"?z==null?void 0:z.in:z==null?void 0:z.out;!m.moved&&Dt&&et.x===Dt.x&&et.y===Dt.y||(m.moved=!0,rt(wt.guides),h(ao(y.current,m.contour,m.node,m.kind,et,tt)))},Xt=s=>{rt(ge);const M=H.current;if(M&&s.pointerId===M.pointerId){H.current=null,s.stopPropagation();const $=X.current;$!=null&&$.hasPointerCapture(M.pointerId)&&$.releasePointerCapture(M.pointerId),M.moved&&nt(y.current,{preserveShape:!0});return}const w=A.current;if(w&&s.pointerId===w.pointerId){A.current=null,s.stopPropagation();const $=X.current;$!=null&&$.hasPointerCapture(w.pointerId)&&$.releasePointerCapture(w.pointerId),w.moved?nt(y.current,{preserveShape:!0}):k([]);return}const R=x.current;if(R&&s.pointerId===R.pointerId){x.current=null,s.stopPropagation();const $=X.current;$!=null&&$.hasPointerCapture(R.pointerId)&&$.releasePointerCapture(R.pointerId),R.moved&&nt(y.current);return}const N=D.current;if(!N||s.pointerId!==N.pointerId)return;D.current=null,s.stopPropagation();const m=X.current;m!=null&&m.hasPointerCapture(N.pointerId)&&m.releasePointerCapture(N.pointerId);const P=Math.hypot(s.clientX-N.clientOrigin.x,s.clientY-N.clientOrigin.y);if(N.moved||P>kr){N.moved&&nt(y.current);return}if(!N.toggleOnRelease||s.type!=="pointerup")return;const tt=hn(y.current,N.contour,N.node);tt!==y.current&&(h(tt),nt(tt))},Vt=s=>{s.stopPropagation()},jt=s=>{var M,w;s.stopPropagation(),s.preventDefault(),ft(),(M=X.current)==null||M.focus({preventScroll:!0}),A.current={pointerId:s.pointerId,origin:q(s.clientX,s.clientY),startContours:Jt(o),bbox:oe(o),moved:!1},(w=X.current)==null||w.setPointerCapture(s.pointerId)},pt=(s,M)=>{var P,z;s.stopPropagation(),s.preventDefault(),ft(),(P=X.current)==null||P.focus({preventScroll:!0}),k([]),a("shape");const w=oe(o),R=Oe(w,uo(M)),N=xn(w,M),m=Math.hypot(N.x-R.x,N.y-R.y);!isFinite(m)||m<=0||(H.current={pointerId:s.pointerId,corner:M,origin:R,startDistance:m,startContours:Jt(o),moved:!1},(z=X.current)==null||z.setPointerCapture(s.pointerId))},$t=(s,M,w,R)=>{var P,z,tt,$;s.stopPropagation(),s.preventDefault(),ft(),(P=X.current)==null||P.focus({preventScroll:!0});const N=(z=o[w])==null?void 0:z.nodes[R];if(!N)return;if(s.altKey){const j=M==="anchor"?$n(o,w,R):lo(o,w,R,M);if(j===o)return;k(M==="anchor"?[]:[{contour:w,node:R}]),h(j),nt(j);return}const m=s.metaKey||s.ctrlKey;if(M==="anchor"&&s.shiftKey&&!m){k(j=>j.some(B=>B.contour===w&&B.node===R)?j.filter(B=>!(B.contour===w&&B.node===R)):[...j,{contour:w,node:R}]);return}if(M==="anchor"&&!m&&Y.length>1&&Y.some(j=>j.contour===w&&j.node===R)){x.current={pointerId:s.pointerId,origin:q(s.clientX,s.clientY),startContours:Jt(o),selection:Y,moved:!1},(tt=X.current)==null||tt.setPointerCapture(s.pointerId);return}k([{contour:w,node:R}]),D.current={kind:M,contour:w,node:R,pointerId:s.pointerId,origin:q(s.clientX,s.clientY),clientOrigin:{x:s.clientX,y:s.clientY},anchor:N.p,center:er(o),mirror:M!=="anchor"&&!!(N.in&&N.out),toggleOnRelease:m,moved:!1},($=X.current)==null||$.setPointerCapture(s.pointerId)},At=s=>{s.stopPropagation(),s.preventDefault(),ft();const M=Ft(o,_),w=un(M,it(s.clientX,s.clientY));if(!w||w.distance>wn)return;const{contours:R,nodeIndex:N}=ho(o,w.contour,w.segment,w.t);N<0||(k([{contour:w.contour,node:N}]),h(R),nt(R))},mt=s=>{if(s.key==="="||s.key==="+"||s.key==="-"||s.key==="_"){s.preventDefault(),s.stopPropagation();const m=oe(o);if(!isFinite(m.minX)||!isFinite(m.maxX))return;const P={x:(m.minX+m.maxX)/2,y:(m.minY+m.maxY)/2},tt=s.key==="="||s.key==="+"?Jn:1/Jn,$=sn(o,P,tt);h($),nt($,{preserveShape:!0});return}if(s.key==="Escape"){s.stopPropagation(),k([]),a("none");return}if(!Y.length)return;if(s.key==="Backspace"||s.key==="Delete"){s.preventDefault(),s.stopPropagation();const m=so(o,Y);if(m===o)return;k([]),h(m),nt(m);return}const M=i>0?i:Rr,w=s.shiftKey?M*10:M,R={ArrowLeft:[-w,0],ArrowRight:[w,0],ArrowUp:[0,-w],ArrowDown:[0,w]}[s.key];if(!R)return;s.preventDefault(),s.stopPropagation();const N=ln(o,Y,R[0],R[1]);h(N),nt(N)},J=u.useMemo(()=>le(Ft(o,_)),[o,_]),ot=u.useMemo(()=>oe(o),[o]),It=_({x:ot.minX,y:ot.minY}),zt={width:_({x:ot.maxX,y:ot.minY}).x-It.x,height:_({x:ot.minX,y:ot.maxY}).y-It.y},Wt=yt&&Y.length===0&&isFinite(ot.minX)&&isFinite(ot.maxX)&&ot.maxX>ot.minX&&ot.maxY>ot.minY,_t=Y.length>0||yt,lt=_t;return I.jsxs("svg",{ref:X,className:`${t}-editor${_t?` ${t}-editor-armed`:""}`,width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,tabIndex:0,onKeyDown:mt,onPointerDown:()=>{var s;return(s=X.current)==null?void 0:s.focus({preventScroll:!0})},onPointerMove:St,onPointerLeave:ft,onPointerUp:Xt,onPointerCancel:Xt,onLostPointerCapture:Xt,onContextMenu:s=>{s.preventDefault()},"data-pretext-path-editor":!0,"data-selection":"none",children:[I.jsx("rect",{className:`${t}-editor-surface`,width:e.width,height:e.height,onPointerDown:()=>{k([]),a("none")},onClick:At}),lt&&I.jsx("path",{className:`${t}-editor-outline`,d:J}),lt&&Q.map((s,M)=>I.jsx("line",{className:`${t}-editor-snap ${t}-editor-snap-${s.kind}`,x1:s.a.x,y1:s.a.y,x2:s.b.x,y2:s.b.y},`${s.kind}-${M}`)),I.jsx("path",{ref:F,className:`${t}-editor-body`,d:J,fillRule:"evenodd",onPointerDown:jt,onClick:At}),lt&&I.jsx("path",{className:`${t}-editor-hit`,d:J,style:{strokeWidth:Ar},onClick:At}),lt&&ut&&I.jsx("rect",{className:`${t}-editor-add-preview`,x:ut.point.x-Zt/2,y:ut.point.y-Zt/2,width:Zt,height:Zt,rx:ut.curved?Zt/2:0}),lt&&o.map((s,M)=>s.nodes.map((w,R)=>{const N=Y.some(P=>P.contour===M&&P.node===R),m=_(w.p);return I.jsxs("g",{children:[N&&Y.length===1&&["in","out"].map(P=>{const z=w[P];if(!z)return null;const tt=_(z);return I.jsxs("g",{children:[I.jsx("line",{className:`${t}-editor-handle-line`,x1:m.x,y1:m.y,x2:tt.x,y2:tt.y}),I.jsx("circle",{className:`${t}-editor-handle`,cx:tt.x,cy:tt.y,r:Lr}),I.jsx("circle",{className:`${t}-editor-grab`,cx:tt.x,cy:tt.y,r:xe,onPointerDown:$=>$t($,P,M,R),onClick:Vt})]},P)}),I.jsx("rect",{className:`${t}-editor-anchor${N?` ${t}-editor-anchor-selected`:""}`,x:m.x-Zt/2,y:m.y-Zt/2,width:Zt,height:Zt,rx:no(w)?Zt/2:0}),I.jsx("rect",{className:`${t}-editor-grab`,x:m.x-xe,y:m.y-xe,width:xe*2,height:xe*2,onPointerDown:P=>$t(P,"anchor",M,R),onClick:Vt,onDoubleClick:P=>{P.stopPropagation(),P.preventDefault();const z=hn(o,M,R);h(z),nt(z)}})]},`${M}-${R}`)})),Wt&&I.jsxs("g",{children:[I.jsx("rect",{className:`${t}-editor-bbox`,x:It.x,y:It.y,width:zt.width,height:zt.height}),["nw","ne","se","sw"].map(s=>{const M=_(xn(ot,s)),w=s==="ne"||s==="sw";return I.jsxs("g",{children:[I.jsx("rect",{className:`${t}-editor-scale`,x:M.x-Te/2,y:M.y-Te/2,width:Te,height:Te}),I.jsx("rect",{className:`${t}-editor-scale-grab${w?` ${t}-editor-scale-grab-nesw`:""}`,x:M.x-Ye/2,y:M.y-Ye/2,width:Ye,height:Ye,onPointerDown:R=>pt(R,s),onClick:Vt})]},s)})]})]})}const Xr=4e3,_r=/^(?:https?:|mailto:|tel:)/i;function po(t){return!!t&&typeof t=="object"&&t.type==="link"}function Dr(t){if(!t)return;const e=t.replace(/\s+/g,"");if(!(/^[a-z][a-z0-9+.-]*:/i.test(e)&&!_r.test(e)))return e}function Yr(t){const e=[];return t.forEach((n,o)=>{const i=(r,c,l)=>{for(const a of r){if(po(a)){i(a.children??[],Dr(a.value),a.target);continue}const f=a,h=(f==null?void 0:f.text)??"";if(h.trim())for(const b of h.split(/\s+/))b&&e.push({text:b,leaf:f,href:c,target:l,para:o})}};i((n==null?void 0:n.children)??[])}),e}function Un(t){return{...t.fontFamily&&{fontFamily:eo.normalizeFontFamilyCssValue(t.fontFamily)},...t.fontWeight&&{fontWeight:t.fontWeight},...t.fontStyle&&{fontStyle:t.fontStyle},...t.textDecoration&&{textDecoration:t.textDecoration},...t.textTransform&&{textTransform:t.textTransform},...t.fontVariant&&{fontVariant:t.fontVariant},...t.verticalAlign&&{verticalAlign:t.verticalAlign,lineHeight:"0px"}}}function Tr(t){return t.map(e=>{const n=[],o=i=>{for(const r of i){if(po(r)){o(r.children??[]);continue}n.push((r==null?void 0:r.text)??"")}};return o((e==null?void 0:e.children)??[]),n.join("")})}function jr(t,e,n,o,i){if(e<=0||!t.length||n<=0||o<=0)return t;const r=i==="avoid"?1:-1;return t.map(c=>{if(!c.length)return c;let l=1/0,a=-1/0,f=1/0,h=-1/0;for(const F of c){const y=F.x*n,D=F.y*o;y<l&&(l=y),y>a&&(a=y),D<f&&(f=D),D>h&&(h=D)}const b=(l+a)/2,X=(f+h)/2;return c.map(F=>{const y=F.x*n,D=F.y*o,A=y-b,H=D-X,x=Math.sqrt(A*A+H*H);if(x<1e-6)return F;const k=Math.max(0,x+r*e)/x;return{x:(b+A*k)/n,y:(X+H*k)/o}})})}const Pr=.75;function Bn(t,e,n,o,i,r){if(t.kind==="fragment"||!e)return null;const c=t.token.text,l=t.offset>0?e[t.offset-1]:0,a=n?n.map(f=>f-t.offset).filter(f=>f>=(t.offset>0?2:1)&&f<c.length):Array.from({length:c.length-1},(f,h)=>h+1);for(let f=a.length-1;f>=0;f-=1){const h=a[f];if(t.offset+h>e.length)continue;const b=!!n&&c[h-1]!=="-",X=e[t.offset+h-1]-l,F=X+(b?r:0);if(!(F*i>o))return{chars:h,fragmentText:b?`${c.slice(0,h)}-`:c.slice(0,h),remainderText:c.slice(h),fragmentWidth:F,remainderWidth:Math.max(0,t.width-X)}}return null}function to(t){const{tokens:e,widths:n,rings:o,mode:i,align:r,scale:c,width:l,height:a,allowOverflow:f,capInset:h,capLines:b}=t,X=!!t.hyphenate,F=t.charWidths??[],y=t.hyphenPoints??[],D=t.hyphenWidth??0,A=t.lineHeight*c,H=t.spaceWidth*c,x=Math.max(0,t.shapeMargin??0),Y=[],k=e.map((_,d)=>({token:_,originalIndex:d,width:n[d],kind:"whole",offset:0}));if(!k.length||l<=0||A<=0)return{segments:Y,placed:0,height:0,capLeft:0,capTop:0,renderTokens:e};const Q=Math.max(1,H*.5),xt=A*_o,ut=jr(o,x,l,a,i),dt=Math.max(1,Math.floor(t.columns??1)),rt=dt>1?Math.max(0,t.columnGap??0):0,yt=(l-rt*(dt-1))/dt;let L=0,gt=0,S=0,g=0,C=0,T=null;const W=(_,d,Z)=>zo(ut,(_+xt)/a,(_+A-xt)/a,i).map(q=>({x0:Math.max(d,q.x0*l),x1:Math.min(Z,q.x1*l)})).filter(q=>q.x1>q.x0);for(let _=0;_<dt&&L<k.length&&yt>0;_+=1){const d=_*(yt+rt),Z=d+yt,q=f&&_===dt-1;let it=0;for(let v=0;v+A<=a;v+=A)for(const St of W(v,d,Z))it=Math.max(it,St.x1-St.x0);let nt=k[L].token.para,ft=0;for(;L<k.length&&S<Xr;){const v=ft+A>a;if(v&&!q)break;const St=k[L].token.para;if(St>nt+1){ft+=A*(St-nt-1),nt=St-1,S+=1;continue}let Xt=v?[{x0:d,x1:Z}]:W(ft,d,Z);h>0&&b>0&&_===0&&!v&&Xt.length&&(T===null&&(T=S,g=Xt[0].x0,C=ft),S-T<b&&(Xt=Oo(Xt,{x0:g,x1:g+h})));const Vt=Xt.reduce((jt,pt)=>Math.max(jt,pt.x1-pt.x0),0);for(const jt of Xt){const pt=jt.x1-jt.x0;if(pt<Q)continue;if(L>=k.length||k[L].token.para!==St)break;const $t=L;let At=0;for(;L<k.length&&k[L].token.para===St;){const mt=k[L],J=L===$t,ot=mt.width*c,It=J?ot:H+ot;if(At+It<=pt){At+=It,L+=1;continue}const zt=pt-At-(J?0:H),Wt=J&&ot>yt-.5,_t=pt>=Vt-.5&&pt>=it*Pr,lt=F[mt.originalIndex],s=y[mt.originalIndex],M=(X&&s?Bn(mt,lt,s,zt,c,D):null)??(Wt&&_t?Bn(mt,lt,void 0,zt,c,D):null);if(M){const w={token:{...mt.token,text:M.fragmentText},originalIndex:mt.originalIndex,width:M.fragmentWidth,kind:"fragment",offset:mt.offset},R={token:{...mt.token,text:M.remainderText},originalIndex:mt.originalIndex,width:M.remainderWidth,kind:"remainder",offset:mt.offset+M.chars};k.splice(L,1,w,R),At+=(J?0:H)+M.fragmentWidth*c,L+=1;break}if(Wt&&dt===1&&pt>=it-.5){At+=It,L+=1;continue}break}if(L>$t){const mt=L>=k.length||k[L].token.para!==St;Y.push({top:ft,left:jt.x0,width:pt,from:$t,to:L,justify:r==="justify"&&!mt})}if(L>=k.length||k[L].token.para!==St)break}nt=St,ft+=A,S+=1}gt=Math.max(gt,ft)}let O=0;if(L>0){const _=k[L-1];O=_.kind==="fragment"?_.originalIndex:_.originalIndex+1}return{segments:Y,placed:O,height:Y.length?gt:0,capLeft:g,capTop:C,renderTokens:k.map(_=>_.token)}}const Hr=.12,Or=2,zr=10,en=.25,Wr=t=>{const e=t.getBoundingClientRect();return{top:e.top,left:e.left,width:e.width,height:e.height}},vr=(t,e)=>Math.abs(t.top-e.top)<.5&&Math.abs(t.left-e.left)<.5&&Math.abs(t.width-e.width)<.5&&Math.abs(t.height-e.height)<.5,Vr=(t,e)=>{const[n,o]=u.useState(null);return u.useEffect(()=>{if(!t||!e){o(null);return}let i=0,r=null;const c=()=>{const l=Wr(t);(!r||!vr(r,l))&&(r=l,o(l)),i=requestAnimationFrame(c)};return c(),()=>cancelAnimationFrame(i)},[t,e]),n},nn=(t,e)=>{if(!(e.width>0)||!(e.height>0))return t;const n=Math.min(e.width,e.height),o=(e.width-n)/2,i=(e.height-n)/2;return t.map(r=>r.map(c=>({x:(o+c.x*n)/e.width,y:(i+c.y*n)/e.height})))},Ee=typeof window>"u"?u.useEffect:u.useLayoutEffect;function Gr(){return typeof document>"u"?null:document.body}function Kr({P:t,item:e,shape:n,customPath:o,pathFit:i,viewBox:r,mode:c,align:l,allowOverflow:a,fitEnabled:f,scale:h,onFitScale:b,padding:X,columns:F,gutter:y,hyphenate:D,showOverflowIndicator:A,dropCapLines:H,dropCapSize:x,showGuides:Y,typography:k,imageUrl:Q,imageFocalX:xt,imageFocalY:ut,imageScale:dt,imageCustomPath:rt,imagePathEdited:yt,pathDragActive:L,pathCarryImage:gt,onCarryImageConsumed:S,pathEditor:g,imageEditor:C}){var En,An;const T=`pretext-shape-image-${u.useId().replace(/:/g,"")}`,[W,O]=u.useState(null),_=u.useRef(null),[d,Z]=u.useState({width:0,height:0}),[q,it]=u.useState(0),[nt,ft]=u.useState(0),[v,St]=u.useState(null),[Xt,Vt]=u.useState(0),[jt,pt]=u.useState("none");u.useEffect(()=>{!g&&!C&&pt("none")},[g,C]);const[$t,At]=u.useState(null);u.useEffect(()=>{if(!Q||typeof Image>"u"){At(null);return}let p=!1;const E=new Image;return E.onload=()=>{p||At({width:E.naturalWidth,height:E.naturalHeight})},E.src=Q,()=>{p=!0}},[Q]);const mt=u.useMemo(()=>Array.isArray(e==null?void 0:e.text)?e.text:[],[e]),J=u.useMemo(()=>Yr(mt),[mt]),ot=u.useMemo(()=>Tr(mt),[mt]),It=u.useMemo(()=>ot.join(`
2
+ `),[ot]),{lang:zt,hyphenateSync:Wt}=Fr(D,It),_t=u.useMemo(()=>D?J.map(p=>Ir(p.text,Wt)):[],[D,J,Wt]),lt=H>0&&x>1?((An=(En=J[0])==null?void 0:En.text)==null?void 0:An.charAt(0))??"":"",s=(g==null?void 0:g.contours)??null,M=u.useMemo(()=>{let p=[];if(s){const E=Ce(s);E.length&&(p=Me(E,r))}if(!p.length){const E=o.trim(),G=E?jn(E,i,r):null;G&&G.length?p=G:p=rn(n==="custom"?"rectangle":n)}return n==="circle"?nn(p,d):p},[s,n,o,i,r,d.width,d.height]),w=g==null?void 0:g.onConvert,R=(g==null?void 0:g.needsConversion)??!1,N=u.useMemo(()=>{if(n==="circle")return!1;const p=s??(o.trim()?te(o):null);return!!(p&&io(p,r))},[s,o,r,n]),[m,P]=u.useState(null);Ee(()=>{if(!N){m&&P(null);return}!m&&d.width>0&&d.height>0&&P({width:d.width,height:d.height})},[N,d.width,d.height,m]);const z=u.useMemo(()=>{if(!N||d.width<=0||d.height<=0)return M;const p=m??d,E=r.width/p.width,G=r.height/p.height;return M.map(U=>U.map(K=>({x:K.x*E,y:K.y*G})))},[M,N,m,r.width,r.height,d.width,d.height]),tt=u.useMemo(()=>{if(s){const U=Ce(s);if(U.length){const K=Me(U,r);return n==="circle"?nn(K,d):K}}const p=rt.trim(),E=p?jn(p,i,r):null,G=E&&E.length?E:rn(n==="custom"?"rectangle":n);return n==="circle"?nn(G,d):G},[s,n,rt,i,r,d.width,d.height]),$=u.useMemo(()=>{if(!N||d.width<=0||d.height<=0)return tt;const p=m??d,E=r.width/p.width,G=r.height/p.height;return tt.map(U=>U.map(K=>({x:K.x*E,y:K.y*G})))},[tt,N,m,r.width,r.height,d.width,d.height]),j=u.useRef(null),B=u.useRef(!1);u.useEffect(()=>{if(!(!w||d.width<=0||d.height<=0)){if(N){if(j.current===o)return;const p=s??(o.trim()?te(o):null);if(!(p!=null&&p.length))return;const E=Ft(p,G=>({x:r.x+(G.x-r.x)/d.width*r.width,y:r.y+(G.y-r.y)/d.height*r.height}));j.current=le(E),w(E);return}!R||!M.length||B.current||(B.current=!0,w(Ft(Sn(M),p=>({x:p.x*He,y:p.y*He}))))}},[R,N,w,M,s,o,r,d.width,d.height]);const wt=u.useCallback(()=>{const p=W;if(!p)return;const E=p.getBoundingClientRect(),G=window.getComputedStyle(p),U=parseFloat(G.paddingTop)||0;it(Ct=>Math.abs(Ct-U)<.5?Ct:U);const K=parseFloat(G.columnGap)||0;ft(Ct=>Math.abs(Ct-K)<.5?Ct:K);const bt={width:E.width,height:E.height};Z(Ct=>Math.abs(Ct.width-bt.width)<.5&&Math.abs(Ct.height-bt.height)<.5?Ct:bt)},[W]);Ee(()=>{const p=W;if(!p||typeof ResizeObserver>"u")return;wt();const E=new ResizeObserver(wt);return E.observe(p),()=>E.disconnect()},[W,wt]),Ee(()=>{wt()},[X,y,wt]),u.useEffect(()=>{const p=typeof document<"u"?document.fonts:void 0;p!=null&&p.ready&&p.ready.then(()=>{Vt(E=>E+1)})},[]),Ee(()=>{const p=_.current;if(!p)return;if(!J.length){St(null);return}const E=[],G=document.createDocumentFragment();for(const Nt of J){const se=document.createElement("span");Object.assign(se.style,Un(Nt.leaf)),se.textContent=Nt.text,G.appendChild(se),E.push(se)}const U=document.createElement("span");U.textContent=" ",G.appendChild(U);const K=document.createElement("span");K.textContent="-",G.appendChild(K);const bt=lt||"H",Ct=document.createElement("span");Ct.textContent=bt,Ct.style.lineHeight="1",G.appendChild(Ct),p.replaceChildren(G);const ne=window.getComputedStyle(p),ce=parseFloat(ne.fontSize)||16,ke=parseFloat(ne.lineHeight),mo=Number.isNaN(ke)?ce*1.2:ke,Le=Math.max(mo,ce),de=document.createElement("span");de.textContent=bt,de.style.lineHeight=`${Le}px`;const Ge=document.createElement("span");Ge.style.cssText="display:inline-block;width:0;height:0;vertical-align:baseline",de.appendChild(Ge),p.appendChild(de);const xo=de.getBoundingClientRect().top,yo=Ge.getBoundingClientRect().top,kn=Math.max(1,yo-xo);de.remove();let be=kn*.8;const fe=document.createElement("canvas").getContext("2d"),Ln=Nt=>`${ne.fontStyle} ${ne.fontWeight} ${Nt}px ${ne.fontFamily}`;if(fe){fe.font=Ln(ce);const Nt=fe.measureText(bt).actualBoundingBoxAscent;Nt>0&&(be=Nt)}const bn=x>1?(x-1)*Le+be:be;let pe=ce*(bn/be);if(fe){fe.font=Ln(pe);const Nt=fe.measureText(bt).actualBoundingBoxAscent;Nt>0&&(pe=pe*(bn/Nt))}Ct.style.fontSize=`${pe}px`,Ct.style.lineHeight=`${pe}px`;const Re=document.createElement("span");Re.style.cssText="display:inline-block;width:0;height:0;vertical-align:baseline",Ct.appendChild(Re);const go=Math.max(1,Re.getBoundingClientRect().top-Ct.getBoundingClientRect().top);Re.remove();const wo=(x-1)*Le+kn-go,Rn=E.map(Nt=>Nt.getBoundingClientRect().width),Mo=U.getBoundingClientRect().width,Co=K.getBoundingClientRect().width,So=lt?Ct.getBoundingClientRect().width:0,$o=(d.width-nt*(F-1))/F,Fo=E.map((Nt,se)=>{var Xn;const Ie=Nt.firstChild;if(!(Ie instanceof Text)||Ie.data.length<2||!(Rn[se]>$o-.5)&&!((Xn=_t[se])!=null&&Xn.length))return;const Ke=document.createRange(),Io=Nt.getBoundingClientRect().left,Nn=[];for(let Ze=1;Ze<=Ie.data.length;Ze+=1)Ke.setStart(Ie,0),Ke.setEnd(Ie,Ze),Nn.push(Ke.getBoundingClientRect().right-Io);return Nn});p.replaceChildren(),St({widths:Rn,spaceWidth:Mo,dashWidth:Co,charWidths:Fo,lineHeight:Le,capWidth:So,dropCapFontSize:pe,dropCapTopAdjust:wo})},[J,k,lt,H,x,Xt,d.width,D,_t,F,nt]);const et=v&&lt?v.capWidth+v.lineHeight*Hr:0,Dt=Math.max(H,Math.ceil(x)),Tt=u.useMemo(()=>{if(!v||!J.length||d.width<=0||d.height<=0||!f)return 1;const p=U=>to({tokens:J,widths:v.widths,spaceWidth:v.spaceWidth,lineHeight:v.lineHeight,width:d.width,height:d.height,rings:z,mode:c,align:l,scale:U,allowOverflow:!1,capInset:et*U,capLines:lt?Dt:0,hyphenate:D,charWidths:v.charWidths,hyphenPoints:_t,hyphenWidth:v.dashWidth,shapeMargin:q,columns:F,columnGap:nt});if(p(1).placed>=J.length)return 1;if(p(en).placed<J.length)return en;let E=en,G=1;for(let U=0;U<zr;U+=1){const K=(E+G)/2;p(K).placed>=J.length?E=K:G=K}return E},[v,J,d.width,d.height,z,c,l,f,et,lt,Dt,D,_t,q,F,nt]);u.useEffect(()=>{b(Tt)},[Tt,b]);const ht=f?Math.min(h,Tt):1,V=u.useMemo(()=>!v||!J.length||d.width<=0||d.height<=0?{segments:[],placed:0,height:0,capLeft:0,capTop:0,renderTokens:J}:to({tokens:J,widths:v.widths,spaceWidth:v.spaceWidth,lineHeight:v.lineHeight,width:d.width,height:d.height,rings:z,mode:c,align:l,scale:ht,allowOverflow:a,capInset:et*ht,capLines:lt?Dt:0,hyphenate:D,charWidths:v.charWidths,hyphenPoints:_t,hyphenWidth:v.dashWidth,shapeMargin:q,columns:F,columnGap:nt}),[v,J,d.width,d.height,z,c,l,ht,a,et,lt,Dt,D,_t,q,F,nt]),ct=A&&J.length>0&&V.placed<J.length,Mt=v?v.dropCapFontSize*ht:0,Gt=v?v.dropCapTopAdjust*ht:0,Yt=l==="justify"?"left":l,Pt=v?v.lineHeight*ht:0,vt=V.segments.length?V.segments[V.segments.length-1]:null,re=vt?{top:vt.top+Pt,left:vt.left+vt.width/2}:{top:d.height,left:d.width/2},Et=!!(g&&s&&d.width>0&&d.height>0),kt=!!C,ee=(Et||kt)&&d.width>0&&d.height>0,Lt=Vr(W,ee),he=ee&&Lt?Gr():null,ue=u.useRef(!1),$e=u.useCallback(p=>{ue.current=p},[]);u.useEffect(()=>{if(!Et&&!kt)return;const p=E=>{const G=W;if(!G)return;const U=G.getBoundingClientRect();E.clientX>=U.left&&E.clientX<=U.right&&E.clientY>=U.top&&E.clientY<=U.bottom&&(E.preventDefault(),E.stopPropagation(),pt(bt=>bt==="shape"&&ue.current?bt:bt==="shape"&&kt?"image":Et?"shape":"image"))};return document.addEventListener("dblclick",p,!0),()=>document.removeEventListener("dblclick",p,!0)},[Et,kt,W]);const Kt=u.useMemo(()=>Q&&d.width>0&&d.height>0?Do($,d):null,[Q,$,d.width,d.height]),ie=u.useRef(null),st=(()=>{const p=ie.current;return gt||!yt||!C||!$t||!Kt||!p||rt===p.customPath||p.shape!==n&&n!=="custom"?null:pr(p.bounds,Kt,$t,p.focalX,p.focalY,p.scale)})();Ee(()=>{if(!C){ie.current=null;return}if(L||!$t||!Kt)return;const p=ie.current,E=!!(p&&rt!==p.customPath);E&&st&&C.onCommit(st),E&&gt&&(S==null||S()),ie.current={rings:$,bounds:Kt,focalX:(st==null?void 0:st.focalX)??xt,focalY:(st==null?void 0:st.focalY)??ut,scale:(st==null?void 0:st.scale)??dt,customPath:rt,shape:n}},[L,gt,rt,n,$,Kt,C,$t,xt,ut,dt,st,S]);const Bt=ie.current,Ae=!!(L&&!gt&&Bt&&!st),ze=Ae&&Bt?Bt.focalX:(st==null?void 0:st.focalX)??xt,We=Ae&&Bt?Bt.focalY:(st==null?void 0:st.focalY)??ut,ve=Ae&&Bt?Bt.scale:(st==null?void 0:st.scale)??dt,Ht=Ae&&Bt?Bt.bounds:Kt,Fn=u.useMemo(()=>{if(!(d.width>0)||!(d.height>0))return"";let p=Hn(o,s,i,r,n,d);if(N){const E=m??d,G=r.width/E.width,U=r.height/E.height;p=Ft(p,K=>({x:K.x*G,y:K.y*U}))}return On(p,d)||Tn(z,d)},[o,s,i,r,n,d.width,d.height,N,m,z]),Ve=u.useMemo(()=>{if(!Q||!(d.width>0)||!(d.height>0))return"";let p=Hn(rt,s,i,r,n,d);if(N){const E=m??d,G=r.width/E.width,U=r.height/E.height;p=Ft(p,K=>({x:K.x*G,y:K.y*U}))}return On(p,d)||Tn($,d)},[Q,rt,s,i,r,n,d.width,d.height,N,m,$]),In=`${T}-clip`,Fe=u.useMemo(()=>{if(!Ht)return null;const p=$t??{width:Ht.width,height:Ht.height},E=ae(Ht,p,ve);return{x:Qt(Ht.width,E.width,ze),y:Qt(Ht.height,E.height,We),width:E.width,height:E.height}},[Ht,$t,ze,We,ve]);return I.jsxs("div",{className:`${t}-column`,style:{padding:X,columnGap:y},lang:zt,ref:O,children:[Fn?I.jsxs("svg",{className:`${t}-shape-fill`,style:{top:0,left:0,width:d.width,height:d.height},viewBox:`0 0 ${d.width} ${d.height}`,preserveAspectRatio:"none","aria-hidden":!0,children:[I.jsx("path",{className:`${t}-shape-fill-path`,d:Fn,fillRule:"evenodd"}),Q&&Ve&&Ht&&Fe?I.jsxs(I.Fragment,{children:[I.jsx("defs",{children:I.jsx("clipPath",{id:In,clipPathUnits:"userSpaceOnUse",children:I.jsx("path",{d:Ve,fillRule:"evenodd"})})}),I.jsx("image",{href:Q,x:Ht.x+Fe.x,y:Ht.y+Fe.y,width:Fe.width,height:Fe.height,preserveAspectRatio:"none",clipPath:`url(#${In})`})]}):null]}):null,I.jsxs("div",{className:`${t}-flow${a?"":` ${t}-clip`}`,style:{...k,["--"+t+"-fit"]:ht,top:0,left:0,width:d.width,height:d.height},children:[I.jsx("div",{className:`${t}-measure`,ref:_,style:k,"aria-hidden":!0}),V.segments.map((p,E)=>{const G=V.renderTokens.slice(p.from,p.to),U=E===0;return I.jsx("div",{className:`${t}-line${p.justify?` ${t}-line-justify`:""}`,"aria-hidden":!0,style:{top:`${p.top}px`,left:`${p.left}px`,width:`${p.width}px`,textAlign:p.justify?void 0:Yt},children:G.map((K,bt)=>{const ne=lt&&U&&p.from===0&&bt===0?K.text.slice(1):K.text,ce=Un(K.leaf),ke=K.href?I.jsx("a",{className:`${t}-link`,href:K.href,target:K.target,rel:K.target?"noopener noreferrer":void 0,style:ce,children:ne}):I.jsx("span",{style:ce,children:ne});return I.jsxs("span",{children:[!p.justify&&bt>0?" ":null,ke]},bt)})},`${p.from}-${p.to}-${E}`)}),Y&&!s&&I.jsx("svg",{className:`${t}-guides`,viewBox:"0 0 1 1",preserveAspectRatio:"none","aria-hidden":!0,children:z.map((p,E)=>I.jsx("polygon",{points:p.map(G=>`${G.x},${G.y}`).join(" ")},E))})]}),lt&&v&&I.jsx("div",{className:`${t}-drop-cap`,"aria-hidden":!0,style:{...k,top:`${V.capTop+Gt}px`,left:`${V.capLeft}px`,fontSize:`${Mt}px`,lineHeight:`${Mt}px`},children:lt}),he&&Lt&&(s&&g||C)&&Xo.createPortal(I.jsxs("div",{"data-selection":"none",style:{position:"fixed",top:Lt.top,left:Lt.left,width:Lt.width,height:Lt.height,zIndex:Or,pointerEvents:"none"},children:[s&&g&&I.jsx(Nr,{P:t,box:{width:Lt.width,height:Lt.height},viewBox:r,contours:s,snap:g.snap,stretchToBox:!N,uniformStretch:n==="circle",stage:jt,onStageChange:pt,onSelectionChange:$e,onChange:g.onChange,onCommit:g.onCommit}),C&&Ht&&I.jsx(Er,{P:t,box:{width:Lt.width,height:Lt.height},bounds:Ht,natural:$t,imageUrl:Q,maskPath:Ve,stage:jt,onStageChange:pt,focalX:ze,focalY:We,scale:ve,onChange:C.onChange,onCommit:C.onCommit})]}),he),I.jsx("div",{className:`${t}-a11y`,children:ot.map((p,E)=>I.jsx("p",{children:p},E))}),ct&&I.jsxs("svg",{className:`${t}-overflow-icon`,width:"33",height:"24",viewBox:"0 0 33 24",style:{top:re.top,left:re.left},"aria-hidden":!0,children:[I.jsx("path",{d:"M12.8,4 L20.2,4 C24.68042,4 26.9206301,4 28.631924,4.87194781 C31.3123488,6.23769248 33,8.99168887 33,12 C33,15.0083111 31.3123488,17.7623075 28.631924,19.1280522 C26.9206301,20 24.68042,20 20.2,20 L12.8,20 C8.31957995,20 6.07936993,20 4.368076,19.1280522 C1.68765116,17.7623075 0,15.0083111 0,12 C0,8.99168887 1.68765116,6.23769248 4.368076,4.87194781 C6.07936993,4 8.31957995,4 12.8,4 Z",fill:"#FF4400"}),I.jsx("path",{transform:"translate(5, 0)",fill:"#FFFFFF",d:"M12,5.625 C12.3846269,5.625 12.7016304,5.91453014 12.7449542,6.28753416 L12.75,6.375 L12.75,11.25 L17.625,11.25 C18.0392136,11.25 18.375,11.5857864 18.375,12 C18.375,12.3846269 18.0854699,12.7016304 17.7124658,12.7449542 L17.625,12.75 L12.75,12.75 L12.75,17.625 C12.75,18.0392136 12.4142136,18.375 12,18.375 C11.6153731,18.375 11.2983696,18.0854699 11.2550458,17.7124658 L11.25,17.625 L11.25,12.75 L6.375,12.75 C5.96078644,12.75 5.625,12.4142136 5.625,12 C5.625,11.6153731 5.91453014,11.2983696 6.28753416,11.2550458 L6.375,11.25 L11.25,11.25 L11.25,6.375 C11.25,5.96078644 11.5857864,5.625 12,5.625 Z"})]})]})}const Zr=["diamond","parallelogram","vase","circle","shield","bobbin","custom"],qr={x:0,y:0,width:100,height:100},Qr=t=>{const e=(t??"").trim().split(/[\s,]+/).map(Number).filter(n=>!Number.isNaN(n));return e.length<4||e[2]<=0||e[3]<=0?qr:{x:e[0],y:e[1],width:e[2],height:e[3]}},Jr=t=>`
3
+ .${t}-wrapper {
4
+ box-sizing: border-box;
5
+ display: flex;
6
+ flex-direction: row;
7
+ align-items: stretch;
8
+ width: 100%;
9
+ height: 100%;
10
+ min-height: 1px;
11
+ color: var(--${t}-text-color, #000000);
12
+ }
13
+ .${t}-column {
14
+ box-sizing: border-box;
15
+ position: relative;
16
+ flex: 1 1 0;
17
+ min-width: 0;
18
+ height: 100%;
19
+ }
20
+ .${t}-overflow-icon {
21
+ position: absolute;
22
+ transform: translate(-50%, -50%);
23
+ pointer-events: none;
24
+ z-index: 1;
25
+ }
26
+ .${t}-shape-fill {
27
+ position: absolute;
28
+ pointer-events: none;
29
+ overflow: hidden;
30
+ }
31
+ .${t}-shape-fill-path {
32
+ fill: var(--${t}-background-color, transparent);
33
+ }
34
+ .${t}-flow {
35
+ position: absolute;
36
+ }
37
+ .${t}-clip {
38
+ overflow: hidden;
39
+ }
40
+ .${t}-line {
41
+ position: absolute;
42
+ white-space: pre;
43
+ box-sizing: border-box;
44
+ }
45
+ .${t}-line-justify {
46
+ display: flex;
47
+ flex-direction: row;
48
+ flex-wrap: nowrap;
49
+ justify-content: space-between;
50
+ align-items: baseline;
51
+ }
52
+ .${t}-link {
53
+ color: var(--${t}-link-color, inherit);
54
+ text-decoration: underline;
55
+ }
56
+ .${t}-drop-cap {
57
+ position: absolute;
58
+ top: 0;
59
+ left: 0;
60
+ white-space: pre;
61
+ pointer-events: none;
62
+ }
63
+ .${t}-measure {
64
+ position: absolute;
65
+ top: 0;
66
+ left: 0;
67
+ visibility: hidden;
68
+ pointer-events: none;
69
+ white-space: pre;
70
+ width: max-content;
71
+ --${t}-fit: 1;
72
+ }
73
+ .${t}-measure > span {
74
+ display: inline-block;
75
+ }
76
+ .${t}-guides {
77
+ position: absolute;
78
+ inset: 0;
79
+ width: 100%;
80
+ height: 100%;
81
+ pointer-events: none;
82
+ overflow: visible;
83
+ }
84
+ .${t}-guides polygon {
85
+ fill: none;
86
+ stroke: #FF5C02;
87
+ stroke-width: 1;
88
+ vector-effect: non-scaling-stroke;
89
+ }
90
+ .${t}-editor {
91
+ position: absolute;
92
+ top: 0;
93
+ left: 0;
94
+ z-index: 10;
95
+ overflow: visible;
96
+ pointer-events: none;
97
+ touch-action: none;
98
+ outline: none;
99
+ }
100
+ .${t}-editor-armed {
101
+ pointer-events: auto;
102
+ }
103
+ .${t}-editor-surface {
104
+ fill: transparent;
105
+ cursor: default;
106
+ pointer-events: none;
107
+ }
108
+ .${t}-editor-armed .${t}-editor-surface {
109
+ pointer-events: auto;
110
+ }
111
+ .${t}-editor-hit {
112
+ fill: none;
113
+ stroke: transparent;
114
+ pointer-events: none;
115
+ }
116
+ .${t}-editor-armed .${t}-editor-hit {
117
+ pointer-events: stroke;
118
+ }
119
+ .${t}-editor-add-preview {
120
+ fill: #FFFFFF;
121
+ stroke: #FF5C02;
122
+ stroke-width: 1.5;
123
+ pointer-events: none;
124
+ opacity: 0.85;
125
+ }
126
+ .${t}-editor-grab {
127
+ fill: transparent;
128
+ stroke: none;
129
+ pointer-events: auto;
130
+ cursor: grab;
131
+ }
132
+ .${t}-editor-grab:active {
133
+ cursor: grabbing;
134
+ }
135
+ .${t}-editor-outline {
136
+ fill: none;
137
+ stroke: #FF5C02;
138
+ stroke-width: 1;
139
+ pointer-events: none;
140
+ }
141
+ .${t}-editor-body {
142
+ fill: transparent;
143
+ pointer-events: none;
144
+ cursor: move;
145
+ }
146
+ .${t}-editor-armed .${t}-editor-body {
147
+ pointer-events: fill;
148
+ }
149
+ .${t}-editor-body:active {
150
+ cursor: grabbing;
151
+ }
152
+ .${t}-editor-bbox {
153
+ fill: none;
154
+ stroke: #FF5C02;
155
+ stroke-width: 1;
156
+ stroke-dasharray: 4 3;
157
+ opacity: 0.55;
158
+ pointer-events: none;
159
+ }
160
+ .${t}-editor-scale {
161
+ fill: #FFFFFF;
162
+ stroke: #FF5C02;
163
+ stroke-width: 1.5;
164
+ pointer-events: none;
165
+ }
166
+ .${t}-editor-scale-grab {
167
+ fill: transparent;
168
+ stroke: none;
169
+ pointer-events: auto;
170
+ cursor: nwse-resize;
171
+ }
172
+ .${t}-editor-scale-grab-nesw {
173
+ cursor: nesw-resize;
174
+ }
175
+ .${t}-editor-snap {
176
+ stroke: #00B2FF;
177
+ stroke-width: 1;
178
+ pointer-events: none;
179
+ }
180
+ .${t}-editor-snap-angle {
181
+ stroke-dasharray: 4 3;
182
+ }
183
+ .${t}-editor-snap-center {
184
+ stroke-dasharray: 2 4;
185
+ opacity: 0.8;
186
+ }
187
+ .${t}-editor-handle-line {
188
+ stroke: #FF5C02;
189
+ stroke-width: 1;
190
+ opacity: 0.5;
191
+ pointer-events: none;
192
+ }
193
+ .${t}-editor-handle {
194
+ fill: #FF5C02;
195
+ stroke: #FFFFFF;
196
+ stroke-width: 1;
197
+ pointer-events: none;
198
+ }
199
+ .${t}-editor-anchor {
200
+ fill: #FFFFFF;
201
+ stroke: #FF5C02;
202
+ stroke-width: 1.5;
203
+ pointer-events: none;
204
+ }
205
+ .${t}-editor-anchor-selected {
206
+ fill: #FF5C02;
207
+ }
208
+ .${t}-editor-ghost {
209
+ opacity: 0.3;
210
+ pointer-events: none;
211
+ }
212
+ .${t}-editor-image-bounds {
213
+ fill: none;
214
+ stroke: #FF5C02;
215
+ stroke-width: 1;
216
+ opacity: 0.7;
217
+ pointer-events: none;
218
+ }
219
+ .${t}-a11y {
220
+ position: absolute;
221
+ width: 1px;
222
+ height: 1px;
223
+ margin: -1px;
224
+ padding: 0;
225
+ border: 0;
226
+ overflow: hidden;
227
+ clip: rect(0 0 0 0);
228
+ clip-path: inset(50%);
229
+ white-space: nowrap;
230
+ }
231
+ `,Ur=1;function Br({settings:t,content:e,isEditor:n,isPreviewMode:o,isEditMode:i,isSelected:r,isUIHidden:c,onUpdateSettings:l}){const{prefix:a}=No.useScopedStyles(),f=u.useMemo(()=>Jr(a),[a]),h=n??!1,b=!!r||!!i,X=u.useMemo(()=>Array.isArray(e)?e[0]??{}:{},[e]),F=(t==null?void 0:t.shape)??"custom",y=(t==null?void 0:t.customPath)??"",D=(t==null?void 0:t.pathFit)??"stretch",A=u.useMemo(()=>Qr(t==null?void 0:t.pathViewBox),[t==null?void 0:t.pathViewBox]),H=(t==null?void 0:t.shapeMode)==="B"?"avoid":"contain",x=(t==null?void 0:t.textAlign)??"left",Y=((t==null?void 0:t.overflowMode)??"clip")==="visible",k=((t==null?void 0:t.fitText)??"off")==="on",Q=((t==null?void 0:t.hyphenate)??"off")==="on",xt=me.scalingValue((t==null?void 0:t.padding)??0,h),ut=Math.max(1,Math.round((t==null?void 0:t.columns)??1)),dt=me.scalingValue((t==null?void 0:t.columnGutter)??0,h),rt=(t==null?void 0:t.dropCapSize)??Ur,yt=Math.max(1,Math.round((t==null?void 0:t.dropCapLines)??rt)),L=h&&b&&!o,gt=h&&!o&&!c,[S,g]=u.useState(!1);u.useEffect(()=>{if(!h||!b){g(!1);return}const $=()=>g(!0),j=()=>g(!1),B=["ArticleEditor.Item:drag-start","ArticleEditor.Selection:resize-start","ArticleEditor.Selection:move-start"],wt=["ArticleEditor.Item:drag-end","ArticleEditor.Selection:resize-end","ArticleEditor.Selection:move-end"];for(const et of B)window.addEventListener(et,$);for(const et of wt)window.addEventListener(et,j);return()=>{for(const et of B)window.removeEventListener(et,$);for(const et of wt)window.removeEventListener(et,j)}},[h,b]);const C=h&&b&&!o&&typeof l=="function",T=!S&&!c,W=Math.max(0,(t==null?void 0:t.pathSnap)??0),O=u.useRef(t??{}),_=u.useRef(""),d=[t==null?void 0:t.customPath,t==null?void 0:t.shape,t==null?void 0:t.pathFit,t==null?void 0:t.pathViewBox,t==null?void 0:t.imageScale,t==null?void 0:t.imageFocalX,t==null?void 0:t.imageFocalY,t==null?void 0:t.image].join("\0");if(d!==_.current)_.current=d,O.current=t??{};else if(t){const{customPath:$,shape:j,pathFit:B,pathViewBox:wt,imageScale:et,imageFocalX:Dt,imageFocalY:Tt,image:ht,...V}=t,ct=O.current;for(const Mt of Object.keys(V))if(ct[Mt]!==V[Mt]){O.current={...ct,...V};break}}const[Z,q]=u.useState(null),[it,nt]=u.useState(!1),[ft,v]=u.useState(!1),St=u.useCallback(()=>v(!1),[]),Xt=O.current.shape??F,Vt=!!(Z&&(Z.base===y||Z.serialized===y)),jt=Vt&&Z?Z.serialized:y;u.useEffect(()=>{C||(nt(!1),v(!1))},[C]),u.useEffect(()=>{!Z||it||Z.serialized===y&&q(null)},[Z,y,it]);const pt=u.useMemo(()=>{if(!C)return null;if(Z&&(Z.base===y||Z.serialized===y))return Z.contours;const $=te(y);return $.length?$:null},[C,Z,y]),$t=!!(D==="viewbox"&&((t==null?void 0:t.pathViewBox)??"")===Pe&&pt&&(F==="circle"||!io(pt,A))),At=u.useCallback(($,j,B)=>{const wt=le($);if(q(et=>({base:et&&(et.base===y||et.serialized===y)?et.base:y,serialized:wt,contours:$})),j){const et=O.current,Dt=B!=null&&B.preserveShape?et.shape:"custom",Tt={...et,shape:Dt,customPath:wt};O.current=Tt,l==null||l(Tt)}},[y,l]),mt=u.useMemo(()=>C?{contours:$t?pt:null,snap:W,needsConversion:!$t,onConvert:$=>{const j=le($);q({base:j,serialized:j,contours:$});const B={...O.current,pathFit:"viewbox",pathViewBox:Pe,customPath:j};O.current=B,l==null||l(B)},onChange:($,j)=>{nt(!0),v(!!(j!=null&&j.carryImage)),At($,!1)},onCommit:($,j)=>{At($,!0,j),nt(!1)}}:null,[C,$t,pt,W,l,At]),J=H==="avoid"&&!!(t!=null&&t.image),ot=u.useMemo(()=>({focalX:(t==null?void 0:t.imageFocalX)??.5,focalY:(t==null?void 0:t.imageFocalY)??.5,scale:(t==null?void 0:t.imageScale)??1}),[t==null?void 0:t.imageFocalX,t==null?void 0:t.imageFocalY,t==null?void 0:t.imageScale]),[It,zt]=u.useState(null),Wt=It??ot,_t=u.useCallback($=>zt($),[]),lt=u.useCallback($=>{zt($);const j={...O.current,imageFocalX:$.focalX,imageFocalY:$.focalY,imageScale:$.scale};O.current=j,l==null||l(j)},[l]);u.useEffect(()=>{It&&Math.abs(It.focalX-ot.focalX)<1e-9&&Math.abs(It.focalY-ot.focalY)<1e-9&&Math.abs(It.scale-ot.scale)<1e-9&&zt(null)},[It,ot]);const s=u.useMemo(()=>!C||!J?null:{onChange:_t,onCommit:lt},[C,J,_t,lt]),[M,w]=u.useState(void 0),R=u.useRef(void 0),N=u.useCallback($=>{const j=R.current;j!==void 0&&Math.abs(j-$)<.005||(R.current=$,w($))},[]),m=u.useMemo(()=>k&&typeof M=="number"?M:1,[M,k]),P=$=>`calc(${$} * var(--${a}-fit, 1))`,z=u.useMemo(()=>{var B,wt,et,Dt,Tt;const $=(t==null?void 0:t.textFontSize)??.012,j=Math.max((t==null?void 0:t.textLineHeight)??$,$);return{fontFamily:eo.normalizeFontFamilyCssValue(t==null?void 0:t.textFontFamily),fontWeight:(B=t==null?void 0:t.textFontSettings)==null?void 0:B.fontWeight,fontStyle:(wt=t==null?void 0:t.textFontSettings)==null?void 0:wt.fontStyle,fontSize:P(me.scalingValue($,h)),lineHeight:P(me.scalingValue(j,h)),letterSpacing:P(me.scalingValue((t==null?void 0:t.textLetterSpacing)??0,h)),wordSpacing:P(me.scalingValue((t==null?void 0:t.textWordSpacing)??0,h)),textTransform:(et=t==null?void 0:t.textTextAppearance)==null?void 0:et.textTransform,textDecoration:(Dt=t==null?void 0:t.textTextAppearance)==null?void 0:Dt.textDecoration,fontVariant:(Tt=t==null?void 0:t.textTextAppearance)==null?void 0:Tt.fontVariant}},[t,h,a]),tt={[`--${a}-text-color`]:(t==null?void 0:t.textColor)??"#000000",[`--${a}-link-color`]:(t==null?void 0:t.linkColor)??(t==null?void 0:t.textColor)??"#000000",[`--${a}-background-color`]:(t==null?void 0:t.backgroundColor)??"transparent"};return I.jsxs(I.Fragment,{children:[I.jsx("style",{dangerouslySetInnerHTML:{__html:f}}),I.jsx("div",{className:`${a}-wrapper`,style:{...tt},children:I.jsx(Kr,{P:a,item:X,shape:Xt,customPath:y,pathFit:D,viewBox:A,mode:H,align:x,allowOverflow:Y,fitEnabled:k,scale:m,onFitScale:N,padding:xt,columns:ut,gutter:dt,hyphenate:Q,showOverflowIndicator:gt,dropCapLines:yt,dropCapSize:rt,showGuides:(L||C)&&T,typography:z,imageUrl:H==="avoid"?t==null?void 0:t.image:null,imageFocalX:Wt.focalX,imageFocalY:Wt.focalY,imageScale:Wt.scale,imageCustomPath:jt,imagePathEdited:Vt,pathDragActive:it,pathCarryImage:ft,onCarryImageConsumed:St,pathEditor:T?mt:null,imageEditor:T?s:null})})]})}exports.EDIT_VIEW_BOX=Pe;exports.Pretext=Br;exports.SHAPE_IDS=Zr;exports.clearNodeHandle=lo;exports.flattenContours=Ce;exports.insertNodeOnSegment=ho;exports.mapContours=Ft;exports.moveNodeTo=co;exports.moveSelectedNodesBy=ln;exports.nearestSegmentHit=un;exports.parsePathNodes=te;exports.removeContourNode=$n;exports.removeContourNodes=so;exports.ringsToContours=Sn;exports.scaleContours=sn;exports.serializeContours=le;exports.setNodeHandle=ao;exports.settingsForEditablePreset=rr;exports.toggleNodeSmooth=hn;