import{g as e,h as t,p as n}from"./fonts-BFxTwZ_G.js";var r=(e,t)=>!e||e.type===`auto`?null:e.type===`percent`?e.value/100*t:e.value,i=(e,t,n,i,a)=>{let o=r(e,i),s=r(t,i),c=r(n,i);if(o!=null&&c!=null){let t=e?.type===`auto`?void 0:e?.align;return t===`center`?{position:o-c/2,length:c}:t===`end`?{position:o-c,length:c}:{position:o,length:c}}return s!=null&&c!=null?{position:i-s-c,length:c}:o!=null&&s!=null?{position:o,length:Math.max(0,i-o-s)}:c==null?o==null?s==null?{position:(i-a)/2,length:a}:{position:i-s-a,length:a}:{position:o,length:a}:{position:(i-c)/2,length:c}};function a(e,t){let n=Math.round(t.width*.4),r=Math.round(t.height*.12),a=i(e.left,e.right,e.width,t.width,n),o=i(e.top,e.bottom,e.height,t.height,r);return{x:a.position,y:o.position,width:a.length,height:o.length}}function o(e,t,n){let r=e=>e?.type===`percent`||e==null,i=e=>e&&e.type!==`auto`?e.align:void 0,a=(e,t,n)=>{let a=i(e);return r(e)?{type:`percent`,value:+(t/n*100).toFixed(3),align:a}:{type:`px`,value:Math.round(t),align:a}},o={},s=n.left!=null&&n.left.type!==`auto`,c=n.right!=null&&n.right.type!==`auto`,l=n.top!=null&&n.top.type!==`auto`,u=n.bottom!=null&&n.bottom.type!==`auto`;if(s||!c){let r=n.left?.type===`auto`?void 0:n.left?.align,i=r===`center`?e.x+e.width/2:r===`end`?e.x+e.width:e.x;o.left=a(n.left,i,t.width)}if(c&&(o.right=a(n.right,t.width-e.x-e.width,t.width)),l||!u){let r=n.top?.type===`auto`?void 0:n.top?.align,i=r===`center`?e.y+e.height/2:r===`end`?e.y+e.height:e.y;o.top=a(n.top,i,t.height)}return u&&(o.bottom=a(n.bottom,t.height-e.y-e.height,t.height)),o.width=a(n.width,e.width,t.width),o.height=a(n.height,e.height,t.height),o}var s={iphone_portrait:{w:1320,h:2868},ipad_portrait:{w:2064,h:2752},android_phone_portrait:{w:1080,h:1920},android_10_tablet_portrait:{w:1848,h:2960},iphone_landscape:{w:2868,h:1320},ipad_landscape:{w:2752,h:2064},android_phone_landscape:{w:1920,h:1080},android_10_tablet_landscape:{w:2960,h:1848},playstore_feature_graphic:{w:1024,h:500}};function c(e,t){return t?e[t]??e.default??``:e.default??``}function l(e,t){return t!==`default`&&Object.prototype.hasOwnProperty.call(e,t)}function u(e,t){return e===`center`||e===`left`||e===`right`||e===`justify`?e:e===`end`?t===`rtl`?`left`:`right`:t===`rtl`?`right`:`left`}function d(e){return{version:3,canvas:e,layers:[]}}function f(){return typeof document>`u`?null:document.createElement(`canvas`).getContext(`2d`)}function p(e,t){let n=[];return t===`italic`&&n.push(`italic`),typeof e==`number`?n.push(String(e)):e===`bold`&&n.push(`bold`),n.length>0?n.join(` `):`normal`}function m(e,t){return!t||t===`none`?e:t===`uppercase`?e.toLocaleUpperCase():t===`lowercase`?e.toLocaleLowerCase():e.replace(/(^|\s)(\S)/g,(e,t,n)=>t+n.toLocaleUpperCase())}function h(e,t,n){let r=e.measureText(t).width;return n?r+n*Math.max(0,t.length-1):r}function g(r,i,a){let o=f(),s=Math.max(1,r.fontSize),l=p(r.fontWeight,r.fontStyle),u=n(r.fontFamily,i),d=m(c(r.content,i),r.textTransform),g=e(d,r.lineHeight),v=t(d,r.letterSpacing);if(!o)return{width:0,height:s*g};o.font=`${l===`normal`?``:l+` `}${s}px ${u}`;let y=d.length===0?[``]:d.split(/\r?\n/),b=0;for(let e of y){let t=h(o,e,v);t>b&&(b=t)}let x=s*.6,S=Math.max(x,Math.ceil(b)),C=Math.max(1,y.length)*s*g;return a===void 0||S<=a?{width:S,height:C}:{width:a,height:_(d,s,u,l,g,v,a),wrapped:!0}}function _(e,t,n,r,i,a,o){let s=f();if(!s)return 0;s.font=`${r===`normal`?``:r+` `}${t}px ${n}`;let c=e.split(/\r?\n/),l=0;for(let e of c){if(!e){l+=1;continue}let t=e.split(/\s+/),n=``;for(let e of t){if(!e)continue;let t=n?n+` `+e:e;h(s,t,a)<=o?n=t:(n&&(l+=1),h(s,e,a)<=o?n=e:(l+=1,n=``))}n&&(l+=1)}return Math.max(1,l)*t*i}function v(e,t,n,r,i){let a=f();if(!a)return 0;a.font=`${r===`normal`?``:r+` `}${t}px ${n}`;let o=0;for(let t of e.split(/\s+/)){if(!t)continue;let e=h(a,t,i);e>o&&(o=e)}return o}function y(r,i,a,o){let s=c(r.content,o),l=Math.max(r.minFontSize,r.maxFontSize),u=Math.max(1,Math.min(r.minFontSize,l));if(r.fitMode===`auto`||r.fitMode===`fixed`)return Math.max(1,r.fontSize);if(r.fitMode!==`shrink`)return Math.max(r.minFontSize,Math.min(r.maxFontSize,r.fontSize));if(!s.trim()||i<=0||a<=0)return l;let d=m(s,r.textTransform),f=e(d,r.lineHeight),h=t(d,r.letterSpacing),g=p(r.fontWeight,r.fontStyle),y=n(r.fontFamily,o),b=u,x=l,S=u;for(;b<=x;){let e=Math.floor((b+x)/2),t=_(d,e,y,g,f,h,i),n=v(d,e,y,g,h);t<=a&&n<=i?(S=e,b=e+1):x=e-1}return S}export{s as a,c,a as d,g as i,u as l,p as n,d as o,y as r,l as s,m as t,o as u};