From 8e5db46b2a5204f403fee7d279ef514b27956dff Mon Sep 17 00:00:00 2001 From: Angramme <34948473+Angramme@users.noreply.github.com> Date: Thu, 25 Apr 2024 15:36:18 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=206b3ba?= =?UTF-8?q?860843bbda141e5088d2bd78d7c4cb11c65=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404.html | 2 +- .../_buildManifest.js | 2 +- .../_ssgManifest.js | 0 .../{index-3743234c1991014b.js => index-d60813bb99f77864.js} | 2 +- index.html | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename _next/static/{h_m5iHq7RFy12UPK4qMrl => NaohgDH5odtNiOKAJOm1r}/_buildManifest.js (84%) rename _next/static/{h_m5iHq7RFy12UPK4qMrl => NaohgDH5odtNiOKAJOm1r}/_ssgManifest.js (100%) rename _next/static/chunks/pages/{index-3743234c1991014b.js => index-d60813bb99f77864.js} (82%) diff --git a/404.html b/404.html index c31d906..e390726 100644 --- a/404.html +++ b/404.html @@ -1 +1 @@ -Application error: a client-side exception has occurred

Application error: a client-side exception has occurred (see the browser console for more information).

\ No newline at end of file +Application error: a client-side exception has occurred

Application error: a client-side exception has occurred (see the browser console for more information).

