javascript:(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function t(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=t(o);fetch(o.href,i)}})();var Se,g,Cn,Hn,G,ln,Pn,Fe,Mn,Be,Oe,Re,ce={},Nn=[],ct=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qe=Array.isArray;function O(e,n){for(var t in n)e[t]=n[t];return e}function Ve(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function st(e,n,t){var r,o,i,l={};for(i in n)i=="key"?r=n[i]:i=="ref"?o=n[i]:l[i]=n[i];if(arguments.length>2&&(l.children=arguments.length>3?Se.call(arguments,2):t),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)l[i]===void 0&&(l[i]=e.defaultProps[i]);return ke(e,l,r,o,null)}function ke(e,n,t,r,o){var i={type:e,props:n,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Cn,__i:-1,__u:0};return o==null&&g.vnode!=null&&g.vnode(i),i}function J(e){return e.children}function le(e,n){this.props=e,this.context=n}function X(e,n){if(n==null)return e.__?X(e.__,e.__i+1):null;for(var t;nn&&G.sort(Fe));me.__r=0}function Ln(e,n,t,r,o,i,l,c,u,s,p){var a,h,f,x,L,$,y=r&&r.__k||Nn,k=n.length;for(u=ut(t,n,y,u,k),a=0;a0?ke(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):l).__=e,l.__b=e.__b+1,c=null,(s=l.__i=dt(l,t,u,a))!==-1&&(a--,(c=t[s])&&(c.__u|=2)),c==null||c.__v===null?(s==-1&&h--,typeof l.type!="function"&&(l.__u|=4)):s!=u&&(s==u-1?h--:s==u+1?h++:(s>u?h--:h++,l.__u|=4))):e.__k[i]=null;if(a)for(i=0;i(u!=null&&!(2&u.__u)?1:0))for(o=t-1,i=t+1;o>=0||i=0){if((u=n[o])&&!(2&u.__u)&&l==u.key&&c===u.type)return o;o--}if(i=t.__.length&&t.__.push({}),t.__[e]}function gt(e){return we=1,vt(In,e)}function vt(e,n,t){var r=Ye(se++,2);if(r.t=e,!r.__c&&(r.__=[In(void 0,n),function(c){var u=r.__N?r.__N[0]:r.__[0],s=r.t(u,c);u!==s&&(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=b,!b.u)){var o=function(c,u,s){if(!r.__c.__H)return!0;var p=r.__c.__H.__.filter(function(h){return!!h.__c});if(p.every(function(h){return!h.__N}))return!i||i.call(this,c,u,s);var a=r.__c.props!==c;return p.forEach(function(h){if(h.__N){var f=h.__[0];h.__=h.__N,h.__N=void 0,f!==h.__[0]&&(a=!0)}}),i&&i.call(this,c,u,s)||a};b.u=!0;var i=b.shouldComponentUpdate,l=b.componentWillUpdate;b.componentWillUpdate=function(c,u,s){if(this.__e){var p=i;i=void 0,o(c,u,s),i=p}l&&l.call(this,c,u,s)},b.shouldComponentUpdate=o}return r.__N||r.__}function yt(e,n){var t=Ye(se++,3);!m.__s&&En(t.__H,n)&&(t.__=e,t.i=n,b.__H.__h.push(t))}function Je(e,n){var t=Ye(se++,7);return En(t.__H,n)&&(t.__=e(),t.__H=n,t.__h=e),t.__}function kt(e,n){return we=8,Je(function(){return e},n)}function bt(){for(var e;e=zn.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(be),e.__H.__h.forEach(Ge),e.__H.__h=[]}catch(n){e.__H.__h=[],m.__e(n,e.__v)}}m.__b=function(e){b=null,dn&&dn(e)},m.__=function(e,n){e&&n.__k&&n.__k.__m&&(e.__m=n.__k.__m),gn&&gn(e,n)},m.__r=function(e){fn&&fn(e),se=0;var n=(b=e.__c).__H;n&&(De===b?(n.__h=[],b.__h=[],n.__.forEach(function(t){t.__N&&(t.__=t.__N),t.i=t.__N=void 0})):(n.__h.forEach(be),n.__h.forEach(Ge),n.__h=[],se=0)),De=b},m.diffed=function(e){_n&&_n(e);var n=e.__c;n&&n.__H&&(n.__H.__h.length&&(zn.push(n)!==1&&un===m.requestAnimationFrame||((un=m.requestAnimationFrame)||mt)(bt)),n.__H.__.forEach(function(t){t.i&&(t.__H=t.i),t.i=void 0})),De=b=null},m.__c=function(e,n){n.some(function(t){try{t.__h.forEach(be),t.__h=t.__h.filter(function(r){return!r.__||Ge(r)})}catch(r){n.some(function(o){o.__h&&(o.__h=[])}),n=[],m.__e(r,t.__v)}}),pn&&pn(e,n)},m.unmount=function(e){hn&&hn(e);var n,t=e.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{be(r)}catch(o){n=o}}),t.__H=void 0,n&&m.__e(n,t.__v))};var vn=typeof requestAnimationFrame=="function";function mt(e){var n,t=function(){clearTimeout(r),vn&&cancelAnimationFrame(n),setTimeout(e)},r=setTimeout(t,100);vn&&(n=requestAnimationFrame(t))}function be(e){var n=b,t=e.__c;typeof t=="function"&&(e.__c=void 0,t()),b=n}function Ge(e){var n=b;e.__c=e.__(),b=n}function En(e,n){return!e||e.length!==n.length||n.some(function(t,r){return t!==e[r]})}function In(e,n){return typeof n=="function"?n(e):n}var wt=Symbol.for("preact-signals");function Ce(){if(R>1)R--;else{for(var e,n=!1;ae!==void 0;){var t=ae;for(ae=void 0,We++;t!==void 0;){var r=t.o;if(t.o=void 0,t.f&=-3,!(8&t.f)&&On(t))try{t.c()}catch(o){n||(e=o,n=!0)}t=r}}if(We=0,R--,n)throw e}}function xt(e){if(R>0)return e();R++;try{return e()}finally{Ce()}}var v=void 0,ae=void 0,R=0,We=0,xe=0;function Fn(e){if(v!==void 0){var n=e.n;if(n===void 0||n.t!==v)return n={i:0,S:e,p:v.s,n:void 0,t:v,e:void 0,x:void 0,r:n},v.s!==void 0&&(v.s.n=n),v.s=n,e.n=n,32&v.f&&e.S(n),n;if(n.i===-1)return n.i=0,n.n!==void 0&&(n.n.p=n.p,n.p!==void 0&&(n.p.n=n.n),n.p=v.s,n.n=void 0,v.s.n=n,v.s=n),n}}function C(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}C.prototype.brand=wt;C.prototype.h=function(){return!0};C.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};C.prototype.U=function(e){if(this.t!==void 0){var n=e.e,t=e.x;n!==void 0&&(n.x=t,e.e=void 0),t!==void 0&&(t.e=n,e.x=void 0),e===this.t&&(this.t=t)}};C.prototype.subscribe=function(e){var n=this;return de(function(){var t=n.value,r=v;v=void 0;try{e(t)}finally{v=r}})};C.prototype.valueOf=function(){return this.value};C.prototype.toString=function(){return this.value+""};C.prototype.toJSON=function(){return this.value};C.prototype.peek=function(){var e=v;v=void 0;try{return this.value}finally{v=e}};Object.defineProperty(C.prototype,"value",{get:function(){var e=Fn(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(We>100)throw new Error("Cycle detected");this.v=e,this.i++,xe++,R++;try{for(var n=this.t;n!==void 0;n=n.x)n.t.N()}finally{Ce()}}}});function E(e){return new C(e)}function On(e){for(var n=e.s;n!==void 0;n=n.n)if(n.S.i!==n.i||!n.S.h()||n.S.i!==n.i)return!0;return!1}function Rn(e){for(var n=e.s;n!==void 0;n=n.n){var t=n.S.n;if(t!==void 0&&(n.r=t),n.S.n=n,n.i=-1,n.n===void 0){e.s=n;break}}}function Gn(e){for(var n=e.s,t=void 0;n!==void 0;){var r=n.p;n.i===-1?(n.S.U(n),r!==void 0&&(r.n=n.n),n.n!==void 0&&(n.n.p=r)):t=n,n.S.n=n.r,n.r!==void 0&&(n.r=void 0),n=r}e.s=t}function Q(e){C.call(this,void 0),this.x=e,this.s=void 0,this.g=xe-1,this.f=4}(Q.prototype=new C).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===xe))return!0;if(this.g=xe,this.f|=1,this.i>0&&!On(this))return this.f&=-2,!0;var e=v;try{Rn(this),v=this;var n=this.x();(16&this.f||this.v!==n||this.i===0)&&(this.v=n,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return v=e,Gn(this),this.f&=-2,!0};Q.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var n=this.s;n!==void 0;n=n.n)n.S.S(n)}C.prototype.S.call(this,e)};Q.prototype.U=function(e){if(this.t!==void 0&&(C.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var n=this.s;n!==void 0;n=n.n)n.S.U(n)}};Q.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(Q.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Fn(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function yn(e){return new Q(e)}function Wn(e){var n=e.u;if(e.u=void 0,typeof n=="function"){R++;var t=v;v=void 0;try{n()}catch(r){throw e.f&=-2,e.f|=8,Qe(e),r}finally{v=t,Ce()}}}function Qe(e){for(var n=e.s;n!==void 0;n=n.n)n.S.U(n);e.x=void 0,e.s=void 0,Wn(e)}function $t(e){if(v!==this)throw new Error("Out-of-order effect");Gn(this),v=e,this.f&=-2,8&this.f&&Qe(this),Ce()}function ue(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}ue.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var n=this.x();typeof n=="function"&&(this.u=n)}finally{e()}};ue.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Wn(this),Rn(this),R++;var e=v;return v=this,$t.bind(this,e)};ue.prototype.N=function(){2&this.f||(this.f|=2,this.o=ae,ae=this)};ue.prototype.d=function(){this.f|=8,1&this.f||Qe(this)};function de(e){var n=new ue(e);try{n.c()}catch(t){throw n.d(),t}return n.d.bind(n)}var Bn,ze,qn=[];de(function(){Bn=this.N})();function Z(e,n){g[e]=n.bind(null,g[e]||function(){})}function $e(e){ze&&ze(),ze=e&&e.S()}function Vn(e){var n=this,t=e.data,r=Ct(t);r.value=t;var o=Je(function(){for(var c=n,u=n.__v;u=u.__;)if(u.__c){u.__c.__$f|=4;break}var s=yn(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),p=yn(function(){return!Hn(s.value)}),a=de(function(){if(this.N=Kn,p.value){var f=s.value;c.base&&c.base.nodeType===3&&(c.base.data=f)}}),h=n.__$u.d;return n.__$u.d=function(){a(),h.call(this)},[p,s]},[]),i=o[0],l=o[1];return i.value?l.peek():l.value}Vn.displayName="_st";Object.defineProperties(C.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Vn},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Z("__b",function(e,n){if(typeof n.type=="string"){var t,r=n.props;for(var o in r)if(o!=="children"){var i=r[o];i instanceof C&&(t||(n.__np=t={}),t[o]=i,r[o]=i.peek())}}e(n)});Z("__r",function(e,n){$e();var t,r=n.__c;r&&(r.__$f&=-2,(t=r.__$u)===void 0&&(r.__$u=t=function(o){var i;return de(function(){i=this}),i.c=function(){r.__$f|=1,r.setState({})},i}())),$e(t),e(n)});Z("__e",function(e,n,t,r){$e(),e(n,t,r)});Z("diffed",function(e,n){$e();var t;if(typeof n.type=="string"&&(t=n.__e)){var r=n.__np,o=n.props;if(r){var i=t.U;if(i)for(var l in i){var c=i[l];c!==void 0&&!(l in r)&&(c.d(),i[l]=void 0)}else i={},t.U=i;for(var u in r){var s=i[u],p=r[u];s===void 0?(s=St(t,u,p,o),i[u]=s):s.o(p,o)}}}e(n)});function St(e,n,t,r){var o=n in e&&e.ownerSVGElement===void 0,i=E(t);return{o:function(l,c){i.value=l,r=c},d:de(function(){this.N=Kn;var l=i.value.value;r[n]!==l&&(r[n]=l,o?e[n]=l:l?e.setAttribute(n,l):e.removeAttribute(n))})}}Z("unmount",function(e,n){if(typeof n.type=="string"){var t=n.__e;if(t){var r=t.U;if(r){t.U=void 0;for(var o in r){var i=r[o];i&&i.d()}}}}else{var l=n.__c;if(l){var c=l.__$u;c&&(l.__$u=void 0,c.d())}}e(n)});Z("__h",function(e,n,t,r){(r<3||r===9)&&(n.__$f|=2),e(n,t,r)});le.prototype.shouldComponentUpdate=function(e,n){var t=this.__$u,r=t&&t.s!==void 0;for(var o in n)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var i=2&this.__$f;if(!(r||i||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var l in e)if(l!=="__source"&&e[l]!==this.props[l])return!0;for(var c in this.props)if(!(c in e))return!0;return!1};function Ct(e){return Je(function(){return E(e)},[])}var Ht=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Pt(){xt(function(){for(var e;e=qn.shift();)Bn.call(e)})}function Kn(){qn.push(this)===1&&(g.requestAnimationFrame||Ht)(Pt)}let kn=0;const Mt=()=>(kn++,kn),Xn=e=>{const n=[...e];for(let t=n.length-1;t>0;t--){const r=Math.floor(Math.random()*(t+1));[n[t],n[r]]=[n[r],n[t]]}return n},fe=(e,n,t)=>[...e.slice(0,n),t,...e.slice(n+1,e.length)],Yn=[],Jn=[],Qn={onDragEnd:e=>{for(const n of Yn)n(e);e.stopPropagation()},onClick:e=>{for(const n of Jn)n(e);e.stopPropagation()}},Ze=E(null),M=(e,n)=>{const t=e.clientY/window.innerHeight,r=e.clientX/window.innerWidth;Ze.value={options:n,pos:{top:t<.5?e.clientY-16:null,left:r<.5?e.clientX+12:null,bottom:t>=.5?window.innerHeight-(e.clientY+16):null,right:r>=.5?window.innerWidth-(e.clientX-12):null}},e.preventDefault(),e.stopPropagation()},_e=()=>{Ze.value=null},Nt=()=>({onClose:_e,...Ze.value});Jn.push(_e);const V=E(null),At=(e,n,t,r)=>{V.value={area:n,ix:t,handlers:r},e.preventDefault(),e.stopPropagation(),_e()},j=()=>{V.value=null},Lt=()=>{var e;return{onClose:j,cards:V.value?A(V.value.area,V.value.ix).cards:[],handlers:((e=V.value)==null?void 0:e.handlers)??(()=>({}))}},N=({cards:e,flipped:n=!1,reversed:t=!1,tapped:r=!1,laid:o=!1})=>({id:Mt(),cards:e,flipped:n,reversed:t,tapped:r,laid:o}),d=E({}),D=E([]),B=E([]),H=()=>{D.value=[d.value,...D.value.slice(0,9)],B.value=[]},Zn=e=>d.value[e]??[],A=(e,n)=>{var t;return(t=d.value[e])==null?void 0:t[n]},Tt=()=>D.value.length>1,Ut=()=>B.value.length>0,Dt=()=>{B.value=[D.value[0],...B.value],D.value=D.value.slice(1),d.value=D.value[0]},zt=()=>{D.value=[B.value[0],...D.value],B.value=B.value.slice(1),d.value=D.value[0]},He=(e,n)=>{j();const t=d.value[e][n];return d.value={...d.value,[e]:d.value[e].filter((r,o)=>o!==n)},t},je=e=>{j();const n=d.value[e];return d.value={...d.value,[e]:[]},n},en=(e,n,t)=>{t<0&&(t+=d.value[e][n].cards.length);const r=d.value[e][n].cards[t];return d.value={...d.value,[e]:fe(d.value[e],n,{...d.value[e][n],cards:d.value[e][n].cards.filter((o,i)=>t!==i)})},r},nn=(e,n)=>{j();const t=d.value[e][n].cards;return d.value={...d.value,[e]:fe(d.value[e],n,{...d.value[e][n],cards:[]})},t},Y=(e,n)=>{d.value={...d.value,[n]:[...d.value[n],...e]}},Pe=(e,n,t)=>{d.value={...d.value,[n]:fe(d.value[n],t,{...d.value[n][t],cards:[...d.value[n][t].cards,...e]})}},Me=(e,n,t)=>{d.value={...d.value,[n]:fe(d.value[n],t,{...d.value[n][t],cards:[...e,...d.value[n][t].cards]})}},tn=e=>e.reduce((n,t)=>n.concat(t.cards),[]),jn=(e,n)=>{j();const t=He(e,n);d.value={...d.value,[e]:[{...t,cards:[...t.cards,...tn(d.value[e])]}]}},et=(e,n,t,r)=>{if(!d.value[t][r])Ne(e,n,t,{},!0);else{const o=He(e,n);Pe(o.cards,t,e===t&&r>n?r-1:r)}H()},F=(e,n,t,r)=>{if(!d.value[t][r])Ne(e,n,t,{},!0);else{const o=He(e,n);Me(o.cards,t,e===t&&r>n?r-1:r)}H()},Ne=(e,n,t,r={},o=!1)=>{const i=He(e,n).cards;Y(o?[N({cards:i,...r})]:i.map(l=>N({cards:[l],...r})),t),H()},Ae=(e,n,t,r)=>{d.value={...d.value,[e]:fe(d.value[e],n,{...d.value[e][n],[t]:r})},H()},bn=(e,n)=>{Ae(e,n,"tapped",!d.value[e][n].tapped)},ve=(e,n)=>{Ae(e,n,"flipped",!d.value[e][n].flipped)},Et=(e,n)=>{Ae(e,n,"reversed",!d.value[e][n].reversed)},It=(e,n)=>{Ae(e,n,"laid",!d.value[e][n].laid)},Ft=(e,n,t={})=>{const r=je(e);Y(r.map(o=>N({cards:o.cards,...t})),n),H()},K=(e,n,t)=>{if(e===n)jn(n,t);else{const r=je(e);Me(tn(r),n,t)}H()},Ot=(e,n,t)=>{if(e===n)jn(n,t);else{const r=je(e);Pe(tn(r),n,t)}H()},P=(e,n,t,r,o=!1,i={})=>{if(d.value[e][n].cards.length<=1&&!o)Ne(e,n,r,i);else{const l=en(e,n,t);Y([N({cards:[l],...i})],r)}H()},z=(e,n,t,r,o,i=!1)=>{if(d.value[e][n].cards.length<=1&&!i)F(e,n,r,o);else if(!d.value[r][o])P(e,n,t,r);else{const l=en(e,n,t);Me([l],r,o)}H()},ie=(e,n,t,r,o,i=!1)=>{if(d.value[e][n].cards.length<=1&&!i)et(e,n,r,o);else if(!d.value[r][o])P(e,n,t,r);else{const l=en(e,n,t);Pe([l],r,o)}H()},Rt=(e,n,t,r={},o=!1)=>{const i=nn(e,n);Y(o?[N({cards:i,...r})]:i.map(l=>N({cards:[l],...r})),t),H()},mn=(e,n,t,r)=>{const o=nn(e,n);Me(o,t,r),H()},Gt=(e,n,t,r)=>{const o=nn(e,n);Pe(o,t,r),H()},Wt=e=>{j(),d.value=e,H()},Bt=e=>{const n=Object.fromEntries(e.map(t=>[t,d.value[t].map(r=>({...r,tapped:!1}))]));d.value={...d.value,...n},H()},wn=(e,n)=>{const t=Xn(d.value[e][n].cards);d.value={...d.value,[e]:[{...d.value[e][n],cards:t}]},H()},w=E(null),qt=(e,n,t)=>{w.value={handler:t,src:{area:e,ix:n},dest:null}},nt=()=>{w.value=null},S=(e,n)=>({onDragEnter:t=>{w.value&&(w.value={...w.value,dest:{area:e,ix:n}},t.stopPropagation())},onDragLeave:t=>{if(!w.value)return;const{dest:r}=w.value;r&&r.area===e&&r.ix===n&&(w.value={...w.value,dest:null}),t.stopPropagation()},onDragOver:t=>{w.value&&t.preventDefault()},onDrop:t=>{if(!w.value)return;const{dest:r,src:o}=w.value;r&&(o.area!==r.area||o.ix!==r.ix)&&w.value.handler(t,r.area,r.ix),nt(),t.stopPropagation()}}),Le=(e,n,t)=>({draggable:!0,onDragStart:r=>{_e(),qt(e,n,t),r.stopPropagation()}}),xn=(e,n)=>{var t;return!!((t=w.value)!=null&&t.src)&&w.value.src.area===e&&w.value.src.ix===n},$n=(e,n)=>{var t;return!!((t=w.value)!=null&&t.dest)&&w.value.dest.area===e&&w.value.dest.ix===n};Yn.push(nt);const rn=E(null),W=(e,n)=>{rn.value=n,e.preventDefault(),e.stopPropagation(),_e()},Vt=()=>{rn.value=null},Kt=()=>({onClose:Vt,src:rn.value}),Xt=[[{area:"shields",label:"シールド",stacked:!0},{area:"field",label:"場",expandThreshold:6}],[{area:"lands",label:"マナ",expandThreshold:3},{area:"deck",label:"デッキ",width:1},{area:"graveyard",label:"墓地",width:1},{area:"grdeck",label:"GR",width:1,optional:!0},{area:"exdeck",label:"超次元",width:1,optional:!0}],[{area:"hand",label:"手札"},{area:"exploring",label:"めくられた",optional:!0}]],q=e=>Le(e,null,(n,t,r)=>{t==="graveyard"||t==="exdeck"?K(e,t,r??0):t==="deck"||t==="grdeck"||r!=null?A(t,r??0).cards.length<=0?K(e,t,r??0):M(n,[["🫳 上に置く",()=>K(e,t,r??0)],["🫴 下に入れる",()=>Ot(e,t,r??0)]]):Ft(e,t,{reversed:t==="lands"})}),Ee=e=>Le(e,null,(n,t,r)=>{t==="graveyard"||t==="exdeck"?mn(e,0,t,r??0):t==="deck"||t==="grdeck"||r!=null?A(t,r??0).cards.length<=0?K(e,t,r??0):M(n,[["🫳 上に置く",()=>mn(e,0,t,r??0)],["🫴 下に入れる",()=>Gt(e,0,t,r??0)]]):Rt(e,0,t,{reversed:t==="lands"})}),re=(e,n)=>Le(e,n,(t,r,o)=>{r==="graveyard"||r==="exdeck"?F(e,n,r,o??0):r==="deck"||r==="grdeck"||o!=null?A(r,o??0).cards.length<=0?K(e,r,o??0):M(t,[["🫳 上に置く",()=>F(e,n,r,o??0)],["🫴 下に入れる",()=>et(e,n,r,o??0)]]):Ne(e,n,r,{reversed:r==="lands"})}),ye=(e,n,t=!1)=>Le(e,n,(r,o,i)=>{o==="graveyard"||o==="exdeck"?z(e,n,0,o,i??0,t):o==="deck"||o==="grdeck"||i!=null?A(o,i??0).cards.length<=0?K(e,o,i??0):M(r,[["🫳 上に置く",()=>z(e,n,0,o,i??0,t)],["🫴 下に入れる",()=>ie(e,n,0,o,i??0,t)]]):P(e,n,0,o,t,{reversed:o==="lands"})}),T=(e,n,t,r=!1)=>{At(e,n,t,o=>({onClick:i=>M(i,[["🔍 拡大",()=>W(i,A(n,t).cards[o])],["⚔️ 場に出す",()=>P(n,t,o,"field",r)],["🛡️ シールドに追加",()=>P(n,t,o,"shields",r)],["🫳 デッキの上に置く",()=>z(n,t,o,"deck",0,r)],["🫴 デッキの下に入れる",()=>ie(n,t,o,"deck",0,r)],["🪦 墓地に送る",()=>z(n,t,o,"graveyard",0,r)],["🎰 GRゾーンに置く",()=>ie(n,t,o,"grdeck",0,r)],["⚡ 超次元ゾーンに置く",()=>z(n,t,o,"exdeck",0,r)],["⛰️ マナに追加",()=>P(n,t,o,"lands",r,{reversed:!0})],["🃏 手札に加える",()=>P(n,t,o,"hand",r)]]),onContextMenu:i=>M(i,[["🔍 拡大",()=>W(i,A(n,t).cards[o])],["⚔️ 場に出す",()=>P(n,t,o,"field",r)],["🛡️ シールドに追加",()=>P(n,t,o,"shields",r)],["🫳 デッキの上に置く",()=>z(n,t,o,"deck",0,r)],["🫴 デッキの下に入れる",()=>ie(n,t,o,"deck",0,r)],["🪦 墓地に送る",()=>z(n,t,o,"graveyard",0,r)],["🎰 GRゾーンに置く",()=>ie(n,t,o,"grdeck",0,r)],["⚡ 超次元ゾーンに置く",()=>z(n,t,o,"exdeck",0,r)],["⛰️ マナに追加",()=>P(n,t,o,"lands",r,{reversed:!0})],["🃏 手札に加える",()=>P(n,t,o,"hand",r)]])}))},Yt={field:{stack:e=>({onClick:n=>W(n,A("field",e).cards[0]),onContextMenu:n=>M(n,[["✅ タップ",()=>bn("field",e)],["⚡ 超次元ゾーン送り",()=>F("field",e,"exdeck",0)],["⬅️ 横向きにする",()=>It("field",e)],["↕️ 上下反転する",()=>Et("field",e)],["🔄 裏返す",()=>ve("field",e)],["👀 重なっているカード",t=>T(t,"field",e)]]),...S("field",e),...re("field",e)}),area:{...S("field",null),...q("field")}},shields:{stack:e=>({onClick:n=>{A("shields",e).flipped?ve("shields",e):W(n,A("shields",e).cards[0])},onContextMenu:n=>M(n,[["⚡ 超次元ゾーン送り",()=>F("shields",e,"exdeck",0)],["🔄 裏返す",()=>ve("shields",e)],["👀 重なっているカード",t=>T(t,"shields",e)]]),...S("shields",e),...re("shields",e)}),area:{...S("shields",null),...q("shields")}},deck:{stack:e=>({onClick:()=>P("deck",e,0,"exploring",!0),onContextMenu:n=>M(n,[["⚡ 超次元送り",()=>z("deck",e,0,"exdeck",0)],["🤏 ボトムから引く",()=>P("deck",e,-1,"hand",!0)],["♻️ シャッフル",()=>wn("deck",e)],["👀 リスト",t=>T(t,"deck",e,!0)]]),...S("deck",e),...ye("deck",e,!0)}),area:{...S("deck",null),...Ee("deck")}},graveyard:{stack:e=>({onClick:n=>T(n,"graveyard",e,!0),onContextMenu:n=>T(n,"graveyard",e,!0),...S("graveyard",e),...ye("graveyard",e,!0)}),area:{...S("graveyard",null),...Ee("graveyard")}},grdeck:{stack:e=>({onClick:()=>P("grdeck",e,0,"exploring",!0),onContextMenu:n=>M(n,[["♻️ シャッフル",()=>wn("grdeck",e)],["👀 リスト",t=>T(t,"grdeck",e,!0)]]),...S("grdeck",e),...ye("grdeck",e,!0)}),area:{...S("grdeck",null),...Ee("grdeck")}},exdeck:{stack:e=>({onClick:n=>T(n,"exdeck",e),onContextMenu:n=>T(n,"exdeck",e),...S("exdeck",e),...ye("exdeck",e,!0)}),area:{...S("exdeck",null),...q("exdeck")}},lands:{stack:e=>({onClick:()=>bn("lands",e),onContextMenu:n=>M(n,[["🔍 拡大",()=>W(n,A("lands",e).cards[0])],["⚡ 超次元送り",()=>F("lands",e,"exdeck",0)],["🔄 裏返す",()=>ve("lands",e)],["👀 重なっているカード",t=>T(t,"lands",e)]]),...S("lands",e),...re("lands",e)}),area:{...S("lands",null),...q("lands")}},hand:{stack:e=>({onClick:n=>W(n,A("hand",e).cards[0]),onContextMenu:n=>M(n,[["⚡ 超次元送り",()=>F("hand",e,"exdeck",0)],["👀 重なっているカード",t=>T(t,"hand",e)]]),...S("hand",e),...re("hand",e)}),area:{...S("hand",null),...q("hand")}},exploring:{stack:e=>({onClick:n=>W(n,A("exploring",e).cards[0]),onContextMenu:n=>M(n,[["⚡ 超次元送り",()=>F("exploring",e,"exdeck",0)],["👀 重なっているカード",t=>T(t,"hand",e)]]),...S("exploring",e),...re("exploring",e)}),area:{...S("exploring",null),...q("exploring")}}},Jt={layout:Xt,handlers:Yt},Qt=({label:e,children:n,width:t,nogrow:r,isSelected:o,isTargetted:i,...l})=>{const c={width:t==null?void 0:`calc(var(--tcgpg-card-width) #Readme.md# biome.json dist dmdeckmaker.vite.config.js node_modules package.json postcss.config.js public Readme.md release src tsconfig.json vite.config.js yarn.lock ${t} + var(--tcgpg-card-gap) #Readme.md# biome.json dist dmdeckmaker.vite.config.js node_modules package.json postcss.config.js public Readme.md release src tsconfig.json vite.config.js yarn.lock ${t-1})`,flexGrow:t||r?0:1};return _("div",{class:`tcgpg-area ${o?"tcgpg-selected":i?"tcgpg-targetted":""}`,style:c,...l,children:[n,_("span",{class:"tcgpg-area-label",children:e})]})},Zt=({onClose:e,pos:n,options:t})=>{const r=kt((o,i)=>{i(o),o.stopPropagation(),e()},[e]);return t&&_("div",{class:"tcgpg-menu-container",style:n,children:t.map(o=>_("div",{class:"tcgpg-menu-option",onClick:i=>r(i,o[1]),children:o[0]},o[0]))})},tt=({children:e,onClick:n})=>_("div",{class:"tcgpg-overlay",onClick:n,children:e}),rt=({stack:e,isSelected:n,isTargetted:t,style:r={},...o})=>{const i=(e.tapped?-30:0)+(e.reversed?180:0)+(e.laid?-90:0),l=e.cards.length===0?{pointerEvents:"none"}:{...r,backgroundImage:`url(${e.cards[0]})`,transform:`rotate(${i}deg)`},c=n?"tcgpg-selected":t?"tcgpg-targetted":e.cards.length<=0?"tcgpg-empty":e.cards.length>0&&e.flipped?"tcgpg-flipped":"tcgpg-nonempty";return _("div",{class:"tcgpg-card-container",style:l,...o,children:_("div",{class:`tcgpg-card-inner ${c}`,children:e.cards.length>1&&_("div",{class:`tcgpg-card-counter ${e.flipped?"tcgpg-flipped":""}`,children:e.flipped?e.cards.length:`+${e.cards.length-1}`})})})},jt=({cards:e,onClose:n,handlers:t})=>e.length>0&&_(tt,{onClick:n,children:_("div",{class:"tcgpg-list-container",...Qn,children:e.map((r,o)=>_(rt,{stack:N({cards:[r]}),...t(o)},r))})}),er=({onClose:e,src:n})=>n&&_(tt,{onClick:e,children:_("img",{class:"tcgpg-lightbox-img",src:n})}),Sn=({href:e,target:n,children:t})=>_("a",{class:"tcgpg-link",href:e,target:n,children:t}),nr=-10,tr=-70,rr=-90,or=({area:e,handlers:n})=>{const t=Zn(e.area),r=e.stacked?rr:Math.max(Math.max(t.length-(e.expandThreshold??2),0)*nr,tr);return _(Qt,{label:`${e.label}${t.length>1?` (${t.length})`:""}`,width:e.width,nogrow:e.optional||e.stacked,isSelected:xn(e.area,null),isTargetted:$n(e.area,null),...n[e.area].area,children:t.map((o,i)=>_(rt,{stack:o,isSelected:xn(e.area,i),isTargetted:$n(e.area,i),style:{marginLeft:i>0?`${r}px`:0},...n[e.area].stack(i)},o.id))})},ot=({rows:e,handlers:n})=>_("div",{class:"tcgpg-rows",children:e.map((t,r)=>_("div",{class:"tcgpg-row",children:_(ir,{areas:t,handlers:n})},r))}),ir=({areas:e,handlers:n})=>e.map((t,r)=>Array.isArray(t)?_(ot,{rows:t,handlers:n},r):Zn(t.area).length>0||!t.optional?_(or,{area:t,handlers:n},t.area):null),lr=({layout:e,handlers:n})=>_("div",{class:"tcgpg-wrapper",...Qn,children:[_(Zt,{...Nt()}),_(jt,{...Lt()}),_(er,{...Kt()}),_(ot,{rows:e,handlers:n}),_("div",{class:"tcgpg-footer",children:[_(Sn,{href:"https://zk-phi.github.io/handanalyze",target:"_blank",children:"→ 確率計算機"})," / ",_(Sn,{href:"https://x.com/zk_phi",target:"_blank",children:"@zk_phi"})]})]}),ar=({children:e})=>_("div",{class:"tcgpg-floating-buttons",children:e}),oe=({children:e,disabled:n,...t})=>_("button",{class:"tcgpg-button",disabled:n,...t,children:e}),cr=`.tcgpg-area{position:relative;display:flex;flex-wrap:wrap;gap:var(--tcgpg-card-gap);border:2px solid #666;padding:var(--tcgpg-area-padding);box-sizing:content-box;min-height:var(--tcgpg-card-height);background:#444;border-radius:8px;cursor:pointer}.tcgpg-area:hover{background:#4a4a4a}.tcgpg-area.tcgpg-selected{box-shadow:inset 0 0 32px #fd0}.tcgpg-area.tcgpg-targetted{box-shadow:inset 0 0 32px #0ff}.tcgpg-area-label{position:absolute;padding:4px 6px;left:-2px;bottom:-2px;font-size:12px;font-weight:bold;border-radius:0 8px 0 8px;color:#fffc;background:#666;pointer-events:none}.tcgpg-button{display:inline-block;color:white;background:#ea0;font-size:16px;font-weight:bold;padding:4px 12px;border-radius:0.5em;cursor:pointer;outline:none;appearance:none;border:none}.tcgpg-button:disabled{background:#aaa;cursor:not-allowed}.tcgpg-button:hover:not(:disabled){opacity:0.8}.tcgpg-button:active:not(:disabled){opacity:0.6}.tcgpg-card-container{display:inline-flex;width:var(--tcgpg-card-width);height:var(--tcgpg-card-height);background-size:cover;overflow:hidden;border-radius:5px}.tcgpg-card-container:active{opacity:0.8}.tcgpg-card-inner{position:relative;display:inline-flex;width:var(--tcgpg-card-width);height:var(--tcgpg-card-height);align-items:flex-start;justify-content:flex-start;cursor:pointer}.tcgpg-card-inner.tcgpg-empty{pointer-events:none}.tcgpg-card-inner.tcgpg-nonempty{background:#0002;box-shadow:inset 0 0 8px #fff5}.tcgpg-card-inner.tcgpg-nonempty:hover{background:transparent}.tcgpg-card-inner.tcgpg-flipped{background:#028;box-shadow:inset 0 0 8px #fff5}.tcgpg-card-inner.tcgpg-flipped:hover{background:#028d}.tcgpg-card-inner.tcgpg-selected{background:#fd08}.tcgpg-card-inner.tcgpg-targetted{background:#0ff8}.tcgpg-card-counter{display:inline-block;padding:6px 8px;border-radius:4px;font-size:14px;font-weight:bold;pointer-events:none}.tcgpg-card-counter:not(.tcgpg-flipped){background:radial-gradient(#fffa,#fff0);color:black}.tcgpg-card-counter.tcgpg-flipped{color:#fff4}.tcgpg-floating-buttons{font-family:"Helvetica Neue",Arial,"Hiragino Kaku Gothic ProN","Hiragino Sans",Meiryo,sans-serif;display:flex;gap:8px;position:fixed;top:8px;right:8px;z-index:100000}.tcgpg-lightbox-img{object-fit:contain;width:75vw;height:75vh}.tcgpg-link{color:#fffb;text-decoration:none;border-bottom:1px dotted currentColor}.tcgpg-link:hover{color:#fff}.tcgpg-link:active{opacity:0.8}.tcgpg-list-container{display:flex;flex-wrap:wrap;padding:20px;gap:4px;position:fixed;width:80vw;left:10vw;top:24px;z-index:50;border-radius:0.5em;overflow:hidden;min-height:var(--tcgpg-card-height);background:#444}.tcgpg-menu-container{display:inline-block;position:fixed;z-index:1000;color:white;border-radius:0.5em;overflow:hidden;box-shadow:rgba(0,0,0,0.2) 0px 3px 5px -1px,rgba(0,0,0,0.14) 0px 6px 10px 0px,rgba(0,0,0,0.12) 0px 1px 18px 0px;background:#555}.tcgpg-menu-option{padding:3px 9px;font-size:16px;cursor:pointer}.tcgpg-menu-option:hover{background:#777}.tcgpg-menu-option:active{background:#999}.tcgpg-overlay{position:fixed;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100vw;height:100vh;background:#000a;z-index:100}.tcgpg-wrapper{--tcgpg-global-margin:8px;--tcgpg-area-padding:8px;--tcgpg-card-height:140px;--tcgpg-card-width:100px;--tcgpg-card-gap:4px;font-family:"Helvetica Neue",Arial,"Hiragino Kaku Gothic ProN","Hiragino Sans",Meiryo,sans-serif;background:#222;font-size:16px;user-select:none}.tcgpg-rows{flex-grow:1}.tcgpg-row{display:flex;gap:var(--tcgpg-global-margin);margin-bottom:var(--tcgpg-global-margin)}.tcgpg-footer{margin-top:16px;text-align:right} `,Ie=e=>{var r,o;const n=(o=(r=document.getElementsByClassName(e))==null?void 0:r[0])==null?void 0:o.children;return Array.from(n??[]).map(i=>{var l,c;return((c=(l=i==null?void 0:i.children)==null?void 0:l[0])==null?void 0:c.src)??""}).map(i=>i.replace("/s/","/"))},it=()=>{const e=Xn(Ie("MainCards")),n=Ie("GRCardsList"),t=Ie("HyperspatialCardsList");Wt({field:[],lands:[],graveyard:[N({cards:[]})],hand:e.splice(0,5).map(r=>N({cards:[r]})),shields:e.splice(0,5).map(r=>N({cards:[r],flipped:!0})),deck:[N({cards:e,flipped:!0})],grdeck:n.length>0?[N({cards:n,flipped:!0})]:[],exdeck:t.length>0?[N({cards:t})]:[],exploring:[]})},sr=({show:e,setShow:n})=>_(ar,{children:[e&&_(J,{children:[_(oe,{onClick:Dt,disabled:!Tt(),children:"一手戻す"}),_(oe,{onClick:zt,disabled:!Ut(),children:"一手進む"}),_(oe,{onClick:()=>Bt(["field","lands"]),children:"アンタップ"}),_(oe,{onClick:it,children:"リセット"})]}),_(oe,{onClick:()=>n(!e),children:e?"閉じる":"開く"})]}),ur={position:"fixed",zIndex:99999,top:0,left:0,width:"100vw",height:"100vh",margin:0,boxSizing:"border-box",background:"#222"},dr={padding:"20px 3vw",maxWidth:"960px",margin:"auto"},fr=()=>{const[e,n]=gt(!0);return yt(()=>it(),[]),_(J,{children:[_(sr,{show:e,setShow:n}),e&&_("div",{style:ur,children:_("div",{style:dr,children:_(lr,{...Jt})})})]})},lt=document.createElement("div");document.body.append(lt);const at=document.createElement("style");at.innerHTML=cr;document.head.append(at);pt(_(fr,{}),lt);