mirror of
https://github.com/CharaChorder/DeviceManager.git
synced 2026-01-20 08:52:59 +00:00
2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
import{s as oe,e as W,i as S,y as V,d as f,f as E,l as J,g as $,h as O,m as Q,j as A,C as j,v as T,n as X,a as M,c as U,u as Y,x as K,z as ge,t as de,p as pe,k as ye,B as be,A as te,J as He,Q as ze,w as ve,o as Ke,R as je,S as Ve}from "../chunks/scheduler.f5cfe514.js";import{S as ae,i as ce,g as ne,c as se,a as I,t as R,b as G,d as Z,m as x,e as ee,f as le}from "../chunks/index.c2fc59c9.js";import{e as he,u as Be,o as Ie}from "../chunks/each.94f093eb.js";import{K as Re,a as me,s as Ce}from "../chunks/keymap-codes.fc236303.js";import{A as We,I as Ye}from "../chunks/ActionSelector.2ddb6b76.js";import{L as qe}from "../chunks/i18n-svelte.4af892db.js";import{a as Ee}from "../chunks/title.f08fecde.js";import{c as re,C as ie,a as $e}from "../chunks/undo-redo.825f6805.js";import{d as Se,w as Te}from "../chunks/index.c76aaf45.js";import{c as we,s as _e,d as Fe}from "../chunks/index.085a7975.js";function Je(i){let e;function n(s, o){return!s[1].icon&&s[1].id?.length===1?Ge:Xe}let t=n(i),l=t(i);return{c(){l.c(),e=W()},l(s){l.l(s),e=W()},m(s, o){l.m(s,o),S(s,e,o)},p(s, o){t===(t=n(s))&&l?l.p(s,o):(l.d(1),l=t(s),l&&(l.c(),l.m(e.parentNode,e)))},d(s){s&&f(e),l.d(s)}}}function Qe(i){let e,n=(i[1].icon??i[1].id??`0x${i[1].code.toString(16)}`)+"",t;return{c(){e=E("kbd"),t=J(n),this.h()},l(l){e=$(l,"KBD",{class:!0});var s=O(e);t=Q(s,n),s.forEach(f),this.h()},h(){A(e,"class","svelte-pv7xjy"),j(e,"icon",!!i[1].icon)},m(l, s){S(l,e,s),T(e,t)},p(l, s){s&2&&n!==(n=(l[1].icon??l[1].id??`0x${l[1].code.toString(16)}`)+"")&&X(t,n),s&2&&j(e,"icon",!!l[1].icon)},d(l){l&&f(e)}}}function Xe(i){let e,n=(i[1].icon??i[1].id??`0x${i[1].code.toString(16)}`)+"",t;return{c(){e=E("kbd"),t=J(n),this.h()},l(l){e=$(l,"KBD",{class:!0});var s=O(e);t=Q(s,n),s.forEach(f),this.h()},h(){A(e,"class","inline-kbd svelte-pv7xjy"),j(e,"icon",!!i[1].icon)},m(l, s){S(l,e,s),T(e,t)},p(l, s){s&2&&n!==(n=(l[1].icon??l[1].id??`0x${l[1].code.toString(16)}`)+"")&&X(t,n),s&2&&j(e,"icon",!!l[1].icon)},d(l){l&&f(e)}}}function Ge(i){let e,n=i[1].id+"",t;return{c(){e=E("span"),t=J(n)},l(l){e=$(l,"SPAN",{});var s=O(e);t=Q(s,n),s.forEach(f)},m(l, s){S(l,e,s),T(e,t)},p(l, s){s&2&&n!==(n=l[1].id+"")&&X(t,n)},d(l){l&&f(e)}}}function Ze(i){let e;function n(s, o){if(s[0]==="keys")return Qe;if(s[0]==="inline-keys")return Je}let t=n(i),l=t&&t(i);return{c(){l&&l.c(),e=W()},l(s){l&&l.l(s),e=W()},m(s, o){l&&l.m(s,o),S(s,e,o)},p(s, [o]){t===(t=n(s))&&l?l.p(s,o):(l&&l.d(1),l=t&&t(s),l&&(l.c(),l.m(e.parentNode,e)))},i:V,o:V,d(s){s&&f(e),l&&l.d(s)}}}function xe(i, e, n){let t,{action:l}=e,{display:s="inline-keys"}=e;return i.$$set= o=>{"action"in o&&n(2,l=o.action),"display"in o&&n(0,s=o.display)},i.$$.update=()=>{i.$$.dirty&4&&n(1,t=typeof l=="number"?Re[l]??{code:l}:l)},[s,t,l]}class et extends ae{constructor(e){super(),ce(this,e,xe,Ze,oe,{action:2,display:0})}}function Ae(i, e, n){const t=i.slice();return t[2]=e[n],t[4]=n,t}function De(i, e){let n,t,l;return t=new et({props:{action:e[2],display:e[1]}}),{key:i,first:null,c(){n=W(),G(t.$$.fragment),this.h()},l(s){n=W(),Z(t.$$.fragment,s),this.h()},h(){this.first=n},m(s, o){S(s,n,o),x(t,s,o),l=!0},p(s, o){e=s;const r={};o&1&&(r.action=e[2]),o&2&&(r.display=e[1]),t.$set(r)},i(s){l||(I(t.$$.fragment,s),l=!0)},o(s){R(t.$$.fragment,s),l=!1},d(s){s&&f(n),ee(t,s)}}}function tt(i){let e=[],n=new Map,t,l,s=he(i[0]);const o= r=>`${typeof r[2]=="number"?r[2]:r[2].code}:${r[4]}`;for(let r=0; r<s.length; r+=1){let a=Ae(i,s,r),c=o(a);n.set(c,e[r]=De(c,a))}return{c(){for(let r=0; r<e.length; r+=1)e[r].c();t=W()},l(r){for(let a=0; a<e.length; a+=1)e[a].l(r);t=W()},m(r, a){for(let c=0; c<e.length; c+=1)e[c]&&e[c].m(r,a);S(r,t,a),l=!0},p(r, [a]){a&3&&(s=he(r[0]),ne(),e=Be(e,a,o,1,r,s,n,t.parentNode,Ie,De,t,Ae),se())},i(r){if(!l){for(let a=0; a<s.length; a+=1)I(e[a]);l=!0}},o(r){for(let a=0; a<e.length; a+=1)R(e[a]);l=!1},d(r){r&&f(t);for(let a=0; a<e.length; a+=1)e[a].d(r)}}}function nt(i, e, n){let{actions:t}=e,{display:l="inline-keys"}=e;return i.$$set= s=>{"actions"in s&&n(0,t=s.actions),"display"in s&&n(1,l=s.display)},[t,l]}class Me extends ae{constructor(e){super(),ce(this,e,nt,tt,oe,{actions:0,display:1})}}function st(i){let e;return{c(){e=E("div")},l(n){e=$(n,"DIV",{}),O(e).forEach(f)},m(n, t){S(n,e,t)},p:V,i:V,o:V,d(n){n&&f(e)}}}function lt(i){let e,n,t="add",l,s=`${i[3]}px 0`,o,r,a;return{c(){e=E("div"),n=E("button"),n.textContent=t,this.h()},l(c){e=$(c,"DIV",{class:!0});var y=O(e);n=$(y,"BUTTON",{class:!0,"data-svelte-h":!0}),Y(n)!=="svelte-y90f9l"&&(n.textContent=t),y.forEach(f),this.h()},h(){A(n,"class","icon svelte-niexr"),A(e,"class","cursor svelte-niexr"),ye(e,"translate",s)},m(c, y){S(c,e,y),T(e,n),i[8](n),o=!0,r||(a=K(n,"click",i[7]),r=!0)},p(c, y){y&8&&s!==(s=`${c[3]}px 0`)&&ye(e,"translate",s)},i(c){o||(c&&be(()=>{o&&(l||(l=le(e,we,{},!0)),l.run(1))}),o=!0)},o(c){c&&(l||(l=le(e,we,{},!1)),l.run(0)),o=!1},d(c){c&&f(e),i[8](null),c&&l&&l.end(),r=!1,a()}}}function rt(i){let e,n,t,l,s,o,r,a="•",c,y,d;const g=[lt,st],h=[];function k(m, v){return m[4]?0:1}return n=k(i),t=h[n]=g[n](i),s=new Me({props:{actions:i[0].phrase}}),{c(){e=E("div"),t.c(),l=M(),G(s.$$.fragment),o=M(),r=E("sup"),r.textContent=a,this.h()},l(m){e=$(m,"DIV",{role:!0,tabindex:!0,class:!0});var v=O(e);t.l(v),l=U(v),Z(s.$$.fragment,v),o=U(v),r=$(v,"SUP",{class:!0,"data-svelte-h":!0}),Y(r)!=="svelte-ouf49e"&&(r.textContent=a),v.forEach(f),this.h()},h(){A(r,"class","svelte-niexr"),A(e,"role","textbox"),A(e,"tabindex","0"),A(e,"class","svelte-niexr"),j(e,"edited",i[0].phrase.length!==0&&i[0].phraseChanged)},m(m, v){S(m,e,v),h[n].m(e,null),T(e,l),x(s,e,null),T(e,o),T(e,r),i[9](e),c=!0,y||(d=[K(e,"keydown",i[5]),K(e,"mousedown",i[6]),K(e,"focusin",i[10]),K(e,"focusout",i[11])],y=!0)},p(m, [v]){let D=n;n=k(m),n===D?h[n].p(m,v):(ne(),R(h[D],1,1,()=>{h[D]=null}),se(),t=h[n],t?t.p(m,v):(t=h[n]=g[n](m),t.c()),I(t,1),t.m(e,l));const w={};v&1&&(w.actions=m[0].phrase),s.$set(w),(!c||v&1)&&j(e,"edited",m[0].phrase.length!==0&&m[0].phraseChanged)},i(m){c||(I(t),I(s.$$.fragment,m),c=!0)},o(m){R(t),R(s.$$.fragment,m),c=!1},d(m){m&&f(e),h[n].d(),ee(s),i[9](null),y=!1,ge(d)}}}function it(i, e, n){let{chord:t}=e;function l(_){_.key==="ArrowUp"?c():_.key==="ArrowLeft"?s(g-1):_.key==="ArrowRight"?s(g+1):_.key==="Backspace"?(o(g-1),s(g-1)):_.key==="Delete"?o(g):me.has(_.key)?(r(g,me.get(_.key).code),de().then(()=>s(g+1))):Ce.has(_.key)&&(r(g,Ce.get(_.key)),de().then(()=>s(g+1)))}function s(_){g=Math.max(0,Math.min(_,t.phrase.length));const L=d.children.item(g);n(3,h=L.offsetLeft+L.offsetWidth)}function o(_, L=1){_ in t.phrase&&re.update(B=>(B.push({type:ie.Chord,id:t.id,actions:t.actions,phrase:t.phrase.toSpliced(_,L)}),B))}function r(_, L){re.update(B=>(B.push({type:ie.Chord,id:t.id,actions:t.actions,phrase:t.phrase.toSpliced(_,0,L)}),B))}function a(_){if(_.target===y)return;const L=_.layerX;let B=0;for(const P of d.children){const{offsetLeft:b,offsetWidth:u}=P;if(L<b+u/2){s(B-1);return}B++}s(B-1)}function c(){const _=new We({target:document.body}),L=document.querySelector("dialog > div"),B=document.querySelector("dialog"),P=L.getBoundingClientRect(),b=y.getBoundingClientRect(),u=.5,p=`${1-u*(1-b.width/P.width)} ${1-u*(1-b.height/P.height)}`,z=`${u*(b.x-P.x)}px ${u*(b.y-P.y)}px`,F={duration:150,easing:"ease"},C=L.animate([{scale:p,translate:z},{translate:"0 0",scale:"1"}],F),q=B.animate([{opacity:0},{opacity:1}],F);async function H(){C.reverse(),q.reverse(),await C.finished,_.$destroy(),await de(),d.focus()}_.$on("close",H),_.$on("select",({detail:ue})=>{r(g,ue),de().then(()=>s(g+1)),H()})}let y,d,g=0,h=0,k=!1;function m(_){pe[_?"unshift":"push"](()=>{y=_,n(1,y)})}function v(_){pe[_?"unshift":"push"](()=>{d=_,n(2,d)})}const D=()=>n(4,k=!0),w= _=>{_.relatedTarget!==y&&n(4,k=!1)};return i.$$set= _=>{"chord"in _&&n(0,t=_.chord)},[t,y,d,h,k,l,a,c,m,v,D,w]}class ot extends ae{constructor(e){super(),ce(this,e,it,rt,oe,{chord:0})}}function at(i){let e,n=i[3].configure.chords.NEW_CHORD()+"",t;return{c(){e=E("span"),t=J(n),this.h()},l(l){e=$(l,"SPAN",{class:!0});var s=O(e);t=Q(s,n),s.forEach(f),this.h()},h(){A(e,"class","svelte-1dgr3vl")},m(l, s){S(l,e,s),T(e,t)},p(l, s){s&8&&n!==(n=l[3].configure.chords.NEW_CHORD()+"")&&X(t,n)},d(l){l&&f(e)}}}function ct(i){let e,n=i[3].configure.chords.HOLD_KEYS()+"",t;return{c(){e=E("span"),t=J(n),this.h()},l(l){e=$(l,"SPAN",{class:!0});var s=O(e);t=Q(s,n),s.forEach(f),this.h()},h(){A(e,"class","svelte-1dgr3vl")},m(l, s){S(l,e,s),T(e,t)},p(l, s){s&8&&n!==(n=l[3].configure.chords.HOLD_KEYS()+"")&&X(t,n)},d(l){l&&f(e)}}}function ut(i){let e,n,t,l,s,o="•",r,a,c;function y(h, k){if(h[2]&&h[1].size===0)return ct;if(!h[2]&&!h[0])return at}let d=y(i),g=d&&d(i);return t=new Me({props:{display:"keys",actions:i[2]?[...i[1]].sort():i[0]?.actions??[]}}),{c(){e=E("button"),g&&g.c(),n=M(),G(t.$$.fragment),l=M(),s=E("sup"),s.textContent=o,this.h()},l(h){e=$(h,"BUTTON",{class:!0});var k=O(e);g&&g.l(k),n=U(k),Z(t.$$.fragment,k),l=U(k),s=$(k,"SUP",{class:!0,"data-svelte-h":!0}),Y(s)!=="svelte-ouf49e"&&(s.textContent=o),k.forEach(f),this.h()},h(){A(s,"class","svelte-1dgr3vl"),A(e,"class","svelte-1dgr3vl"),j(e,"deleted",i[0]&&i[0].phrase.length===0),j(e,"edited",i[0]&&i[0].actionsChanged)},m(h, k){S(h,e,k),g&&g.m(e,null),T(e,n),x(t,e,null),T(e,l),T(e,s),r=!0,a||(c=[K(e,"click",i[4]),K(e,"keydown",i[5]),K(e,"keyup",i[6])],a=!0)},p(h, [k]){d===(d=y(h))&&g?g.p(h,k):(g&&g.d(1),g=d&&d(h),g&&(g.c(),g.m(e,n)));const m={};k&7&&(m.actions=h[2]?[...h[1]].sort():h[0]?.actions??[]),t.$set(m),(!r||k&1)&&j(e,"deleted",h[0]&&h[0].phrase.length===0),(!r||k&1)&&j(e,"edited",h[0]&&h[0].actionsChanged)},i(h){r||(I(t.$$.fragment,h),r=!0)},o(h){R(t.$$.fragment,h),r=!1},d(h){h&&f(e),g&&g.d(),ee(t),a=!1,ge(c)}}}function ft(i, e, n){let t;te(i,qe, d=>n(3,t=d));let{chord:l=void 0}=e;const s=He();let o=new Set,r=!1;function a(){n(1,o=new Set),n(2,r=!0)}function c(d){r&&(d.preventDefault(),o.add(me.get(d.key).code),n(1,o))}function y(){if(r&&(n(2,r=!1),!(o.size<2))){if(!l)return s("submit",[...o]);re.update(d=>(d.push({type:ie.Chord,id:l.id,actions:[...o].sort(),phrase:l.phrase}),d))}}return i.$$set= d=>{"chord"in d&&n(0,l=d.chord)},[l,o,r,t,a,c,y]}class Ue extends ae{constructor(e){super(),ce(this,e,ft,ut,oe,{chord:0})}}function dt(i){let e,n="restore_from_trash",t,l,s,o;return{c(){e=E("button"),e.textContent=n,this.h()},l(r){e=$(r,"BUTTON",{class:!0,"data-svelte-h":!0}),Y(e)!=="svelte-7lvlk3"&&(e.textContent=n),this.h()},h(){A(e,"class","icon compact")},m(r, a){S(r,e,a),l=!0,s||(o=K(e,"click",i[2]),s=!0)},p:V,i(r){l||(r&&be(()=>{l&&(t||(t=le(e,_e,{},!0)),t.run(1))}),l=!0)},o(r){r&&(t||(t=le(e,_e,{},!1)),t.run(0)),l=!1},d(r){r&&f(e),r&&t&&t.end(),s=!1,o()}}}function ht(i){let e,n="delete",t,l,s,o;return{c(){e=E("button"),e.textContent=n,this.h()},l(r){e=$(r,"BUTTON",{class:!0,"data-svelte-h":!0}),Y(e)!=="svelte-18t8q"&&(e.textContent=n),this.h()},h(){A(e,"class","icon compact")},m(r, a){S(r,e,a),l=!0,s||(o=K(e,"click",i[1]),s=!0)},p:V,i(r){l||(r&&be(()=>{l&&(t||(t=le(e,_e,{},!0)),t.run(1))}),l=!0)},o(r){r&&(t||(t=le(e,_e,{},!1)),t.run(0)),l=!1},d(r){r&&f(e),r&&t&&t.end(),s=!1,o()}}}function _t(i){let e,n,t,l,s,o,r,a,c,y,d,g="undo",h,k,m,v,D="share",w,_,L;n=new Ue({props:{chord:i[0]}}),s=new ot({props:{chord:i[0]}});const B=[ht,dt],P=[];function b(u, p){return u[0].phrase.length!==0?0:u[0].phraseChanged?1:-1}return~(a=b(i))&&(c=P[a]=B[a](i)),{c(){e=E("th"),G(n.$$.fragment),t=M(),l=E("td"),G(s.$$.fragment),o=M(),r=E("td"),c&&c.c(),y=M(),d=E("button"),d.textContent=g,h=M(),k=E("div"),m=M(),v=E("button"),v.textContent=D,this.h()},l(u){e=$(u,"TH",{});var p=O(e);Z(n.$$.fragment,p),p.forEach(f),t=U(u),l=$(u,"TD",{class:!0});var z=O(l);Z(s.$$.fragment,z),z.forEach(f),o=U(u),r=$(u,"TD",{class:!0});var N=O(r);c&&c.l(N),y=U(N),d=$(N,"BUTTON",{class:!0,"data-svelte-h":!0}),Y(d)!=="svelte-1keg9r3"&&(d.textContent=g),h=U(N),k=$(N,"DIV",{class:!0}),O(k).forEach(f),m=U(N),v=$(N,"BUTTON",{class:!0,"data-svelte-h":!0}),Y(v)!=="svelte-1ooqupu"&&(v.textContent=D),N.forEach(f),this.h()},h(){A(l,"class","svelte-1dhtuxh"),A(d,"class","icon compact"),j(d,"disabled",i[0].isApplied),A(k,"class","separator svelte-1dhtuxh"),A(v,"class","icon compact"),A(r,"class","table-buttons svelte-1dhtuxh")},m(u, p){S(u,e,p),x(n,e,null),S(u,t,p),S(u,l,p),x(s,l,null),S(u,o,p),S(u,r,p),~a&&P[a].m(r,null),T(r,y),T(r,d),T(r,h),T(r,k),T(r,m),T(r,v),w=!0,_||(L=K(d,"click",i[2]),_=!0)},p(u, [p]){const z={};p&1&&(z.chord=u[0]),n.$set(z);const N={};p&1&&(N.chord=u[0]),s.$set(N);let F=a;a=b(u),a===F?~a&&P[a].p(u,p):(c&&(ne(),R(P[F],1,1,()=>{P[F]=null}),se()),~a?(c=P[a],c?c.p(u,p):(c=P[a]=B[a](u),c.c()),I(c,1),c.m(r,y)):c=null),(!w||p&1)&&j(d,"disabled",u[0].isApplied)},i(u){w||(I(n.$$.fragment,u),I(s.$$.fragment,u),I(c),w=!0)},o(u){R(n.$$.fragment,u),R(s.$$.fragment,u),R(c),w=!1},d(u){u&&(f(e),f(t),f(l),f(o),f(r)),ee(n),ee(s),~a&&P[a].d(),_=!1,L()}}}function pt(i, e){return i.actions.length===e.actions.length&&i.actions.every((n, t)=>n===e.actions[t])}function mt(i, e, n){let{chord:t}=e;function l(){re.update(o=>(o.push({type:ie.Chord,id:t.id,actions:t.actions,phrase:[]}),o))}function s(){re.update(o=>o.filter(r=>!(r.type===ie.Chord&&pt(r,t))))}return i.$$set= o=>{"chord"in o&&n(0,t=o.chord)},[t,l,s]}class gt extends ae{constructor(e){super(),ce(this,e,mt,_t,oe,{chord:0})}}function Ne(i, e, n){const t=i.slice();return t[20]=e[n][0],t}function bt(i){let e;return{c(){e=J("- / -")},l(n){e=Q(n,"- / -")},m(n, t){S(n,e,t)},p:V,d(n){n&&f(e)}}}function kt(i){let e=i[3]+1+"",n,t,l=i[5]+1+"",s;return{c(){n=J(e),t=J(" / "),s=J(l)},l(o){n=Q(o,e),t=Q(o," / "),s=Q(o,l)},m(o, r){S(o,n,r),S(o,t,r),S(o,s,r)},p(o, r){r&8&&e!==(e=o[3]+1+"")&&X(n,e),r&32&&l!==(l=o[5]+1+"")&&X(s,l)},d(o){o&&(f(n),f(t),f(s))}}}function Oe(i){let e,n,t,l,s,o;return t=new Ue({}),t.$on("submit",i[14]),{c(){e=E("tr"),n=E("th"),G(t.$$.fragment),l=E("td"),s=E("td")},l(r){e=$(r,"TR",{});var a=O(e);n=$(a,"TH",{});var c=O(n);Z(t.$$.fragment,c),c.forEach(f),l=$(a,"TD",{}),O(l).forEach(f),s=$(a,"TD",{}),O(s).forEach(f),a.forEach(f)},m(r, a){S(r,e,a),T(e,n),x(t,n,null),T(e,l),T(e,s),o=!0},p:V,i(r){o||(I(t.$$.fragment,r),o=!0)},o(r){R(t.$$.fragment,r),o=!1},d(r){r&&f(e),ee(t)}}}function yt(i){let e,n="No Results";return{c(){e=E("caption"),e.textContent=n,this.h()},l(t){e=$(t,"CAPTION",{class:!0,"data-svelte-h":!0}),Y(e)!=="svelte-b5pbjt"&&(e.textContent=n),this.h()},h(){A(e,"class","svelte-nxhahq")},m(t, l){S(t,e,l)},p:V,i:V,o:V,d(t){t&&f(e)}}}function vt(i){let e=[],n=new Map,t,l,s=he(i[0].slice(i[3]*i[6]-(i[3]===0?0:1),(i[3]+1)*i[6]-1));const o= r=>JSON.stringify(r[20].id);for(let r=0; r<s.length; r+=1){let a=Ne(i,s,r),c=o(a);n.set(c,e[r]=Le(c,a))}return{c(){for(let r=0; r<e.length; r+=1)e[r].c();t=W()},l(r){for(let a=0; a<e.length; a+=1)e[a].l(r);t=W()},m(r, a){for(let c=0; c<e.length; c+=1)e[c]&&e[c].m(r,a);S(r,t,a),l=!0},p(r, a){a&73&&(s=he(r[0].slice(r[3]*r[6]-(r[3]===0?0:1),(r[3]+1)*r[6]-1)),ne(),e=Be(e,a,o,1,r,s,n,t.parentNode,Ie,Le,t,Ne),se())},i(r){if(!l){for(let a=0; a<s.length; a+=1)I(e[a]);l=!0}},o(r){for(let a=0; a<e.length; a+=1)R(e[a]);l=!1},d(r){r&&f(t);for(let a=0; a<e.length; a+=1)e[a].d(r)}}}function Le(i, e){let n,t,l,s;return t=new gt({props:{chord:e[20]}}),{key:i,first:null,c(){n=E("tr"),G(t.$$.fragment),l=M(),this.h()},l(o){n=$(o,"TR",{});var r=O(n);Z(t.$$.fragment,r),l=U(r),r.forEach(f),this.h()},h(){this.first=n},m(o, r){S(o,n,r),x(t,n,null),T(n,l),s=!0},p(o, r){e=o;const a={};r&73&&(a.chord=e[20]),t.$set(a)},i(o){s||(I(t.$$.fragment,o),s=!0)},o(o){R(t.$$.fragment,o),s=!1},d(o){o&&f(n),ee(t)}}}function Ct(i){let e,n,t,l,s,o,r,a,c="navigate_before",y,d,g="navigate_next",h,k,m,v,D,w,_,L,B;function P(C, q){return C[5]!==-1?kt:bt}let b=P(i),u=b(i),p=i[3]===0&&Oe(i);const z=[vt,yt],N=[];function F(C, q){return C[5]!==-1?0:1}return D=F(i),w=N[D]=z[D](i),{c(){e=M(),n=E("div"),t=E("input"),s=M(),o=E("div"),u.c(),r=M(),a=E("button"),a.textContent=c,y=M(),d=E("button"),d.textContent=g,h=M(),k=E("section"),m=E("table"),p&&p.c(),v=M(),w.c(),this.h()},l(C){ze("svelte-1cwk6hs",document.head).forEach(f),e=U(C),n=$(C,"DIV",{class:!0});var H=O(n);t=$(H,"INPUT",{type:!0,placeholder:!0,class:!0}),s=U(H),o=$(H,"DIV",{class:!0});var ue=O(o);u.l(ue),ue.forEach(f),r=U(H),a=$(H,"BUTTON",{class:!0,"data-svelte-h":!0}),Y(a)!=="svelte-18qb9j7"&&(a.textContent=c),y=U(H),d=$(H,"BUTTON",{class:!0,"data-svelte-h":!0}),Y(d)!=="svelte-wgltnv"&&(d.textContent=g),H.forEach(f),h=U(C),k=$(C,"SECTION",{class:!0});var ke=O(k);m=$(ke,"TABLE",{class:!0});var fe=O(m);p&&p.l(fe),v=U(fe),w.l(fe),fe.forEach(f),ke.forEach(f),this.h()},h(){document.title="Chord Manager",A(t,"type","search"),A(t,"placeholder",l=i[4].configure.chords.search.PLACEHOLDER(i[1].length)),A(t,"class","svelte-nxhahq"),A(o,"class","paginator svelte-nxhahq"),A(a,"class","icon"),A(d,"class","icon"),A(n,"class","search-container svelte-nxhahq"),A(m,"class","svelte-nxhahq"),A(k,"class","svelte-nxhahq")},m(C, q){S(C,e,q),S(C,n,q),T(n,t),T(n,s),T(n,o),u.m(o,null),T(n,r),T(n,a),T(n,y),T(n,d),S(C,h,q),S(C,k,q),T(k,m),p&&p.m(m,null),T(m,v),N[D].m(m,null),i[15](k),_=!0,L||(B=[K(t,"input",i[8]),K(a,"click",i[12]),ve(Ee.call(null,a,{shortcut:"ctrl+left"})),K(d,"click",i[13]),ve(Ee.call(null,d,{shortcut:"ctrl+right"}))],L=!0)},p(C, [q]){(!_||q&18&&l!==(l=C[4].configure.chords.search.PLACEHOLDER(C[1].length)))&&A(t,"placeholder",l),b===(b=P(C))&&u?u.p(C,q):(u.d(1),u=b(C),u&&(u.c(),u.m(o,null))),C[3]===0?p?(p.p(C,q),q&8&&I(p,1)):(p=Oe(C),p.c(),I(p,1),p.m(m,v)):p&&(ne(),R(p,1,1,()=>{p=null}),se());let H=D;D=F(C),D===H?N[D].p(C,q):(ne(),R(N[H],1,1,()=>{N[H]=null}),se(),w=N[D],w?w.p(C,q):(w=N[D]=z[D](C),w.c()),I(w,1),w.m(m,null))},i(C){_||(I(p),I(w),_=!0)},o(C){R(p),R(w),_=!1},d(C){C&&(f(e),f(n),f(h),f(k)),u.d(),p&&p.d(),N[D].d(),i[15](null),L=!1,ge(B)}}}const Pe=38;function Et(i, e, n){let t,l,s,o,r,a;te(i,$e, b=>n(1,s=b)),te(i,qe, b=>n(4,o=b));let c;const y=Te(0);te(i,y, b=>n(6,a=b));let d;Ke(()=>{d=new ResizeObserver(()=>{y.set(Math.floor(c.clientHeight/Pe))}),y.set(Math.floor(c.clientHeight/Pe)),d.observe(c)}),je(()=>{d?.disconnect()});function g(b){const u=new Ye({tokenize:"full"});return b.forEach((p, z)=>{"phrase"in p&&u.add(z,p.phrase.map(N=>Re[N].id).join(""))}),u}const h=Te(void 0);function k(b){const u=b.target.value;h.set(u&&t?t.search(u):void 0)}function m(b){re.update(u=>(u.push({type:ie.Chord,id:b,actions:b,phrase:[]}),u))}const v=Se([h,$e],([b,u])=>b?.map(p=>[u[p],p])??u.map((p, z)=>[p,z]));te(i,v, b=>n(0,l=b));const D=Se([v,y],([b,u])=>Math.ceil((b.length+1)/u)-1);te(i,D, b=>n(5,r=b)),Ve("cursor-crossfade",Fe({}));let w=0;const _=()=>n(3,w=Math.max(w-1,0)),L=()=>n(3,w=Math.min(w+1,r)),B=({detail:b})=>m(b);function P(b){pe[b?"unshift":"push"](()=>{c=b,n(2,c)})}return i.$$.update=()=>{i.$$.dirty&2&&(t=s?.length>0?g(s):void 0),i.$$.dirty&1&&n(3,w=0)},[l,s,c,w,o,r,a,y,k,m,v,D,_,L,B,P]}class Bt extends ae{constructor(e){super(),ce(this,e,Et,Ct,oe,{})}}export{Bt as component};
|