From d3ee837ac976d0a0c8737c1a0877d879934bb2f6 Mon Sep 17 00:00:00 2001 From: Khairul Hidayat Date: Fri, 26 May 2023 16:10:20 +0700 Subject: [PATCH] Updates --- assets/{index-92526942.js => index-11b2740a.js} | 2 +- index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename assets/{index-92526942.js => index-11b2740a.js} (99%) diff --git a/assets/index-92526942.js b/assets/index-11b2740a.js similarity index 99% rename from assets/index-92526942.js rename to assets/index-11b2740a.js index bd3261e..1289b32 100644 --- a/assets/index-92526942.js +++ b/assets/index-11b2740a.js @@ -401,4 +401,4 @@ Error generating stack: `+i.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var lc=b,RB=MB;function zB(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var FB=typeof Object.is=="function"?Object.is:zB,IB=RB.useSyncExternalStore,DB=lc.useRef,OB=lc.useEffect,LB=lc.useMemo,jB=lc.useDebugValue;bk.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=DB(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=LB(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),o!==void 0&&a.hasValue){var v=a.value;if(o(v,h))return d=v}return d=h}if(v=d,FB(c,h))return v;var g=r(h);return o!==void 0&&o(v,g)?v:(c=h,d=g)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,o]);var s=IB(e,i[0],i[1]);return OB(function(){a.hasValue=!0,a.value=s},[s]),jB(s),s};yk.exports=bk;var BB=yk.exports;const NB=Va(BB),{useSyncExternalStoreWithSelector:VB}=NB;function WB(e,t=e.getState,n){const r=VB(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return b.useDebugValue(r),r}const gy=e=>{({BASE_URL:"/loli-license",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?xB(e):e,n=(r,o)=>WB(t,r,o);return Object.assign(n,t),n},HB=e=>e?gy(e):gy,UB="/loli-license/assets/mahirussy-15408101.jpg",yy=(e=1)=>{let t="";const n="abcdefghijklmnopqrstuvwxyz".toUpperCase();for(let r=0;ryy()+"-"+yy(2)+Math.round(Math.random()*9999).toString().padStart(4,"0"),wk=HB(e=>({name:"Mahiro Oyama",idNo:GB(),accessLevel:"Headpats and hugs only",sex:"Male",birthday:wl().format("YYYY-MM-DD"),photo:UB,expYears:5,showWatermarkOnExport:!0,setValues:t=>e({...t})})),KB=(e,t,n,r,o,i)=>{for(var a=t.split(" "),s="",l=0;lo&&l>0?(e.fillText(s,n,r),s=a[l]+" ",r+=i):s=u}e.fillText(s,n,r)},YB=e=>{e=e.replace(/^\s+|\s+$/g,""),e=e.toLowerCase();for(var t="àáãäâèéëêìíïîòóöôùúüûñç·/_,:;",n="aaaaaeeeeiiiioooouuuunc------",r=0,o=t.length;r{a=typeof a=="number"?a:.5,s=typeof s=="number"?s:.5,a<0&&(a=0),s<0&&(s=0),a>1&&(a=1),s>1&&(s=1);var l=t.width,u=t.height,c=Math.min(o/l,i/u),d=l*c,f=u*c,h,v,g,x,m=1;dl&&(g=l),x>u&&(x=u),e.drawImage(t,h,v,g,x,n,r,o,i)},by=e=>new Promise(t=>{const n=new Image;n.src=e,n.onload=()=>{t(n)}}),XB=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>{t(r.result)},r.onerror=o=>{n(o)}}),QB=({isOpen:e,onClose:t})=>{const n=wk(),r=b.useRef(null),o=async i=>{var l;if(!((l=i.target.files)!=null&&l.length))return;const a=i.target.files[0],s=await XB(a);n.setValues({photo:s})};return w.jsxs(cB,{isOpen:e,placement:"right",onClose:t,children:[w.jsx(sk,{}),w.jsxs(ok,{children:[w.jsx(uk,{}),w.jsx(ak,{children:"Card Detail"}),w.jsx(lk,{children:w.jsxs(Kw,{spacing:3,alignItems:"stretch",children:[w.jsxs(cu,{w:"120px",h:40,bg:"white",shadow:"md",rounded:"md",p:2,overflow:"hidden",position:"relative",onClick:()=>{var i;return(i=r.current)==null?void 0:i.click()},children:[w.jsx(sw,{src:n.photo,w:"full",h:"full",objectFit:"cover"}),w.jsx(os,{position:"absolute",top:1,right:1,color:"gray.900",bg:"whiteAlpha.800",p:1,rounded:"md",children:w.jsx(vk,{})})]}),w.jsx("input",{ref:r,type:"file",accept:"image/*",onChange:o,style:{display:"none"}}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Agent Name"}),w.jsx(Dr,{value:n.name,onChange:i=>n.setValues({name:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"ID Number"}),w.jsx(Dr,{value:n.idNo,onChange:i=>n.setValues({idNo:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Sex"}),w.jsx(Dr,{value:n.sex,onChange:i=>n.setValues({sex:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Birthday"}),w.jsx(Dr,{type:"date",value:n.birthday,onChange:i=>n.setValues({birthday:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Access Level"}),w.jsx(Dr,{value:n.accessLevel,onChange:i=>n.setValues({accessLevel:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Expires in"}),w.jsx(dk,{value:n.expYears.toString(),onChange:i=>n.setValues({expYears:parseInt(i.target.value,10)||1}),children:[...Array(10)].map((i,a)=>w.jsx("option",{value:(a+1).toString(),children:`${a+1} years`},a))})]}),w.jsx(fw,{isChecked:n.showWatermarkOnExport,onChange:i=>n.setValues({showWatermarkOnExport:i.target.checked}),children:"Show Watermark on Export"})]})}),w.jsx(ik,{children:w.jsx(cu,{colorScheme:"blue",onClick:()=>t(),children:"Save"})})]})]})},ZB="/loli-license/assets/base-card-bg-2a2686cb.png",JB=({onRef:e})=>{const t=b.useRef(null),n=wk(),[r,o]=b.useState({base:null,photo:null});b.useEffect(()=>{by(ZB).then(s=>{o(l=>({...l,base:s}))})},[]),b.useEffect(()=>{const s=n.photo;s&&by(s).then(l=>{o(u=>({...u,photo:l}))})},[n.photo]);const i=(s=!1)=>{if(!t.current)return;const l=t.current,u=l.getContext("2d");if(!u||!r.base)return;l.width=r.base.width,l.height=r.base.height+(s?12:0),u.clearRect(0,0,l.width,l.height),u.rect(0,0,l.width,l.height),u.fillStyle="#f3f3f3",u.fill(),r.photo&&qB(u,r.photo,640,40,172,230),u.drawImage(r.base,0,0),u.fillStyle="#111",u.font="normal 24px Arial",u.fillText(n.name,190,152),u.fillText(n.idNo,190,220),KB(u,n.accessLevel,190,290,180,28),u.fillText(n.sex,418,152),u.fillText(wl(n.birthday).format("DD-MMM-YYYY"),418,220),u.fillText("One at time",418,290);const c=wl().add(n.expYears,"year");u.fillText(wl(c).format("YYYYMMMDD").toUpperCase(),320,416),s&&(u.fillStyle="#333",u.font="normal 16px Arial",u.fillText("Wanna join FBI watch list? s.id/loli-license",20,l.height-8))};b.useEffect(()=>{i()},[i,r,n]);const a=()=>{t.current&&(i(n.showWatermarkOnExport),setTimeout(()=>{const s=document.createElement("a");s.download=`loli_license_${YB(n.name)}.png`,s.href=t.current.toDataURL(),s.click(),i(!1)},100))};return b.useEffect(()=>{e&&e({onExport:a})},[]),w.jsx(os,{flex:1,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",padding:3,children:w.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%"}})})},eN=()=>{const e=b.useRef(null),t=mj();return w.jsxs(cO,{children:[w.jsx(QB,{isOpen:t.isOpen,onClose:t.onClose}),w.jsxs(os,{bg:"gray.100",display:"flex",flexDir:"column",height:"100vh",alignItems:"stretch",overflow:"hidden",children:[w.jsx(vB,{title:"My Loli License",actions:w.jsxs(w.Fragment,{children:[w.jsx(sh,{size:"lg",fontSize:"xl","aria-label":"Save",icon:w.jsx(bB,{}),variant:"ghost",onClick:()=>e.current&&e.current.onExport()}),w.jsx(sh,{size:"lg",fontSize:"xl","aria-label":"Edit",icon:w.jsx(vk,{}),variant:"ghost",onClick:t.onOpen})]})}),w.jsx(JB,{onRef:n=>{e.current=n}}),w.jsxs(dm,{textAlign:"center",my:2,children:["Artwork by:"," ",w.jsx(vh,{fontWeight:"bold",href:"https://www.artstation.com/artwork/14orKL",children:"FLying Cookie"}),"  | Fork on ",w.jsx(vh,{fontWeight:"bold",href:"https://github.com/khairul169/loli-license.git",children:"Github"})]})]})]})};Fd.createRoot(document.getElementById("root")).render(w.jsx(yt.StrictMode,{children:w.jsx(eN,{})})); + */var lc=b,RB=MB;function zB(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var FB=typeof Object.is=="function"?Object.is:zB,IB=RB.useSyncExternalStore,DB=lc.useRef,OB=lc.useEffect,LB=lc.useMemo,jB=lc.useDebugValue;bk.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var i=DB(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=LB(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),o!==void 0&&a.hasValue){var v=a.value;if(o(v,h))return d=v}return d=h}if(v=d,FB(c,h))return v;var g=r(h);return o!==void 0&&o(v,g)?v:(c=h,d=g)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,o]);var s=IB(e,i[0],i[1]);return OB(function(){a.hasValue=!0,a.value=s},[s]),jB(s),s};yk.exports=bk;var BB=yk.exports;const NB=Va(BB),{useSyncExternalStoreWithSelector:VB}=NB;function WB(e,t=e.getState,n){const r=VB(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return b.useDebugValue(r),r}const gy=e=>{({BASE_URL:"/loli-license",MODE:"production",DEV:!1,PROD:!0,SSR:!1}&&"production")!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?xB(e):e,n=(r,o)=>WB(t,r,o);return Object.assign(n,t),n},HB=e=>e?gy(e):gy,UB="/loli-license/assets/mahirussy-15408101.jpg",yy=(e=1)=>{let t="";const n="abcdefghijklmnopqrstuvwxyz".toUpperCase();for(let r=0;ryy()+"-"+yy(2)+Math.round(Math.random()*9999).toString().padStart(4,"0"),wk=HB(e=>({name:"Mahiro Oyama",idNo:GB(),accessLevel:"Headpats and hugs only",sex:"Male",birthday:wl().format("YYYY-MM-DD"),photo:UB,expYears:5,showWatermarkOnExport:!0,setValues:t=>e({...t})})),KB=(e,t,n,r,o,i)=>{for(var a=t.split(" "),s="",l=0;lo&&l>0?(e.fillText(s,n,r),s=a[l]+" ",r+=i):s=u}e.fillText(s,n,r)},YB=e=>{e=e.replace(/^\s+|\s+$/g,""),e=e.toLowerCase();for(var t="àáãäâèéëêìíïîòóöôùúüûñç·/_,:;",n="aaaaaeeeeiiiioooouuuunc------",r=0,o=t.length;r{a=typeof a=="number"?a:.5,s=typeof s=="number"?s:.5,a<0&&(a=0),s<0&&(s=0),a>1&&(a=1),s>1&&(s=1);var l=t.width,u=t.height,c=Math.min(o/l,i/u),d=l*c,f=u*c,h,v,g,x,m=1;dl&&(g=l),x>u&&(x=u),e.drawImage(t,h,v,g,x,n,r,o,i)},by=e=>new Promise(t=>{const n=new Image;n.src=e,n.onload=()=>{t(n)}}),XB=e=>new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>{t(r.result)},r.onerror=o=>{n(o)}}),QB=({isOpen:e,onClose:t})=>{const n=wk(),r=b.useRef(null),o=async i=>{var l;if(!((l=i.target.files)!=null&&l.length))return;const a=i.target.files[0],s=await XB(a);n.setValues({photo:s})};return w.jsxs(cB,{isOpen:e,placement:"right",onClose:t,children:[w.jsx(sk,{}),w.jsxs(ok,{children:[w.jsx(uk,{}),w.jsx(ak,{children:"Card Detail"}),w.jsx(lk,{children:w.jsxs(Kw,{spacing:3,alignItems:"stretch",children:[w.jsxs(cu,{w:"120px",h:40,bg:"white",shadow:"md",rounded:"md",p:2,overflow:"hidden",position:"relative",onClick:()=>{var i;return(i=r.current)==null?void 0:i.click()},children:[w.jsx(sw,{src:n.photo,w:"full",h:"full",objectFit:"cover"}),w.jsx(os,{position:"absolute",top:1,right:1,color:"gray.900",bg:"whiteAlpha.800",p:1,rounded:"md",children:w.jsx(vk,{})})]}),w.jsx("input",{ref:r,type:"file",accept:"image/*",onChange:o,style:{display:"none"}}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Agent Name"}),w.jsx(Dr,{value:n.name,onChange:i=>n.setValues({name:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"ID Number"}),w.jsx(Dr,{value:n.idNo,onChange:i=>n.setValues({idNo:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Sex"}),w.jsx(Dr,{value:n.sex,onChange:i=>n.setValues({sex:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Birthday"}),w.jsx(Dr,{type:"date",value:n.birthday,onChange:i=>n.setValues({birthday:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Access Level"}),w.jsx(Dr,{value:n.accessLevel,onChange:i=>n.setValues({accessLevel:i.target.value})})]}),w.jsxs(Rr,{children:[w.jsx(zr,{children:"Expires in"}),w.jsx(dk,{value:n.expYears.toString(),onChange:i=>n.setValues({expYears:parseInt(i.target.value,10)||1}),children:[...Array(10)].map((i,a)=>w.jsx("option",{value:(a+1).toString(),children:`${a+1} years`},a))})]}),w.jsx(fw,{isChecked:n.showWatermarkOnExport,onChange:i=>n.setValues({showWatermarkOnExport:i.target.checked}),children:"Show Watermark on Export"})]})}),w.jsx(ik,{children:w.jsx(cu,{colorScheme:"blue",onClick:()=>t(),children:"Save"})})]})]})},ZB="/loli-license/assets/base-card-bg-2a2686cb.png",JB=({onRef:e})=>{const t=b.useRef(null),n=wk(),[r,o]=b.useState({base:null,photo:null});b.useEffect(()=>{by(ZB).then(s=>{o(l=>({...l,base:s}))})},[]),b.useEffect(()=>{const s=n.photo;s&&by(s).then(l=>{o(u=>({...u,photo:l}))})},[n.photo]);const i=(s=!1)=>{if(!t.current)return;const l=t.current,u=l.getContext("2d");if(!u||!r.base)return;l.width=r.base.width,l.height=r.base.height+(s?12:0),u.clearRect(0,0,l.width,l.height),u.rect(0,0,l.width,l.height),u.fillStyle="#f3f3f3",u.fill(),r.photo&&qB(u,r.photo,640,40,172,230),u.drawImage(r.base,0,0),u.fillStyle="#111",u.font="normal 24px Arial",u.fillText(n.name,190,152),u.fillText(n.idNo,190,220),KB(u,n.accessLevel,190,290,180,28),u.fillText(n.sex,418,152),u.fillText(wl(n.birthday).format("DD-MMM-YYYY"),418,220),u.fillText("One at time",418,290);const c=wl().add(n.expYears,"year");u.fillText(wl(c).format("YYYYMMMDD").toUpperCase(),320,416),s&&(u.fillStyle="#333",u.font="normal 16px Arial",u.fillText("Wanna join FBI watch list? s.id/loli-license",20,l.height-8))};b.useEffect(()=>{i()},[i,r,n]);const a=()=>{t.current&&(i(n.showWatermarkOnExport),setTimeout(()=>{const s=document.createElement("a");s.download=`loli_license_${YB(n.name)}.png`,s.href=t.current.toDataURL(),s.click(),i(!1)},100))};return b.useEffect(()=>{e&&e({onExport:a})},[a]),w.jsx(os,{flex:1,display:"flex",justifyContent:"center",alignItems:"center",overflow:"hidden",padding:3,children:w.jsx("canvas",{ref:t,style:{maxWidth:"100%",maxHeight:"100%"}})})},eN=()=>{const e=b.useRef(null),t=mj();return w.jsxs(cO,{children:[w.jsx(QB,{isOpen:t.isOpen,onClose:t.onClose}),w.jsxs(os,{bg:"gray.100",display:"flex",flexDir:"column",height:"100vh",alignItems:"stretch",overflow:"hidden",children:[w.jsx(vB,{title:"My Loli License",actions:w.jsxs(w.Fragment,{children:[w.jsx(sh,{size:"lg",fontSize:"xl","aria-label":"Save",icon:w.jsx(bB,{}),variant:"ghost",onClick:()=>e.current&&e.current.onExport()}),w.jsx(sh,{size:"lg",fontSize:"xl","aria-label":"Edit",icon:w.jsx(vk,{}),variant:"ghost",onClick:t.onOpen})]})}),w.jsx(JB,{onRef:n=>{e.current=n}}),w.jsxs(dm,{textAlign:"center",my:2,children:["Artwork by:"," ",w.jsx(vh,{fontWeight:"bold",href:"https://www.artstation.com/artwork/14orKL",children:"FLying Cookie"}),"  | Fork on ",w.jsx(vh,{fontWeight:"bold",href:"https://github.com/khairul169/loli-license.git",children:"Github"})]})]})]})};Fd.createRoot(document.getElementById("root")).render(w.jsx(yt.StrictMode,{children:w.jsx(eN,{})})); diff --git a/index.html b/index.html index 8ad8e43..973d654 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ License to Have Lolis Generator - +