\ No newline at end of file diff --git a/_next/static/h_m5iHq7RFy12UPK4qMrl/_buildManifest.js b/_next/static/NaohgDH5odtNiOKAJOm1r/_buildManifest.js similarity index 84% rename from _next/static/h_m5iHq7RFy12UPK4qMrl/_buildManifest.js rename to _next/static/NaohgDH5odtNiOKAJOm1r/_buildManifest.js index 59fe9a8..7659c02 100644 --- a/_next/static/h_m5iHq7RFy12UPK4qMrl/_buildManifest.js +++ b/_next/static/NaohgDH5odtNiOKAJOm1r/_buildManifest.js @@ -1 +1 @@ -self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/b55cbb4c-c9e4dbf0d0798451.js","static/chunks/d9067523-e9066366879d9a17.js","static/chunks/e21e5bbe-29eccb7c9106e32d.js","static/chunks/6eb5140f-cbe974c85edc0136.js","static/chunks/85d7bc83-c463f8d69fe3b7c6.js","static/chunks/41155975-c30989e143fe50fe.js","static/chunks/cb355538-083b310d356672fa.js","static/chunks/4577d2ec-b5d76c623b6beacf.js","static/chunks/2e3a845b-04ceff8b13e88ba4.js","static/chunks/f3bc85ad-d4c92103ab1ca2f8.js","static/chunks/805-c15d666ef69a75a6.js","static/css/73e087ae16bfe35d.css","static/chunks/pages/index-3743234c1991014b.js"],"/_error":["static/chunks/pages/_error-5a00309fd5f4b49e.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file +self.__BUILD_MANIFEST={__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/b55cbb4c-c9e4dbf0d0798451.js","static/chunks/d9067523-e9066366879d9a17.js","static/chunks/e21e5bbe-29eccb7c9106e32d.js","static/chunks/6eb5140f-cbe974c85edc0136.js","static/chunks/85d7bc83-c463f8d69fe3b7c6.js","static/chunks/41155975-c30989e143fe50fe.js","static/chunks/cb355538-083b310d356672fa.js","static/chunks/4577d2ec-b5d76c623b6beacf.js","static/chunks/2e3a845b-04ceff8b13e88ba4.js","static/chunks/f3bc85ad-d4c92103ab1ca2f8.js","static/chunks/805-c15d666ef69a75a6.js","static/css/73e087ae16bfe35d.css","static/chunks/pages/index-d60813bb99f77864.js"],"/_error":["static/chunks/pages/_error-5a00309fd5f4b49e.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/_next/static/h_m5iHq7RFy12UPK4qMrl/_ssgManifest.js b/_next/static/NaohgDH5odtNiOKAJOm1r/_ssgManifest.js similarity index 100% rename from _next/static/h_m5iHq7RFy12UPK4qMrl/_ssgManifest.js rename to _next/static/NaohgDH5odtNiOKAJOm1r/_ssgManifest.js diff --git a/_next/static/chunks/pages/index-3743234c1991014b.js b/_next/static/chunks/pages/index-d60813bb99f77864.js similarity index 82% rename from _next/static/chunks/pages/index-3743234c1991014b.js rename to _next/static/chunks/pages/index-d60813bb99f77864.js index e15ed87..8bb2fd1 100644 --- a/_next/static/chunks/pages/index-3743234c1991014b.js +++ b/_next/static/chunks/pages/index-d60813bb99f77864.js @@ -1 +1 @@ -(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5557:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(4497)}])},1001:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{g:function(){return Field}});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893),react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(7294),_hooks_useTheme__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(2343);function eval_math_expr(exp){let reg=/(?:[a-z$_][a-z0-9$_]*)|(?:[;={}\[\]"'!&<>^\\?:])/ig,valid=!0,res=null;if(exp=exp.replace(reg,function(e){if(Math.hasOwnProperty(e))return"Math."+e;valid=!1}),!valid)return null;try{res=eval(exp)}catch(e){return null}return res}function Field(e){let{className:t,type:n,style:s,onInput:r,...i}=e,a=(0,_hooks_useTheme__WEBPACK_IMPORTED_MODULE_2__.F)(__webpack_require__(3951)),l=(0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(),[o,c]=(0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(!1);return(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{null!=i.defaultValue&&void 0!=i.defaultValue&&(l.current.value=i.defaultValue)},[i.defaultValue]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div",{className:t,style:s,children:[i.name?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div",{className:a.title,children:i.name}):"",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input",{ref:l,...i,type:"number"==n?"text":n,className:a.field+(n?" "+a["type-"+n]:"")+(o?" "+a.wrong:""),onInput:function(){for(var e=arguments.length,t=Array(e),s=0;sNumber(i.max)||i.step&&e%Number(i.step)!=0)return c(!0);d=e}o&&c(!1),r(d,l)}})]})}},2343:function(e,t,n){"use strict";n.d(t,{F:function(){return r}});var s=n(6573);function r(e){return i(e,(0,s.vs)().darkModeActive?"dark":"light")}function i(e,t){let n=e[t];if(!n)return e;let s={dark:n};return Object.entries(e).forEach(e=>{let[r,i]=e;r!=t&&(s[r]=i+" "+n)}),s}},8094:function(e,t,n){"use strict";n.r(t),n.d(t,{addTimes:function(){return i},withScale:function(){return r}});let s=n(8333),r=e=>t=>"".concat(Math.round(s.Time(t).toTicks()*e),"i"),i=(e,t)=>"".concat(s.Time(e).toTicks()+s.Time(t).toTicks(),"i")},6367:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let s=n(8333),{withScale:r,addTimes:i}=n(8094);function a(e,t){let n=t.reduce((e,t)=>e+t.length*(t.repeat+1),0);s.Transport.loop=!0,s.Transport.loopStart=0,s.Transport.loopEnd=r(n)("1m"),s.Transport.timeSignature=[4,4];let a=0;t.forEach((t,n)=>{let l=r(t.length)("".concat(1+t.repeat,"m"));t.ratios.forEach((n,l)=>{if(n<=0)return;let o=t.subdivide[l]||1,c=r(t.length/(n*o))("1n"),d=r(t.offsets[l]||0)(c);for(let u=0,m=i(a,d);ue(t,i),m)}}),s.Transport.schedule(e=>{setTimeout(()=>{s.Transport.swing=t.swing},(e-s.Transport.now())*1e3)},a),a=i(a,l)})}},4497:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ec}});var s=n(5893),r=n(9008),i=n.n(r),a=n(7294),l=n(3035),o=n(2343),c=n(4671);function d(){return window?(window.__my_context||(window.__my_context={_tone:n(8333)}),window.__my_context):null}let u=n(8333),m=[].concat([["bell.wav","bell"],["bongo.wav","bongo"],["bonk.wav","bongo"],["clave1.wav","clave"],["clave2.wav","clave"],["clave3.wav","clave"],["cow1.wav","cowbell"],["cow2.wav","cowbell"],["cow3.wav","cowbell"],["kick.wav","kickdrum"]].map(e=>{let[t,n]=e;return{name:t.split(".")[0],make:()=>new u.Player("/sounds/".concat(t)),trigger:e=>(t,n,s)=>{e.restart(n,0,t)},icon:n}})),_=m.map(e=>e.name),f=m.map(e=>e.icon),p=()=>_,h=()=>f;function b(e){return[m[e].make(),e]}function x(e){let[t,n]=e;return m[n].trigger(t)}function v(e,t){let n=d();return n.old_synths||(n.old_synths=[]),n.synths=e.slice(0,t).map((e,t)=>{if(n.old_synths[t]&&n.old_synths[t][0]&&n.old_synths[t][1]==e){let s=[n.old_synths[t][0],e];return n.old_synths[t][0]=null,s}{let[t,n]=b(e);return[t.toMaster(),n]}}),n.old_synths&&(n.old_synths.forEach(e=>{let[t,n]=e;t&&(t.disconnect(),t.dispose())}),n.old_synths=[]),n.triggers=n.synths.map(e=>x(e)),function(){n.triggers=[],n.old_synths=n.synths,n.synths=[]}}let g=()=>d().triggers,j=e=>e%p().length,y=()=>({length:1,repeat:0,swing:0,ratios:[1,4],subdivide:[1],offsets:[0]});var k=(0,c.Z)(e=>({sections:[y()],curSection:0,editMode:"section",instrumentIDs:Array.from({length:10},(e,t)=>j(t)),addSection:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y();return e(e=>({sections:[...e.sections,t]}))},swapSections:(t,n)=>e(e=>{let s=e.sections[t];return e.sections[t]=e.sections[n],e.sections[n]=s,{sections:[...e.sections]}}),setSections:t=>e({sections:t}),setInstrumentIDs:t=>e({instrumentIDs:t}),setCurSection:t=>e({curSection:t}),setEditMode:t=>e({editMode:t}),paused:!0,bpm:100,pause:()=>e({paused:!0}),play:()=>e({paused:!1}),setBpm:t=>e({bpm:t})})),w=n(374);let N="_",C="a";function E(e,t){return"?"+Object.entries({lengths:e.map(e=>e.length).join(N),repeats:e.map(e=>e.repeat).join(N),swings:e.map(e=>e.swing).join(N),ratios:e.map(e=>e.ratios.join(C)).join(N),subdivides:e.map(e=>e.subdivide.join(C)).join(N),offsets:e.map(e=>e.offsets.join(C)).join(N),bpm:t}).map(e=>{let[t,n]=e;return"&".concat(t,"=").concat(n)}).join("").slice(1)}function T(e){let t=e.lengths.split(N).map(Number),n=e.repeats.split(N).map(Number),s=e.swings.split(N).map(Number),r=e.ratios.split(N).map(e=>e.split(C).map(Number)),i=e.subdivides.split(N).map(e=>e.split(C).map(Number)),a=e.offsets.split(N).map(e=>e.split(C).map(Number));return t.map((e,t)=>({length:e,repeat:n[t],swing:s[t],ratios:r[t],subdivide:i[t],offsets:a[t]}))}function A(e){let t=document.createElement("canvas"),n=32,s=.7;t.width=t.height=n;let r=t.getContext("2d");return r.font="".concat(n/2|0,"px Helvetica, Arial, sans-serif"),r.fillStyle="yellow",r.fillRect(0,0,n,n),r.fillStyle="black",r.textAlign="center",r.textBaseline="middle",e.forEach((t,i)=>{r.fillText(t.ratios.join(":"),n/2,s*n/e.length*(.7+i)+(1-s)*n/2|0)}),t.toDataURL()}var D=n(7771),S=n(1376);let M=n(8333);function I(){let[e,t,r,i,l,c,d]=k((0,a.useCallback)(e=>[e.sections,e.swapSections,e.addSection,e.curSection,e.setCurSection,e.bpm,e.editMode],[]),w.Z),u=(0,o.F)(n(2331)),m=(0,a.useMemo)(()=>e.reduce((e,t)=>Math.max(e,t.ratios.length),0),[e]),_=(0,a.useMemo)(()=>e.reduce((e,t)=>e+t.length*(1+t.repeat),0),[e]),f=(0,a.useRef)(),p=(0,a.useRef)();(0,a.useEffect)(()=>{let e=M.Time("1m").toTicks()*_,t=!1,n=0,s=.06,r=null,i=null,a=()=>{i=(r=p.current.offsetWidth)*s};a(),window.addEventListener("resize",a);let l=()=>{if(!f.current||!p.current)return;let a=Math.min(r,r*M.Time(M.Transport.position).toTicks()/e);(a=Math.round(a/i)*i)!=n&&(f.current.style.transform="translateX(".concat(a,"px)"),f.current.style.transition=0!=a?"transform ".concat(60*s*_*4/c,"s linear"):null,n=a),t||requestAnimationFrame(l)};return l(),function(){t=!0,window.removeEventListener("resize",a)}},[p.current,_]);let h=(0,a.useRef)(null),b=(0,a.useRef)(null),x=(0,a.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),v=(0,a.useCallback)(e=>{e.preventDefault();let t=e.target.closest("."+u.section);t.dragover_count||(t.dragover_count=0),t.dragover_count++,t.classList.add(u.dragover)},[]),g=(0,a.useCallback)(e=>{e.preventDefault();let t=e.target.closest("."+u.section);t.dragover_count--,0==t.dragover_count&&t.classList.remove(u.dragover)},[]),j=(0,a.useCallback)(e=>t=>{l(e),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("number",e);let n=document.createElement("div");n.style.visibility="hidden",t.dataTransfer.setDragImage(n,0,0);let s=t.target.getBoundingClientRect();b.current=(s.left+s.right)/2,t.target.style.transition="transform .2s",t.target.style.transform="translate(".concat(t.clientX-b.current,"px, ").concat(0|-(.5*t.target.offsetHeight),"px)\n scale(.5)"),setTimeout(()=>{t.target.style.transition=null,h.current=t.target},150)},[]),y=(0,a.useCallback)(e=>{h.current=null,e.target.style.transition=null,e.target.style.transform=null,e.target.style.zIndex=null},[]),N=(0,a.useCallback)(e=>{if(!h.current)return;let t=h.current.style;t.transform="translate(".concat(e.clientX-b.current,"px, ").concat(0|-(.5*h.current.offsetHeight),"px)\n scale(.5)"),t.zIndex=11},[h,b]),C=(0,a.useCallback)(e=>n=>{h.current.style.transition=null,h.current.style.transform=null,h.current.style.zIndex=null,h.current=null;let s=n.target.closest("."+u.section);s.dragover_count=0,s.classList.remove(u.dragover),l(e),t(e,Number(n.dataTransfer.getData("number")))},[]),E=1;return(0,s.jsxs)("div",{style:{position:"relative"},children:[(0,s.jsx)("div",{className:u.add_btn,onClick:()=>r(),children:(0,s.jsx)(D.Lfi,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{ref:p,className:u.bar_parent,children:(0,s.jsx)("div",{ref:f,className:u.bar})}),(0,s.jsx)("div",{className:u.container,children:e.map((t,n)=>(0,s.jsx)("div",{className:u.section+(n==i&&e.length>1&&"section"==d?" "+u.current:""),style:{flexBasis:"".concat(100*t.length*(t.repeat+1)/_,"%"),cursor:i==n?"grab":"pointer"},onClick:()=>l(n),onDragStart:j(n),onDragEnd:y,onDragOver:x,onDrag:N,onDragEnter:v,onDragLeave:g,onDrop:C(n),draggable:!0,children:Array.from({length:t.repeat+1},(e,n)=>(0,s.jsxs)("div",{className:u.section_part+(n>0?" "+u.repeated:"")+(E++%2==0?" "+u.even:""),children:[Array.from({length:m},(e,n)=>{let r=t.ratios[n]||0,i=t.subdivide[n]||1,a=t.offsets[n]||0;return(0,s.jsx)("div",{className:u.row,children:Array.from({length:r*i},(e,t)=>(0,s.jsx)("div",{className:u.dot+(t%i==0?"":" "+u.sub_dot),children:(0,s.jsx)("div",{style:{left:a?"".concat(100*a,"%"):null}})},"dot"+t))},"row"+n)}),(0,s.jsx)("div",{className:u.repeat_line,children:(0,s.jsx)(S.oic,{})}),1!=t.length&&0==n?(0,s.jsxs)("div",{className:u.scale_corner,children:[(0,s.jsx)("span",{children:String(t.length).substr(0,4)}),(0,s.jsx)(D.gV0,{style:{verticalAlign:"middle"}})]}):""]},n))},"section"+n))})]})}var F=n(1001);function L(e){let{className:t,name:r,onInput:i,defaultValue:l,min:c,max:d,step:u,delimiter:m,..._}=e,f=(0,o.F)(n(7406)),p=(0,a.useMemo)(()=>(l||"").split(m||":").map(Number),[l,m]),[h,b]=(0,a.useState)(p);return(0,a.useEffect)(()=>{i&&i(h)},[h]),(0,a.useEffect)(()=>{b(p)},[p]),(0,s.jsxs)("div",{className:f.container+(t?" "+t:""),children:[(0,s.jsx)("div",{className:f.ratios,children:h.map((e,t)=>(0,s.jsxs)("div",{children:[(0,s.jsx)(F.g,{className:f.field,defaultValue:e,type:"number",step:u,min:c,max:d,onInput:(e,n)=>{e.length<=0||("0"==n&&t==h.length-1?h.splice(t,1):h[t]=Number(e),b([...h]))}}),tb([...h,c||0]),children:(0,s.jsx)(D.Lfi,{style:{verticalAlign:"middle"}})})]})}var V=n(7079),B=n.n(V);function z(){let[e,t,r,i]=k((0,a.useCallback)(e=>[e.sections,e.setSections,e.curSection,e.setCurSection],[]),w.Z),l=(0,o.F)(n(4847)),c=(0,a.useMemo)(()=>e[r],[e,r]),d=n=>s=>{null!=s&&void 0!=s&&(n(s),t(B()(e)))};return(0,s.jsx)("div",{className:l.container,children:(0,s.jsxs)("div",{className:l.flex_container,children:[(0,s.jsx)("table",{className:l.table,children:(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"ratios"}),(0,s.jsx)("td",{children:(0,s.jsx)(L,{className:l.picker,name:"ratios",defaultValue:c.ratios.join(":"),min:0,step:1,onInput:d(e=>c.ratios=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"subdivides"}),(0,s.jsx)("td",{children:(0,s.jsx)(L,{name:"subdivide",defaultValue:c.subdivide.join(":"),step:1,min:1,onInput:d(e=>c.subdivide=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"offsets"}),(0,s.jsx)("td",{children:(0,s.jsx)(L,{name:"offsets",defaultValue:c.offsets.join(":"),max:1,min:0,onInput:d(e=>c.offsets=e)})})]})]})}),(0,s.jsx)("table",{className:l.single_fields+" "+l.table,children:(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"scale"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"number",min:"0",defaultValue:c.length,onInput:d(e=>c.length=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"repeat"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"number",step:"1",min:"0",defaultValue:c.repeat,onInput:d(e=>c.repeat=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"swing"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"number",min:"0",max:"1",defaultValue:c.swing,onInput:d(e=>c.swing=e)})})]}),(0,s.jsxs)("tr",{className:l.remove_btn,children:[(0,s.jsx)("th",{children:"remove"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"button",value:"remove",...e.length<=1?{disabled:!0}:{},onClick:d(()=>{if(e.length>1)return i(Math.max(0,r-1)),e.splice(e.indexOf(c),1)})})})]})]})})]})})}var O=n(7696);function H(e){let{style:t}=e,[r,i,l,c,d,u,m]=k((0,a.useCallback)(e=>[e.paused,e.pause,e.play,e.bpm,e.setBpm,e.editMode,e.setEditMode],[]),w.Z),_=(0,o.F)(n(434));return(0,s.jsx)("div",{className:_.container,style:t,children:(0,s.jsxs)("div",{className:_.transport_bar,children:[(0,s.jsx)("div",{className:_.transport_button,onClick:(0,a.useCallback)(()=>(r?l:i)(),[r]),children:r?(0,s.jsx)(O.hpr,{style:{verticalAlign:"middle"}}):(0,s.jsx)(O.bKE,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:_.transport_button,onClick:(0,a.useCallback)(()=>{n(8333).Transport.stop(),i()},[]),children:(0,s.jsx)(O.vJm,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{style:{paddingLeft:"2em",paddingRight:".5em"},children:"bpm"}),(0,s.jsx)("div",{children:(0,s.jsx)(F.g,{style:{width:"4em"},type:"number",defaultValue:c,onInput:e=>d(e)})}),(0,s.jsx)("div",{className:_.settings_button+("instrument"==u?" "+_.edit_mode:""),onClick:(0,a.useCallback)(()=>m("section"==u?"instrument":"section"),[u]),children:(0,s.jsx)(O.XkT,{style:{verticalAlign:"middle"}})})]})})}var Z=n(1121),G=n(9715);function R(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Fallback: Oops, unable to copy",e)}document.body.removeChild(t)}function P(e){if(!navigator.clipboard){R(e);return}navigator.clipboard.writeText(e)}var U=n(6573),W=n(6808),X=n.n(W),q=n(3729),Y=n.n(q),J=n(4021),Q=n.n(J);function K(e){let t=Array.from({length:e.reduce((e,t)=>Math.max(t.ratios.length,e),0)},()=>0),n=512,s=new(Q()).Track;for(let r of e){let e=n*r.length;for(let n=0;nt?i():r(),[c,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)({cb:()=>null}),[_,f]=(0,a.useState)(!1),p=!1,h=null,b=(0,a.useCallback)(e=>"yes"==X().get("is_supporter_already")?e():p&&Math.random()>h?(h+=.15,e()):void(d(!0),m({cb:function(){for(var t=arguments.length,n=Array(t),s=0;s{f(!0),X().set("is_supporter_already","yes",{expires:111})},[]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:e.sellout,style:{display:c?null:"none"},children:(0,s.jsxs)("div",{className:e.sellout_box,children:[_?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("h1",{children:["Thank you! ","<3"]}),(0,s.jsx)("p",{children:"What a C H A D."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h1",{children:"Ooops! Looks like this is a premium feature!"}),(0,s.jsx)("p",{children:"Just kidding it's not. (But it could be)"}),(0,s.jsxs)("p",{children:["Oh and by the way, did you know you can support me on",(0,s.jsx)("a",{href:"https://www.buymeacoffee.com/angramme",target:"_blank",children:" buymeacoffee.com/angramme"}),"?"]})]}),(0,s.jsxs)("div",{className:e.coffee_btns,children:[_?"":(0,s.jsxs)("a",{href:"https://www.buymeacoffee.com/angramme",target:"_blank",className:e.coffee_button,onClick:x,children:[(0,s.jsx)("img",{src:"https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg",alt:"Buy me a coffee",className:e.coffee_img}),(0,s.jsx)("span",{className:e.coffee_text,children:"Buy me a coffee"})]}),(0,s.jsx)("div",{className:e.imbroke,onClick:(0,a.useCallback)(u.cb,[u]),children:_?"Continue":"Nah fam, I'm broke"})]})]})}),(0,s.jsx)("div",{className:e.displacer}),(0,s.jsxs)("div",{className:e.left,children:[(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("a",{href:"https://ozi.vercel.app",target:"_blank",rel:"noopener",children:(0,s.jsx)(G.l8A,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:e.tooltip,children:"my website"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("a",{href:"https://www.buymeacoffee.com/angramme",target:"_blank",rel:"noopener",children:(0,s.jsx)(Z.vm6,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:e.tooltip,children:"buy me a coffee"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("a",{href:"https://github.com/Angramme/polyrhythm3#tutorial",target:"_blank",rel:"noopener",children:(0,s.jsx)(Z.CUu,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:e.tooltip,children:"Open help page."})]})]}),(0,s.jsxs)("div",{className:e.right,children:[(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)(Z.Ifu,{style:{verticalAlign:"middle"},onClick:(0,a.useCallback)(()=>{b(()=>{let e=k.getState();P(window.location.origin+window.location.pathname+E(e.sections,e.bpm)),setTimeout(()=>alert("copied the url to clipboard! "),100)})},[])}),(0,s.jsx)("div",{className:e.tooltip,children:"share your rhythm"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)(G.ojp,{style:{verticalAlign:"middle"},onClick:(0,a.useCallback)(()=>{b(()=>{Y()(K(k.getState().sections),"Polyrhythm.mid")})},[])}),(0,s.jsx)("div",{className:e.tooltip,children:"export midi"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("span",{onClick:l,children:t?(0,s.jsx)(Z.dZ3,{style:{verticalAlign:"middle"}}):(0,s.jsx)(Z.JuG,{style:{verticalAlign:"middle"}})}),(0,s.jsxs)("div",{className:e.tooltip,children:["switch to ",t?"light":"dark"," mode"]})]})]})]})}var ee=n(2091),et=n(6204),en=n(8908),es=n(1054);function er(e){let{style:t}=e,[r,i,l]=k((0,a.useCallback)(e=>[e.instrumentIDs,e.setInstrumentIDs,e.sections],[]),w.Z),c=(0,o.F)(n(1308)),d=p(),u=h(),m=(0,a.useMemo)(()=>l.reduce((e,t)=>Math.max(e,t.ratios.length),-1),[l]),_=e=>t=>{r[e]=t,i(B()(r))},f={kickdrum:(0,s.jsx)(ee.nmk,{}),bongo:(0,s.jsx)(et.Z7b,{}),bell:(0,s.jsx)(ee.Z3q,{}),cowbell:(0,s.jsx)(en.Qor,{}),clave:(0,s.jsx)(es.fHv,{})};return(0,s.jsx)("div",{className:c.container,style:t,children:(0,s.jsx)("table",{children:r.slice(0,m).map((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:["track ",t+1," uses ",(0,s.jsx)("b",{children:d[e]})]}),(0,s.jsx)("td",{children:u.map((n,r)=>(0,s.jsx)("div",{className:c.button,onClick:()=>_(t)(r),value:r,style:{display:"inline",position:"relative",margin:"0.5rem",border:"solid 2px black",borderColor:e==r?"red":"rgba(0,0,0,0)",padding:"2px",borderRadius:"2px",cursor:"pointer"},children:f[n]},r))})]},t))})})}function ei(){let e=(0,o.F)(n(3655)),t=k((0,a.useCallback)(e=>e.editMode,[]));return(0,s.jsxs)("div",{className:e.container,children:[(0,s.jsx)($,{}),(0,s.jsx)(I,{}),(0,s.jsx)(H,{}),"section"==t?(0,s.jsx)(z,{}):"","instrument"==t?(0,s.jsx)(er,{}):""]})}n(3658);var ea=n(143);function el(){return(0,s.jsx)("div",{style:{position:"fixed",left:"-100%",bottom:"10px"},children:(0,s.jsx)("a",{href:"https://hits.seeyoufarm.com",children:(0,s.jsx)("img",{src:"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fangramme.github.io%2Fpolyrhythm3%2Findex.html&count_bg=%23303250&title_bg=%232D2D2D&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"})})})}let eo=n(8333);function ec(){let e=(0,o.F)(n(6077)),[t,r,c,d,u,m,_,f]=k((0,a.useCallback)(e=>[e.paused,e.bpm,e.setBpm,e.sections,e.setSections,e.instrumentIDs,e.pause,e.play],[]),w.Z);(0,a.useEffect)(()=>{t?eo.Transport.pause():eo.Transport.start()},[t]),(0,a.useEffect)(()=>{let e=e=>{" "===e.key?t?f():_():"ArrowUp"===e.key?c(r+10):"ArrowDown"===e.key&&c(r-10)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,r]),(0,a.useEffect)(()=>{eo.Transport.bpm.rampTo(r,.2)},[r]),(0,a.useEffect)(()=>{let e=()=>{eo.start(),eo.context.resume()};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}},[]);let p=(0,a.useMemo)(()=>d.reduce((e,t)=>Math.max(e,t.ratios.length),-1),[d]);(0,a.useEffect)(()=>v(m,p),[m,p]),(0,a.useEffect)(()=>((0,n(6367).Z)((e,t)=>{let{accent:n,duration:s,track:r}=t,i=g()[r];try{i(s,e,n)}catch(e){}},d),function(){eo.Transport.cancel(0)}),[d]);let[h,b]=(0,a.useState)("/favicon.png");(0,a.useEffect)(()=>k.subscribe(e=>b(e),e=>A(e.sections)),[]);let x=(0,l.useRouter)();return(0,a.useEffect)(()=>{Object.keys(x.query).length<=0||(console.log("found state in url, proceeding to load..."),u(T(x.query)),c(Number(x.query.bpm)),window.history.replaceState({},document.title,window.location.pathname))},[x.query]),(0,s.jsxs)("div",{className:e.container,children:[(0,s.jsxs)(i(),{children:[(0,s.jsx)("title",{children:"Polyrhythm Metronome"}),(0,s.jsx)("meta",{name:"description",content:"A simple open source Polyrhythmic Generator / Metronome. Ever wanted to study a 13:7 or 3:4:5 or 42:69 polyrhythm? Then this is the app for you!"}),(0,s.jsx)("link",{rel:"icon",href:h})]}),(0,s.jsx)(el,{}),(0,s.jsx)(ei,{}),(0,s.jsxs)(ea.ZP,{location:"bottom",buttonText:"Hmmm, bingus",cookieName:"myAwesomeCookieName2",style:{background:"#111111"},buttonStyle:{color:"#111111",fontSize:"14px"},expires:150,children:["Give me them cookies! I don't VALUE (\uD83D\uDCB0\uD83D\uDCB0\uD83D\uDCB0) your privacy. "," ",(0,s.jsx)("span",{style:{fontSize:"12px"},children:"Just kidding, btw you can support me on buymeacoffee.com/angramme"})]})]})}},6077:function(e){e.exports={container:"Home_container__Ws68t",dark:"Home_dark__U5IOg"}},434:function(e){e.exports={container:"controls_container__uQ6Ur",dark:"controls_dark__g22IO",title:"controls_title__LWuoS",table:"controls_table__P0oE9",button:"controls_button__hD52Z",transport_bar:"controls_transport_bar___YS_d",transport_button:"controls_transport_button__hzGjO",settings_button:"controls_settings_button___G7WG",edit_mode:"controls_edit_mode__ww6fK"}},4847:function(e){e.exports={container:"editor_container__xFY5A",dark:"editor_dark__nnss1",flex_container:"editor_flex_container__j97Qd",single_fields:"editor_single_fields__tA6LQ",table:"editor_table__H0zRX"}},3951:function(e){e.exports={field:"field_field__ahVh9",dark:"field_dark__BwSlo",wrong:"field_wrong__Wsc3z","type-button":"field_type-button___LpZp",title:"field_title__1hLXt"}},1308:function(e){e.exports={container:"instruments_container__foBA0",dark:"instruments_dark__3Tvcs",instrument:"instruments_instrument__PTjVo",header:"instruments_header__GwJMA"}},3655:function(e){e.exports={container:"main_container__nEWDz"}},7406:function(e){e.exports={container:"ratiopicker_container__rAS_I",ratios:"ratiopicker_ratios__cCYWH",field:"ratiopicker_field__BCgk1",add_btn:"ratiopicker_add_btn__nbGbV",dark:"ratiopicker_dark__UgVfg",delimiter:"ratiopicker_delimiter____6SI"}},9762:function(e){e.exports={displacer:"topbar_displacer__0dYiD",left:"topbar_left__K66EY",right:"topbar_right__sLY4D",dark:"topbar_dark__U4QCe",button:"topbar_button__E5VrH",tooltip:"topbar_tooltip__o_1q_",sellout:"topbar_sellout__rM0_c",sellout_box:"topbar_sellout_box__FioJL",coffee_btns:"topbar_coffee_btns__SSj1C",imbroke:"topbar_imbroke__CCJzc",coffee_img:"topbar_coffee_img__xoHFn",coffee_text:"topbar_coffee_text__0IStg",coffee_button:"topbar_coffee_button__Tmibd"}},2331:function(e){e.exports={container:"visualisation_container__yiY3D",dark:"visualisation_dark__PHySl",section:"visualisation_section__8iHll",dragover:"visualisation_dragover__99lVA",current:"visualisation_current__lGUjr",section_part:"visualisation_section_part__jOXjo",even:"visualisation_even__sY_E1",repeat_line:"visualisation_repeat_line__GvgB8",scale_corner:"visualisation_scale_corner__nqz4t",repeated:"visualisation_repeated__tsnUH",row:"visualisation_row__I_EAz",dot:"visualisation_dot__QAegW",sub_dot:"visualisation_sub_dot__Bv95k",add_btn:"visualisation_add_btn__E4_DW",bar_parent:"visualisation_bar_parent__O7F9w",bar:"visualisation_bar__hClii"}}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[961,151,317,510,127,396,365,817,594,757,805,888,774,179],function(){return t(5557)}),_N_E=e.O()}]); \ No newline at end of file +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[405],{5557:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/",function(){return n(4497)}])},1001:function(__unused_webpack_module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.d(__webpack_exports__,{g:function(){return Field}});var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(5893),react__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(7294),_hooks_useTheme__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(2343);function eval_math_expr(exp){let reg=/(?:[a-z$_][a-z0-9$_]*)|(?:[;={}\[\]"'!&<>^\\?:])/ig,valid=!0,res=null;if(exp=exp.replace(reg,function(e){if(Math.hasOwnProperty(e))return"Math."+e;valid=!1}),!valid)return null;try{res=eval(exp)}catch(e){return null}return res}function Field(e){let{className:t,type:n,style:s,onInput:r,...i}=e,a=(0,_hooks_useTheme__WEBPACK_IMPORTED_MODULE_2__.F)(__webpack_require__(3951)),l=(0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(),[o,c]=(0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(!1);return(0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{null!=i.defaultValue&&void 0!=i.defaultValue&&(l.current.value=i.defaultValue)},[i.defaultValue]),(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div",{className:t,style:s,children:[i.name?(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("div",{className:a.title,children:i.name}):"",(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("input",{ref:l,...i,type:"number"==n?"text":n,className:a.field+(n?" "+a["type-"+n]:"")+(o?" "+a.wrong:""),onInput:function(){for(var e=arguments.length,t=Array(e),s=0;sNumber(i.max)||i.step&&e%Number(i.step)!=0)return c(!0);d=e}o&&c(!1),r(d,l)}})]})}},2343:function(e,t,n){"use strict";n.d(t,{F:function(){return r}});var s=n(6573);function r(e){return i(e,(0,s.vs)().darkModeActive?"dark":"light")}function i(e,t){let n=e[t];if(!n)return e;let s={dark:n};return Object.entries(e).forEach(e=>{let[r,i]=e;r!=t&&(s[r]=i+" "+n)}),s}},8094:function(e,t,n){"use strict";n.r(t),n.d(t,{addTimes:function(){return i},withScale:function(){return r}});let s=n(8333),r=e=>t=>"".concat(Math.round(s.Time(t).toTicks()*e),"i"),i=(e,t)=>"".concat(s.Time(e).toTicks()+s.Time(t).toTicks(),"i")},6367:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});let s=n(8333),{withScale:r,addTimes:i}=n(8094);function a(e,t){let n=t.reduce((e,t)=>e+t.length*(t.repeat+1),0);s.Transport.loop=!0,s.Transport.loopStart=0,s.Transport.loopEnd=r(n)("1m"),s.Transport.timeSignature=[4,4];let a=0;t.forEach((t,n)=>{let l=r(t.length)("".concat(1+t.repeat,"m"));t.ratios.forEach((n,l)=>{if(n<=0)return;let o=t.subdivide[l]||1,c=r(t.length/(n*o))("1n"),d=r(t.offsets[l]||0)(c);for(let u=0,m=i(a,d);ue(t,i),m)}}),s.Transport.schedule(e=>{setTimeout(()=>{s.Transport.swing=t.swing},(e-s.Transport.now())*1e3)},a),a=i(a,l)})}},4497:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ec}});var s=n(5893),r=n(9008),i=n.n(r),a=n(7294),l=n(3035),o=n(2343),c=n(4671);function d(){return window?(window.__my_context||(window.__my_context={_tone:n(8333)}),window.__my_context):null}let u=n(8333),m=[].concat([["bell.wav","bell"],["bongo.wav","bongo"],["bonk.wav","bongo"],["clave1.wav","clave"],["clave2.wav","clave"],["clave3.wav","clave"],["cow1.wav","cowbell"],["cow2.wav","cowbell"],["cow3.wav","cowbell"],["kick.wav","kickdrum"]].map(e=>{let[t,n]=e;return{name:t.split(".")[0],make:()=>new u.Player("/sounds/".concat(t)),trigger:e=>(t,n,s)=>{e.restart(n,0,t)},icon:n}})),_=m.map(e=>e.name),f=m.map(e=>e.icon),p=()=>_,h=()=>f;function b(e){return[m[e].make(),e]}function x(e){let[t,n]=e;return m[n].trigger(t)}function v(e,t){let n=d();return n.old_synths||(n.old_synths=[]),n.synths=e.slice(0,t).map((e,t)=>{if(n.old_synths[t]&&n.old_synths[t][0]&&n.old_synths[t][1]==e){let s=[n.old_synths[t][0],e];return n.old_synths[t][0]=null,s}{let[t,n]=b(e);return[t.toMaster(),n]}}),n.old_synths&&(n.old_synths.forEach(e=>{let[t,n]=e;t&&(t.disconnect(),t.dispose())}),n.old_synths=[]),n.triggers=n.synths.map(e=>x(e)),function(){n.triggers=[],n.old_synths=n.synths,n.synths=[]}}let g=()=>d().triggers,j=e=>e%p().length,y=()=>({length:1,repeat:0,swing:0,ratios:[1,4],subdivide:[1],offsets:[0]});var k=(0,c.Z)(e=>({sections:[y()],curSection:0,editMode:"section",instrumentIDs:Array.from({length:10},(e,t)=>j(t)),addSection:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:y();return e(e=>({sections:[...e.sections,t]}))},swapSections:(t,n)=>e(e=>{let s=e.sections[t];return e.sections[t]=e.sections[n],e.sections[n]=s,{sections:[...e.sections]}}),setSections:t=>e({sections:t}),setInstrumentIDs:t=>e({instrumentIDs:t}),setCurSection:t=>e({curSection:t}),setEditMode:t=>e({editMode:t}),paused:!0,bpm:100,pause:()=>e({paused:!0}),play:()=>e({paused:!1}),setBpm:t=>e({bpm:t})})),w=n(374);let N="_",C="a";function E(e,t){return"?"+Object.entries({lengths:e.map(e=>e.length).join(N),repeats:e.map(e=>e.repeat).join(N),swings:e.map(e=>e.swing).join(N),ratios:e.map(e=>e.ratios.join(C)).join(N),subdivides:e.map(e=>e.subdivide.join(C)).join(N),offsets:e.map(e=>e.offsets.join(C)).join(N),bpm:t}).map(e=>{let[t,n]=e;return"&".concat(t,"=").concat(n)}).join("").slice(1)}function T(e){let t=e.lengths.split(N).map(Number),n=e.repeats.split(N).map(Number),s=e.swings.split(N).map(Number),r=e.ratios.split(N).map(e=>e.split(C).map(Number)),i=e.subdivides.split(N).map(e=>e.split(C).map(Number)),a=e.offsets.split(N).map(e=>e.split(C).map(Number));return t.map((e,t)=>({length:e,repeat:n[t],swing:s[t],ratios:r[t],subdivide:i[t],offsets:a[t]}))}function A(e){let t=document.createElement("canvas"),n=32,s=.7;t.width=t.height=n;let r=t.getContext("2d");return r.font="".concat(n/2|0,"px Helvetica, Arial, sans-serif"),r.fillStyle="yellow",r.fillRect(0,0,n,n),r.fillStyle="black",r.textAlign="center",r.textBaseline="middle",e.forEach((t,i)=>{r.fillText(t.ratios.join(":"),n/2,s*n/e.length*(.7+i)+(1-s)*n/2|0)}),t.toDataURL()}var S=n(7771),D=n(1376);let M=n(8333);function I(){let[e,t,r,i,l,c,d]=k((0,a.useCallback)(e=>[e.sections,e.swapSections,e.addSection,e.curSection,e.setCurSection,e.bpm,e.editMode],[]),w.Z),u=(0,o.F)(n(2331)),m=(0,a.useMemo)(()=>e.reduce((e,t)=>Math.max(e,t.ratios.length),0),[e]),_=(0,a.useMemo)(()=>e.reduce((e,t)=>e+t.length*(1+t.repeat),0),[e]),f=(0,a.useRef)(),p=(0,a.useRef)();(0,a.useEffect)(()=>{let e=M.Time("1m").toTicks()*_,t=!1,n=0,s=.06,r=null,i=null,a=()=>{i=(r=p.current.offsetWidth)*s};a(),window.addEventListener("resize",a);let l=()=>{if(!f.current||!p.current)return;let a=Math.min(r,r*M.Time(M.Transport.position).toTicks()/e);(a=Math.round(a/i)*i)!=n&&(f.current.style.transform="translateX(".concat(a,"px)"),f.current.style.transition=0!=a?"transform ".concat(60*s*_*4/c,"s linear"):null,n=a),t||requestAnimationFrame(l)};return l(),function(){t=!0,window.removeEventListener("resize",a)}},[p.current,_]);let h=(0,a.useRef)(null),b=(0,a.useRef)(null),x=(0,a.useCallback)(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),v=(0,a.useCallback)(e=>{e.preventDefault();let t=e.target.closest("."+u.section);t.dragover_count||(t.dragover_count=0),t.dragover_count++,t.classList.add(u.dragover)},[]),g=(0,a.useCallback)(e=>{e.preventDefault();let t=e.target.closest("."+u.section);t.dragover_count--,0==t.dragover_count&&t.classList.remove(u.dragover)},[]),j=(0,a.useCallback)(e=>t=>{l(e),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("number",e);let n=document.createElement("div");n.style.visibility="hidden",t.dataTransfer.setDragImage(n,0,0);let s=t.target.getBoundingClientRect();b.current=(s.left+s.right)/2,t.target.style.transition="transform .2s",t.target.style.transform="translate(".concat(t.clientX-b.current,"px, ").concat(0|-(.5*t.target.offsetHeight),"px)\n scale(.5)"),setTimeout(()=>{t.target.style.transition=null,h.current=t.target},150)},[]),y=(0,a.useCallback)(e=>{h.current=null,e.target.style.transition=null,e.target.style.transform=null,e.target.style.zIndex=null},[]),N=(0,a.useCallback)(e=>{if(!h.current)return;let t=h.current.style;t.transform="translate(".concat(e.clientX-b.current,"px, ").concat(0|-(.5*h.current.offsetHeight),"px)\n scale(.5)"),t.zIndex=11},[h,b]),C=(0,a.useCallback)(e=>n=>{h.current.style.transition=null,h.current.style.transform=null,h.current.style.zIndex=null,h.current=null;let s=n.target.closest("."+u.section);s.dragover_count=0,s.classList.remove(u.dragover),l(e),t(e,Number(n.dataTransfer.getData("number")))},[]),E=1;return(0,s.jsxs)("div",{style:{position:"relative"},children:[(0,s.jsx)("div",{className:u.add_btn,onClick:()=>r(),children:(0,s.jsx)(S.Lfi,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{ref:p,className:u.bar_parent,children:(0,s.jsx)("div",{ref:f,className:u.bar})}),(0,s.jsx)("div",{className:u.container,children:e.map((t,n)=>(0,s.jsx)("div",{className:u.section+(n==i&&e.length>1&&"section"==d?" "+u.current:""),style:{flexBasis:"".concat(100*t.length*(t.repeat+1)/_,"%"),cursor:i==n?"grab":"pointer"},onClick:()=>l(n),onDragStart:j(n),onDragEnd:y,onDragOver:x,onDrag:N,onDragEnter:v,onDragLeave:g,onDrop:C(n),draggable:!0,children:Array.from({length:t.repeat+1},(e,n)=>(0,s.jsxs)("div",{className:u.section_part+(n>0?" "+u.repeated:"")+(E++%2==0?" "+u.even:""),children:[Array.from({length:m},(e,n)=>{let r=t.ratios[n]||0,i=t.subdivide[n]||1,a=t.offsets[n]||0;return(0,s.jsx)("div",{className:u.row,children:Array.from({length:r*i},(e,t)=>(0,s.jsx)("div",{className:u.dot+(t%i==0?"":" "+u.sub_dot),children:(0,s.jsx)("div",{style:{left:a?"".concat(100*a,"%"):null}})},"dot"+t))},"row"+n)}),(0,s.jsx)("div",{className:u.repeat_line,children:(0,s.jsx)(D.oic,{})}),1!=t.length&&0==n?(0,s.jsxs)("div",{className:u.scale_corner,children:[(0,s.jsx)("span",{children:String(t.length).substr(0,4)}),(0,s.jsx)(S.gV0,{style:{verticalAlign:"middle"}})]}):""]},n))},"section"+n))})]})}var F=n(1001);function L(e){let{className:t,name:r,onInput:i,defaultValue:l,min:c,max:d,step:u,delimiter:m,..._}=e,f=(0,o.F)(n(7406)),p=(0,a.useMemo)(()=>(l||"").split(m||":").map(Number),[l,m]),[h,b]=(0,a.useState)(p);return(0,a.useEffect)(()=>{i&&i(h)},[h]),(0,a.useEffect)(()=>{b(p)},[p]),(0,s.jsxs)("div",{className:f.container+(t?" "+t:""),children:[(0,s.jsx)("div",{className:f.ratios,children:h.map((e,t)=>(0,s.jsxs)("div",{children:[(0,s.jsx)(F.g,{className:f.field,defaultValue:e,type:"number",step:u,min:c,max:d,onInput:(e,n)=>{e.length<=0||("0"==n&&t==h.length-1?h.splice(t,1):h[t]=Number(e),b([...h]))}}),tb([...h,c||0]),children:(0,s.jsx)(S.Lfi,{style:{verticalAlign:"middle"}})})]})}var V=n(7079),O=n.n(V);function z(){let[e,t,r,i]=k((0,a.useCallback)(e=>[e.sections,e.setSections,e.curSection,e.setCurSection],[]),w.Z),l=(0,o.F)(n(4847)),c=(0,a.useMemo)(()=>e[r],[e,r]),d=n=>s=>{null!=s&&void 0!=s&&(n(s),t(O()(e)))};return(0,s.jsx)("div",{className:l.container,children:(0,s.jsxs)("div",{className:l.flex_container,children:[(0,s.jsx)("table",{className:l.table,children:(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"ratios"}),(0,s.jsx)("td",{children:(0,s.jsx)(L,{className:l.picker,name:"ratios",defaultValue:c.ratios.join(":"),min:0,step:1,onInput:d(e=>c.ratios=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"subdivides"}),(0,s.jsx)("td",{children:(0,s.jsx)(L,{name:"subdivide",defaultValue:c.subdivide.join(":"),step:1,min:1,onInput:d(e=>c.subdivide=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"offsets"}),(0,s.jsx)("td",{children:(0,s.jsx)(L,{name:"offsets",defaultValue:c.offsets.join(":"),max:1,min:0,onInput:d(e=>c.offsets=e)})})]})]})}),(0,s.jsx)("table",{className:l.single_fields+" "+l.table,children:(0,s.jsxs)("tbody",{children:[(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"scale"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"number",min:"0",defaultValue:c.length,onInput:d(e=>c.length=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"repeat"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"number",step:"1",min:"0",defaultValue:c.repeat,onInput:d(e=>c.repeat=e)})})]}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{children:"swing"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"number",min:"0",max:"1",defaultValue:c.swing,onInput:d(e=>c.swing=e)})})]}),(0,s.jsxs)("tr",{className:l.remove_btn,children:[(0,s.jsx)("th",{children:"remove"}),(0,s.jsx)("td",{children:(0,s.jsx)(F.g,{type:"button",value:"remove",...e.length<=1?{disabled:!0}:{},onClick:d(()=>{if(e.length>1)return i(Math.max(0,r-1)),e.splice(e.indexOf(c),1)})})})]})]})})]})})}var B=n(7696);function H(e){let{style:t}=e,[r,i,l,c,d,u,m]=k((0,a.useCallback)(e=>[e.paused,e.pause,e.play,e.bpm,e.setBpm,e.editMode,e.setEditMode],[]),w.Z),_=(0,o.F)(n(434));return(0,s.jsx)("div",{className:_.container,style:t,children:(0,s.jsxs)("div",{className:_.transport_bar,children:[(0,s.jsx)("div",{className:_.transport_button,onClick:(0,a.useCallback)(()=>(r?l:i)(),[r]),children:r?(0,s.jsx)(B.hpr,{style:{verticalAlign:"middle"}}):(0,s.jsx)(B.bKE,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:_.transport_button,onClick:(0,a.useCallback)(()=>{n(8333).Transport.stop(),i()},[]),children:(0,s.jsx)(B.vJm,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{style:{paddingLeft:"2em",paddingRight:".5em"},children:"bpm"}),(0,s.jsx)("div",{children:(0,s.jsx)(F.g,{style:{width:"4em"},type:"number",defaultValue:c,onInput:e=>d(e)})}),(0,s.jsx)("div",{className:_.settings_button+("instrument"==u?" "+_.edit_mode:""),onClick:(0,a.useCallback)(()=>m("section"==u?"instrument":"section"),[u]),children:(0,s.jsx)(B.XkT,{style:{verticalAlign:"middle"}})})]})})}var Z=n(1121),R=n(9715);function G(e){var t=document.createElement("textarea");t.value=e,t.style.top="0",t.style.left="0",t.style.position="fixed",document.body.appendChild(t),t.focus(),t.select();try{document.execCommand("copy")}catch(e){console.error("Fallback: Oops, unable to copy",e)}document.body.removeChild(t)}function P(e){if(!navigator.clipboard){G(e);return}navigator.clipboard.writeText(e)}var W=n(6573),U=n(6808),X=n.n(U),q=n(3729),Y=n.n(q),J=n(4021),Q=n.n(J);function K(e){let t=Array.from({length:e.reduce((e,t)=>Math.max(t.ratios.length,e),0)},()=>0),n=512,s=new(Q()).Track;for(let r of e){let e=n*r.length;for(let n=0;nt?i():r(),[c,d]=(0,a.useState)(!1),[u,m]=(0,a.useState)({cb:()=>null}),[_,f]=(0,a.useState)(!1),p=!1,h=null,b=(0,a.useCallback)(e=>"yes"==X().get("is_supporter_already")?e():p&&Math.random()>h?(h+=.15,e()):void(d(!0),m({cb:function(){for(var t=arguments.length,n=Array(t),s=0;s{f(!0),X().set("is_supporter_already","yes",{expires:111})},[]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:e.sellout,style:{display:c?null:"none"},children:(0,s.jsxs)("div",{className:e.sellout_box,children:[_?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("h1",{children:["Thank you! ","<3"]}),(0,s.jsx)("p",{children:"What a C H A D."})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h1",{children:"Ooops! Looks like this is a premium feature!"}),(0,s.jsx)("p",{children:"Just kidding it's not. (But it could be)"}),(0,s.jsxs)("p",{children:["Oh and by the way, did you know you can support me on",(0,s.jsx)("a",{href:"https://www.buymeacoffee.com/angramme",target:"_blank",children:" buymeacoffee.com/angramme"}),"?"]})]}),(0,s.jsxs)("div",{className:e.coffee_btns,children:[_?"":(0,s.jsxs)("a",{href:"https://www.buymeacoffee.com/angramme",target:"_blank",className:e.coffee_button,onClick:x,children:[(0,s.jsx)("img",{src:"https://cdn.buymeacoffee.com/buttons/bmc-new-btn-logo.svg",alt:"Buy me a coffee",className:e.coffee_img}),(0,s.jsx)("span",{className:e.coffee_text,children:"Buy me a coffee"})]}),(0,s.jsx)("div",{className:e.imbroke,onClick:(0,a.useCallback)(u.cb,[u]),children:_?"Continue":"Nah fam, I'm broke"})]})]})}),(0,s.jsx)("div",{className:e.displacer}),(0,s.jsxs)("div",{className:e.left,children:[(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("a",{href:"https://ozi.vercel.app",target:"_blank",rel:"noopener",children:(0,s.jsx)(R.l8A,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:e.tooltip,children:"my website"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("a",{href:"https://www.buymeacoffee.com/angramme",target:"_blank",rel:"noopener",children:(0,s.jsx)(Z.vm6,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:e.tooltip,children:"buy me a coffee"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("a",{href:"https://github.com/Angramme/polyrhythm3#tutorial",target:"_blank",rel:"noopener",children:(0,s.jsx)(Z.CUu,{style:{verticalAlign:"middle"}})}),(0,s.jsx)("div",{className:e.tooltip,children:"Open help page."})]})]}),(0,s.jsxs)("div",{className:e.right,children:[(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)(Z.Ifu,{style:{verticalAlign:"middle"},onClick:(0,a.useCallback)(()=>{b(()=>{let e=k.getState();P(window.location.origin+window.location.pathname+E(e.sections,e.bpm)),setTimeout(()=>alert("copied the url to clipboard! "),100)})},[])}),(0,s.jsx)("div",{className:e.tooltip,children:"share your rhythm"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)(R.ojp,{style:{verticalAlign:"middle"},onClick:(0,a.useCallback)(()=>{b(()=>{Y()(K(k.getState().sections),"Polyrhythm.mid")})},[])}),(0,s.jsx)("div",{className:e.tooltip,children:"export midi"})]}),(0,s.jsxs)("div",{className:e.button,children:[(0,s.jsx)("span",{onClick:l,children:t?(0,s.jsx)(Z.dZ3,{style:{verticalAlign:"middle"}}):(0,s.jsx)(Z.JuG,{style:{verticalAlign:"middle"}})}),(0,s.jsxs)("div",{className:e.tooltip,children:["switch to ",t?"light":"dark"," mode"]})]})]})]})}var ee=n(2091),et=n(6204),en=n(8908),es=n(1054);function er(e){let{style:t}=e,[r,i,l]=k((0,a.useCallback)(e=>[e.instrumentIDs,e.setInstrumentIDs,e.sections],[]),w.Z),c=(0,o.F)(n(1308)),d=p(),u=h(),m=(0,a.useMemo)(()=>l.reduce((e,t)=>Math.max(e,t.ratios.length),-1),[l]),_=e=>t=>{r[e]=t,i(O()(r))},f={kickdrum:(0,s.jsx)(ee.nmk,{}),bongo:(0,s.jsx)(et.Z7b,{}),bell:(0,s.jsx)(ee.Z3q,{}),cowbell:(0,s.jsx)(en.Qor,{}),clave:(0,s.jsx)(es.fHv,{})};return(0,s.jsx)("div",{className:c.container,style:t,children:(0,s.jsx)("table",{children:r.slice(0,m).map((e,t)=>(0,s.jsxs)("tr",{children:[(0,s.jsxs)("td",{children:["track ",t+1," uses ",(0,s.jsx)("b",{children:d[e]})]}),(0,s.jsx)("td",{children:u.map((n,r)=>(0,s.jsx)("div",{className:c.button,onClick:()=>_(t)(r),value:r,style:{display:"inline",position:"relative",margin:"0.5rem",border:"solid 2px black",borderColor:e==r?"red":"rgba(0,0,0,0)",padding:"2px",borderRadius:"2px",cursor:"pointer"},children:f[n]},r))})]},t))})})}function ei(){let e=(0,o.F)(n(3655)),t=k((0,a.useCallback)(e=>e.editMode,[]));return(0,s.jsxs)("div",{className:e.container,children:[(0,s.jsx)($,{}),(0,s.jsx)(I,{}),(0,s.jsx)(H,{}),"section"==t?(0,s.jsx)(z,{}):"","instrument"==t?(0,s.jsx)(er,{}):""]})}n(3658);var ea=n(143);function el(){return(0,s.jsx)("div",{style:{position:"fixed",left:"-100%",bottom:"10px"},children:(0,s.jsx)("a",{href:"https://hits.seeyoufarm.com",children:(0,s.jsx)("img",{src:"https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fangramme.github.io%2Fpolyrhythm3%2Findex.html&count_bg=%23303250&title_bg=%232D2D2D&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false"})})})}let eo=n(8333);function ec(){let e=(0,o.F)(n(6077)),[t,r,c,d,u,m,_,f]=k((0,a.useCallback)(e=>[e.paused,e.bpm,e.setBpm,e.sections,e.setSections,e.instrumentIDs,e.pause,e.play],[]),w.Z);(0,a.useEffect)(()=>{t?eo.Transport.pause():eo.Transport.start()},[t]),(0,a.useEffect)(()=>{let e=e=>{" "===e.key?t?f():_():"ArrowUp"===e.key?c(r+10):"ArrowDown"===e.key&&c(r-10)};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,r]),(0,a.useEffect)(()=>{eo.Transport.bpm.rampTo(r,.2)},[r]),(0,a.useEffect)(()=>{let e=()=>{eo.start(),eo.context.resume()};return window.addEventListener("click",e),function(){window.removeEventListener("click",e)}},[]);let p=(0,a.useMemo)(()=>d.reduce((e,t)=>Math.max(e,t.ratios.length),-1),[d]);(0,a.useEffect)(()=>v(m,p),[m,p]),(0,a.useEffect)(()=>((0,n(6367).Z)((e,t)=>{let{accent:n,duration:s,track:r}=t,i=g()[r];try{i(s,e,n)}catch(e){}},d),function(){eo.Transport.cancel(0)}),[d]);let[h,b]=(0,a.useState)("/favicon.png");(0,a.useEffect)(()=>k.subscribe(e=>b(e),e=>A(e.sections)),[]);let x=(0,l.useRouter)();return(0,a.useEffect)(()=>{Object.keys(x.query).length<=0||(console.log("found state in url, proceeding to load..."),u(T(x.query)),c(Number(x.query.bpm)),window.history.replaceState({},document.title,window.location.pathname))},[x.query]),(0,s.jsxs)("div",{className:e.container,children:[(0,s.jsxs)(i(),{children:[(0,s.jsx)("title",{children:"Polyrhythm Metronome"}),(0,s.jsx)("meta",{name:"description",content:"A simple open source Polyrhythmic Generator / Metronome. Ever wanted to study a 13:7 or 3:4:5 or 42:69 polyrhythm? Then this is the app for you!"}),(0,s.jsx)("link",{rel:"icon",href:h})]}),(0,s.jsx)(el,{}),(0,s.jsx)(ei,{}),(0,s.jsxs)(ea.ZP,{location:"bottom",buttonText:"I understand",cookieName:"myAwesomeCookieName2",style:{background:"#111111"},buttonStyle:{color:"#111111",fontSize:"14px"},expires:150,children:["Hey! This website uses cookies \uD83C\uDF6A to enhance the user experience."," "]})]})}},6077:function(e){e.exports={container:"Home_container__Ws68t",dark:"Home_dark__U5IOg"}},434:function(e){e.exports={container:"controls_container__uQ6Ur",dark:"controls_dark__g22IO",title:"controls_title__LWuoS",table:"controls_table__P0oE9",button:"controls_button__hD52Z",transport_bar:"controls_transport_bar___YS_d",transport_button:"controls_transport_button__hzGjO",settings_button:"controls_settings_button___G7WG",edit_mode:"controls_edit_mode__ww6fK"}},4847:function(e){e.exports={container:"editor_container__xFY5A",dark:"editor_dark__nnss1",flex_container:"editor_flex_container__j97Qd",single_fields:"editor_single_fields__tA6LQ",table:"editor_table__H0zRX"}},3951:function(e){e.exports={field:"field_field__ahVh9",dark:"field_dark__BwSlo",wrong:"field_wrong__Wsc3z","type-button":"field_type-button___LpZp",title:"field_title__1hLXt"}},1308:function(e){e.exports={container:"instruments_container__foBA0",dark:"instruments_dark__3Tvcs",instrument:"instruments_instrument__PTjVo",header:"instruments_header__GwJMA"}},3655:function(e){e.exports={container:"main_container__nEWDz"}},7406:function(e){e.exports={container:"ratiopicker_container__rAS_I",ratios:"ratiopicker_ratios__cCYWH",field:"ratiopicker_field__BCgk1",add_btn:"ratiopicker_add_btn__nbGbV",dark:"ratiopicker_dark__UgVfg",delimiter:"ratiopicker_delimiter____6SI"}},9762:function(e){e.exports={displacer:"topbar_displacer__0dYiD",left:"topbar_left__K66EY",right:"topbar_right__sLY4D",dark:"topbar_dark__U4QCe",button:"topbar_button__E5VrH",tooltip:"topbar_tooltip__o_1q_",sellout:"topbar_sellout__rM0_c",sellout_box:"topbar_sellout_box__FioJL",coffee_btns:"topbar_coffee_btns__SSj1C",imbroke:"topbar_imbroke__CCJzc",coffee_img:"topbar_coffee_img__xoHFn",coffee_text:"topbar_coffee_text__0IStg",coffee_button:"topbar_coffee_button__Tmibd"}},2331:function(e){e.exports={container:"visualisation_container__yiY3D",dark:"visualisation_dark__PHySl",section:"visualisation_section__8iHll",dragover:"visualisation_dragover__99lVA",current:"visualisation_current__lGUjr",section_part:"visualisation_section_part__jOXjo",even:"visualisation_even__sY_E1",repeat_line:"visualisation_repeat_line__GvgB8",scale_corner:"visualisation_scale_corner__nqz4t",repeated:"visualisation_repeated__tsnUH",row:"visualisation_row__I_EAz",dot:"visualisation_dot__QAegW",sub_dot:"visualisation_sub_dot__Bv95k",add_btn:"visualisation_add_btn__E4_DW",bar_parent:"visualisation_bar_parent__O7F9w",bar:"visualisation_bar__hClii"}}},function(e){var t=function(t){return e(e.s=t)};e.O(0,[961,151,317,510,127,396,365,817,594,757,805,888,774,179],function(){return t(5557)}),_N_E=e.O()}]); \ No newline at end of file diff --git a/index.html b/index.html index 457e72b..7e6d03b 100644 --- a/index.html +++ b/index.html @@ -1 +1 @@ -Polyrhythm Metronome
my website
buy me a coffee
Open help page.
share your rhythm
export midi
switch to dark mode
bpm
ratios
:
subdivides
offsets
scale
repeat
swing
remove
\ No newline at end of file +Polyrhythm Metronome
my website
buy me a coffee
Open help page.
share your rhythm
export midi
switch to dark mode
bpm
ratios
:
subdivides
offsets
scale
repeat
swing
remove
\ No newline at end of file