| 1 |
(()=>{"use strict";var t={n:e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return t.d(n,{a:n}),n},d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const e=window.ReactDOM,n="@media only screen and (max-width: 1024px)",r="@media only screen and (max-width: 640px)",o=window.React;var s=t.n(o);const l=(t,e)=>{return null==(n=e)||""===n||Array.isArray(n)&&0===n.length||"object"==typeof n&&0===Object.keys(n).length||"string"==typeof n&&""===n.trim()||"number"==typeof n&&0===n?"":`${t}: ${e};`;var n},i=(t,e,o=!0)=>{const{fontFamily:s="Default",fontCategory:i="sans-serif",fontVariant:a=400,fontWeight:c,isUploadFont:u=!0,fontSize:$={desktop:null,tablet:null,mobile:null},fontStyle:f,textTransform:h,textDecoration:d,lineHeight:p,letterSpace:m}=e||{},x=!o||!s||"Default"===s,y=$?.desktop||$,g=$?.tablet||y,b=$?.mobile||g,w=t=>{const e=String(t);return["px","em","rem","%","vh","vw"].some((t=>e.endsWith(t)))?e:"number"==typeof t?`${e}px`:""},k=`\n\t\t${x?"":`font-family: '${s}', ${i};`}\n\t\t${l("font-weight",c)}\n\t\t${l("font-size",w(y))}\n\t\t${l("font-style",f)}\n\t\t${l("text-transform",h)}\n\t\t${l("text-decoration",d)}\n\t\t${l("line-height",p)}\n\t\t${l("letter-spacing",m)}\n\t`,S=a&&400!==a?"400i"===a?":ital@1":a?.includes("00i")?`: ital, wght@1, ${a?.replace("00i","00")} `:`: wght@${a} `:"",v=x?"":`https://fonts.googleapis.com/css2?family=${s?.split(" ").join("+")}${S.replace(/ /g,"")}&display=swap`;return{googleFontLink:!u||x?"":`@import url(${v});`,styles:`${t}{\n\t\t\t${k}\n\t\t}\n\t\t${n} {\n\t\t\t${t}{\n\t\t\t\t${l("font-size",w(g))}\n\t\t\t}\n\t\t}\n\t\t${r} {\n\t\t\t${t}{\n\t\t\t\t${l("font-size",w(b))}\n\t\t\t}\n\t\t}`.replace(/\s+/g," ").trim()}},a=window.ReactJSXRuntime,c=({attributes:t,id:e})=>{const{styles:o}=t,{container:s,title:c,path:u}=o,$=`#${e} .b-blocks-text-path-container`,f=`${$} .b-blocks-text-path-svg`,h=`${f} .b-blocks-text-path-title`,d=(t="normal")=>{const e=c[t],n=e?.textStroke.isStroke?`${l("stroke-width",e.textStroke.size?e.textStroke.size+"px":"")}\n\t\t\t${l("stroke",e.textStroke.color)}`:"";return`\n\t\t\t${l("color",e.color)}\n\t\t\t${l("fill",e.color)}\n\t\t\t${l("text-shadow",((t,e="box")=>{let n="";return t?.map(((r,o)=>{const{hOffset:s="0px",vOffset:l="0px",blur:i="0px",spreed:a="0px",color:c="#e7f0fe",isInset:u=!1}=r||{},$=u?"inset":"",f=`${s} ${l} ${i}`,h=o+1>=t.length?"":", ";n+="text"===e?`${f} ${c}${h}`:`${f} ${a} ${c} ${$}${h}`})),n||""})(e.textShadow,"text"))}\n\t\t\t${n}\n\t\t`};return(0,a.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n\n\t\t${i("",c.typo).googleFontLink}\n\n\t\t${i(h,c.typo).styles}\n\n\t\t${$}{\n\t\t\t${l("justify-content",s.desktop.alignment)}\n\t\t}\n\n\t\t${f}{\n\t\t\t${l("rotate",u.rotate?u.rotate+"deg":"")}\n\t\t\t${l("width",u.size)}\n\t\t\t${l("width",u.size)}\n\t\t}\n\n\t\t${h}{\n\t\t\t${d("normal")}\t\t\n\t\t\ttransition: all ${c.transition}s ease-in-out;\n\t\t}\n\n\t\t${h}:hover{\n\t\t\t${d("hover")}\t\t\n\t\t}\n\t\t\n\t\t${n}{\n\t\t\t\t${$}{\n\t\t\t${l("justify-content",s.tablet.alignment)}\n\t\t\t}\n\t\t}\n\t\t${r}{\n\t\t\t\t${$}{\n\t\t\t${l("justify-content",s.mobile.alignment)}\n\t\t\t}\n\t\t}\n\t\t\n\t`}})};function u(t,e,n){return Math.max(e,Math.min(n,t))}function $(t){if("number"==typeof t)return u(t,0,1);const e=String(t).trim();if(e.endsWith("%"))return u(parseFloat(e.slice(0,-1))/100,0,1);const n=Number(e);return Number.isFinite(n)?u(n,0,1):0}const f=({pathSize:t=300,alignment:e="start",customPath:n="",customSvgPathSelector:r="",showIcon:l=!1,icon:i=null,iconSize:c=24,iconStartOffset:u="5%",iconEndOffset:f="95%",attributes:h})=>{const{icon:d,styles:p}=h,{type:m,iconType:x,title:y}=d,{path:g}=p,b="custom"===m?"library"===x?d.library:d.upload:"",w=(0,o.useMemo)((()=>`textPath-${Math.random().toString(36).slice(2)}`),[]),k=(0,o.useRef)(null),[S,v]=(0,o.useState)(null),[j,M]=(0,o.useState)(null),O=(0,o.useMemo)((()=>b?function(t,e){if(!t||"string"!=typeof t)return null;if("undefined"==typeof window)return null;try{const n=(new DOMParser).parseFromString(t,"image/svg+xml"),r=n.querySelector("svg");if(!r)return null;const o=r.getAttribute("viewBox")||null,s=(e?n.querySelector(e):null)||n.querySelector("path"),l=s?.getAttribute("d")||null;return l?{viewBox:o,d:l}:null}catch{return null}}(b,r||null):null),[b,r]),A="custom"===m&&O?.viewBox||O?.viewBox||`0 0 ${t} ${t}`;(0,o.useEffect)((()=>{if(!l)return;const t=k.current;if(!t)return;let e=0;try{e=t.getTotalLength()}catch{return}if(!e||!Number.isFinite(e))return;const n=$(u),r=$(f),o=t.getPointAtLength(e*n),s=t.getPointAtLength(e*r);v({x:o.x,y:o.y}),M({x:s.x,y:s.y})}),[l,u,f,t,m,n,b,O?.d]);const L=()=>i&&s().isValidElement(i)?s().cloneElement(i,{...i.props,width:c,height:c,fill:i.props.fill??"currentColor",stroke:i.props.stroke??"currentColor",style:{display:"block",...i.props.style||{}}}):null;return(0,a.jsx)("div",{className:"b-blocks-text-path-container",children:(0,a.jsxs)("svg",{viewBox:A,style:{transition:"transform 0.3s ease"},className:"b-blocks-text-path-svg",children:[(0,a.jsx)("defs",{children:(0,a.jsx)("path",{ref:k,id:w,d:(()=>{const e=t,r=t,o=e/2,s=r/2;switch(m){case"arc":return`M 50,${s+50} Q ${o},${s-100} ${e-50},${s+50}`;case"wave":{const t=40,n=2;let r=`M 0,${s}`;for(let o=0;o<=e;o+=5)r+=` L ${o},${s+t*Math.sin(o/e*Math.PI*n)}`;return r}case"circle":{const t=Math.min(e,r)/2-20;return`M ${o-t},${s}\n A ${t},${t} 0 1,1 ${o+t},${s}\n A ${t},${t} 0 1,1 ${o-t},${s}`}case"custom":return b&&O?.d?O.d:n||`M 50,${s} L ${e-50},${s}`;case"line":return`M 50,${s} L ${e-50},${s}`}})(),fill:"none",stroke:g.color,strokeWidth:g.thickness,strokeLinecap:"round",style:{transition:"stroke 0.3s ease"}})}),(0,a.jsx)("use",{href:`#${w}`}),l&&S&&(0,a.jsx)("g",{transform:`translate(${S.x}, ${S.y})`,children:(0,a.jsx)("g",{transform:`translate(${-c/2}, ${-c/2})`,fill:g.color,stroke:g.color,children:L()})}),l&&j&&(0,a.jsx)("g",{transform:`translate(${j.x}, ${j.y})`,children:(0,a.jsx)("g",{transform:`translate(${-c/2}, ${-c/2})`,fill:g.color,stroke:g.color,children:L()})}),(0,a.jsx)("text",{className:"b-blocks-text-path-title",textAnchor:e,children:(0,a.jsx)("textPath",{href:`#${w}`,startOffset:g.staringPoint,style:{textAnchor:e},children:y})})]})})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-text-path").forEach((t=>{const n=JSON.parse(t.dataset.attributes);(0,e.createRoot)(t).render((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c,{attributes:n,id:t.id}),(0,a.jsx)(f,{attributes:n})]})),t?.removeAttribute("data-attributes")}))}))})(); |