@a9n-shoji/rvw 0.15.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ import{n as e,r as t,t as n}from"./rolldown-runtime-XKyaHtl9.js";import{p as r,r as i,t as a}from"./MermaidSurface-758VCVqh.js";import{A as o,C as s,D as c,E as l,F as u,L as d,O as f,P as p,S as m,T as h,V as g,a as _,c as v,d as y,f as b,ft as ee,h as x,ht as S,i as te,j as C,k as w,l as T,mt as ne,pt as re,r as ie,s as E,u as ae,w as D,x as O,y as oe}from"./WalkthroughPanel-DDZ63kfX.js";import{a as se,c as ce,l as k,r as le,s as A,u as j}from"./FileIcon-BrcB1D_2.js";import{t as M}from"./lib-BzGM1lY9.js";import{a as N,c as ue,i as de,n as fe,o as pe,r as P,s as me,t as F}from"./MarkdownTable-NA28H-AY.js";var I=t(j(),1),he=null,ge=class e{static createItem(e){return{prev:null,next:null,data:e}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return e.createItem(t)}allocateCursor(e,t){let n;return he===null?n={prev:e,next:t,cursor:this.cursor}:(n=he,he=he.cursor,n.prev=e,n.next=t,n.cursor=this.cursor),this.cursor=n,n}releaseCursor(){let{cursor:e}=this;this.cursor=e.cursor,e.prev=null,e.next=null,e.cursor=he,he=e}updateCursors(e,t,n,r){let{cursor:i}=this;for(;i!==null;)i.prev===e&&(i.prev=t),i.next===n&&(i.next=r),i=i.cursor}*[Symbol.iterator](){for(let e=this.head;e!==null;e=e.next)yield e.data}get size(){let e=0;for(let t=this.head;t!==null;t=t.next)e++;return e}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let n=null;this.head=null;for(let r of t){let t=e.createItem(r);n===null?this.head=t:n.next=t,t.prev=n,n=t}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(e,t=this){let n=this.allocateCursor(null,this.head);for(;n.next!==null;){let r=n.next;n.next=r.next,e.call(t,r.data,r,this)}this.releaseCursor()}forEachRight(e,t=this){let n=this.allocateCursor(this.tail,null);for(;n.prev!==null;){let r=n.prev;n.prev=r.prev,e.call(t,r.data,r,this)}this.releaseCursor()}reduce(e,t,n=this){let r=this.allocateCursor(null,this.head),i=t,a;for(;r.next!==null;)a=r.next,r.next=a.next,i=e.call(n,i,a.data,a,this);return this.releaseCursor(),i}reduceRight(e,t,n=this){let r=this.allocateCursor(this.tail,null),i=t,a;for(;r.prev!==null;)a=r.prev,r.prev=a.prev,i=e.call(n,i,a.data,a,this);return this.releaseCursor(),i}some(e,t=this){for(let n=this.head;n!==null;n=n.next)if(e.call(t,n.data,n,this))return!0;return!1}map(t,n=this){let r=new e;for(let e=this.head;e!==null;e=e.next)r.appendData(t.call(n,e.data,e,this));return r}filter(t,n=this){let r=new e;for(let e=this.head;e!==null;e=e.next)t.call(n,e.data,e,this)&&r.appendData(e.data);return r}nextUntil(e,t,n=this){if(e===null)return;let r=this.allocateCursor(null,e);for(;r.next!==null;){let e=r.next;if(r.next=e.next,t.call(n,e.data,e,this))break}this.releaseCursor()}prevUntil(e,t,n=this){if(e===null)return;let r=this.allocateCursor(e,null);for(;r.prev!==null;){let e=r.prev;if(r.prev=e.prev,t.call(n,e.data,e,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){let t=new e;for(let e of this)t.appendData(e);return t}prepend(e){return this.updateCursors(null,e,this.head,e),this.head===null?this.tail=e:(this.head.prev=e,e.next=this.head),this.head=e,this}prependData(t){return this.prepend(e.createItem(t))}append(e){return this.insert(e)}appendData(t){return this.insert(e.createItem(t))}insert(e,t=null){if(t!==null){if(this.updateCursors(t.prev,e,t,e),t.prev===null){if(this.head!==t)throw Error(`before doesn't belong to list`);this.head=e,t.prev=e,e.next=t,this.updateCursors(null,e)}else t.prev.next=e,e.prev=t.prev,t.prev=e,e.next=t}else this.updateCursors(this.tail,e,null,e),this.tail===null?this.head=e:(this.tail.next=e,e.prev=this.tail),this.tail=e;return this}insertData(t,n){return this.insert(e.createItem(t),n)}remove(e){if(this.updateCursors(e,e.prev,e,e.next),e.prev!==null)e.prev.next=e.next;else{if(this.head!==e)throw Error(`item doesn't belong to list`);this.head=e.next}if(e.next!==null)e.next.prev=e.prev;else{if(this.tail!==e)throw Error(`item doesn't belong to list`);this.tail=e.prev}return e.prev=null,e.next=null,e}push(t){this.insert(e.createItem(t))}pop(){return this.tail===null?null:this.remove(this.tail)}unshift(t){this.prepend(e.createItem(t))}shift(){return this.head===null?null:this.remove(this.head)}prependList(e){return this.insertList(e,this.head)}appendList(e){return this.insertList(e)}insertList(e,t){return e.head===null||(t==null?(this.updateCursors(this.tail,e.tail,null,e.head),this.tail===null?this.head=e.head:(this.tail.next=e.head,e.head.prev=this.tail),this.tail=e.tail):(this.updateCursors(t.prev,e.tail,t,e.head),t.prev===null?this.head=e.head:(t.prev.next=e.head,e.head.prev=t.prev),t.prev=e.tail,e.tail.next=t),e.head=null,e.tail=null),this}replace(e,t){`head`in t?this.insertList(t,e):this.insert(t,e),this.remove(e)}};function _e(e,t){let n=Object.create(SyntaxError.prototype),r=Error();return Object.assign(n,{name:e,message:t,get stack(){return(r.stack||``).replace(/^(.+\n){1,3}/,`${e}: ${t}\n`)}})}var ve=100,ye=60,be=` `;function xe({source:e,line:t,column:n,baseLine:r,baseColumn:i},a){function o(e,t){return s.slice(e,t).map((t,n)=>String(e+n+1).padStart(u)+` |`+t).join(`
2
+ `)}let s=(`
3
+ `.repeat(Math.max(r-1,0))+` `.repeat(Math.max(i-1,0))+e).split(/\r\n?|\n|\f/),c=Math.max(1,t-a)-1,l=Math.min(t+a,s.length+1),u=Math.max(4,String(l).length)+1,d=0;n+=3*(s[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>ve&&(d=n-ye+3,n=58);for(let e=c;e<=l;e++)e>=0&&e<s.length&&(s[e]=s[e].replace(/\t/g,be),s[e]=(d>0&&s[e].length>d?`…`:``)+s[e].substr(d,98)+(s[e].length>d+ve-1?`…`:``));return[o(c,t),Array(n+u+2).join(`-`)+`^`,o(t,l)].filter(Boolean).join(`
4
+ `).replace(/^(\s+\d+\s+\|\n)+/,``).replace(/\n(\s+\d+\s+\|)+$/,``)}function L(e,t,n,r,i,a=1,o=1){return Object.assign(_e(`SyntaxError`,e),{source:t,offset:n,line:r,column:i,sourceFragment(e){return xe({source:t,line:r,column:i,baseLine:a,baseColumn:o},isNaN(e)?0:e)},get formattedMessage(){return`Parse error: ${e}\n`+xe({source:t,line:r,column:i,baseLine:a,baseColumn:o},2)}})}var Se=0;function R(e){return e>=48&&e<=57}function z(e){return R(e)||e>=65&&e<=70||e>=97&&e<=102}function Ce(e){return e>=65&&e<=90}function we(e){return e>=97&&e<=122}function Te(e){return Ce(e)||we(e)}function B(e){return e>=128}function V(e){return Te(e)||B(e)||e===95}function Ee(e){return V(e)||R(e)||e===45}function De(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Oe(e){return e===10||e===13||e===12}function H(e){return Oe(e)||e===32||e===9}function U(e,t){return!(e!==92||Oe(t)||t===Se)}function ke(e,t,n){return e===45?V(t)||t===45||U(t,n):V(e)?!0:e===92&&U(e,t)}function Ae(e,t,n){return e===43||e===45?R(t)?2:t===46&&R(n)?3:0:e===46?R(t)?2:0:+!!R(e)}function je(e){return+(e===65279||e===65534)}var Me=Array(128);for(let e=0;e<Me.length;e++)Me[e]=H(e)&&130||R(e)&&131||V(e)&&132||De(e)&&133||e||128;function Ne(e){return e<128?Me[e]:132}function Pe(e,t){return t<e.length?e.charCodeAt(t):0}function Fe(e,t,n){return n===13&&Pe(e,t+1)===10?2:1}function Ie(e,t,n){let r=e.charCodeAt(t);return Ce(r)&&(r|=32),r===n}function Le(e,t,n,r){if(n-t!==r.length||t<0||n>e.length)return!1;for(let i=t;i<n;i++){let n=r.charCodeAt(i-t),a=e.charCodeAt(i);if(Ce(a)&&(a|=32),a!==n)return!1}return!0}function Re(e,t){for(;t>=0&&H(e.charCodeAt(t));t--);return t+1}function ze(e,t){for(;t<e.length&&H(e.charCodeAt(t));t++);return t}function Be(e,t){for(;t<e.length&&R(e.charCodeAt(t));t++);return t}function Ve(e,t){if(t+=2,z(Pe(e,t-1))){for(let n=Math.min(e.length,t+5);t<n&&z(Pe(e,t));t++);let n=Pe(e,t);H(n)&&(t+=Fe(e,t,n))}return t}function He(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(!Ee(n)){if(U(n,Pe(e,t+1)))t=Ve(e,t)-1;else break}}return t}function Ue(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),R(n)&&(t=Be(e,t+1),n=e.charCodeAt(t)),n===46&&R(e.charCodeAt(t+1))&&(t+=2,t=Be(e,t)),Ie(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),R(n)&&(t=Be(e,t+1+r+1))}return t}function We(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n===41){t++;break}U(n,Pe(e,t+1))&&(t=Ve(e,t))}return t}function Ge(e){if(e.length===1&&!z(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var Ke=`EOF-token.ident-token.function-token.at-keyword-token.hash-token.string-token.bad-string-token.url-token.bad-url-token.delim-token.number-token.percentage-token.dimension-token.whitespace-token.CDO-token.CDC-token.colon-token.semicolon-token.comma-token.[-token.]-token.(-token.)-token.{-token.}-token.comment-token`.split(`.`),qe=16384;function Je(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,qe)):e}var Ye=10,Xe=12,Ze=13;function Qe(e){let t=e.source,n=t.length,r=t.length>0?je(t.charCodeAt(0)):0,i=Je(e.lines,n),a=Je(e.columns,n),o=e.startLine,s=e.startColumn;for(let e=r;e<n;e++){let r=t.charCodeAt(e);i[e]=o,a[e]=s++,(r===Ye||r===Ze||r===Xe)&&(r===Ze&&e+1<n&&t.charCodeAt(e+1)===Ye&&(e++,i[e]=o,a[e]=s),o++,s=1)}i[n]=o,a[n]=s,e.lines=i,e.columns=a,e.computed=!0}var $e=class{constructor(e,t,n,r){this.setSource(e,t,n,r),this.lines=null,this.columns=null}setSource(e=``,t=0,n=1,r=1){this.source=e,this.startOffset=t,this.startLine=n,this.startColumn=r,this.computed=!1}getLocation(e,t){return this.computed||Qe(this),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,t,n){return this.computed||Qe(this),{source:n,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}}},W=16777215,G=24,et=1,tt=2,K=new Uint8Array(32);K[2]=22,K[21]=22,K[19]=20,K[23]=24;var q=new Uint8Array(32);q[2]=et,q[21]=et,q[19]=et,q[23]=et,q[22]=tt,q[20]=tt,q[24]=tt;function nt(e,t,n){return e<t?t:e>n?n:e}var rt=class{constructor(e,t){this.setSource(e,t)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e=``,t=()=>{}){e=String(e||``);let n=e.length,r=Je(this.offsetAndType,e.length+1),i=Je(this.balance,e.length+1),a=0,o=-1,s=0,c=e.length;this.offsetAndType=null,this.balance=null,i.fill(0),t(e,(e,t,n)=>{let l=a++;if(r[l]=e<<G|n,o===-1&&(o=t),i[l]=c,e===s){let e=i[c];i[c]=l,c=e,s=K[r[e]>>G]}else this.isBlockOpenerTokenType(e)&&(c=l,s=K[e])}),r[a]=0<<G|n,i[a]=a;for(let e=0;e<a;e++){let t=i[e];if(t<=e){let n=i[t];n!==e&&(i[e]=n)}else t>a&&(i[e]=a)}this.source=e,this.firstCharOffset=o===-1?0:o,this.tokenCount=a,this.offsetAndType=r,this.balance=i,this.reset(),this.next()}lookupType(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e]>>G:0}lookupTypeNonSC(e){for(let t=this.tokenIndex;t<this.tokenCount;t++){let n=this.offsetAndType[t]>>G;if(n!==13&&n!==25&&e--===0)return n}return 0}lookupOffset(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e-1]&W:this.source.length}lookupOffsetNonSC(e){for(let t=this.tokenIndex;t<this.tokenCount;t++){let n=this.offsetAndType[t]>>G;if(n!==13&&n!==25&&e--===0)return t-this.tokenIndex}return 0}lookupValue(e,t){return e+=this.tokenIndex,e<this.tokenCount&&Le(this.source,this.offsetAndType[e-1]&W,this.offsetAndType[e]&W,t)}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&W:this.offsetAndType[this.tokenCount]&W:this.firstCharOffset}getTokenEnd(e){return e===this.tokenIndex?this.tokenEnd:this.offsetAndType[nt(e,0,this.tokenCount)]&W}getTokenType(e){return e===this.tokenIndex?this.tokenType:this.offsetAndType[nt(e,0,this.tokenCount)]>>G}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBlockOpenerTokenType(e){return q[e]===et}isBlockCloserTokenType(e){return q[e]===tt}getBlockTokenPairIndex(e){let t=this.getTokenType(e);if(q[t]===1){let n=this.balance[e],r=this.getTokenType(n);return K[t]===r?n:-1}if(q[t]===2){let n=this.balance[e];return K[this.getTokenType(n)]===t?n:-1}return-1}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,t){return t?this.lookupType(t)===9&&this.source.charCodeAt(this.lookupOffset(t))===e:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let t=this.tokenIndex+e;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.offsetAndType[t-1]&W,t=this.offsetAndType[t],this.tokenType=t>>G,this.tokenEnd=t&W):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>G,this.tokenEnd=e&W):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(e,t){let n=e,r=0,i=0;loop:for(;n<this.tokenCount;n++){if(r=this.balance[n],r<e)break loop;switch(i=n>0?this.offsetAndType[n-1]&W:this.firstCharOffset,t(this.source.charCodeAt(i))){case 1:break loop;case 2:n++;break loop;default:this.isBlockOpenerTokenType(this.offsetAndType[n]>>G)&&(n=r)}}this.skip(n-this.tokenIndex)}forEachToken(e){for(let t=0,n=this.firstCharOffset;t<this.tokenCount;t++){let r=n,i=this.offsetAndType[t],a=i&W,o=i>>G;n=a,e(o,r,a,t)}}dump(){let e=Array(this.tokenCount);return this.forEachToken((t,n,r,i)=>{e[i]={idx:i,type:Ke[t],chunk:this.source.substring(n,r),balance:this.balance[i]}}),e}};function it(e,t){function n(t){return t<s?e.charCodeAt(t):0}function r(){l=Ue(e,l),ke(n(l),n(l+1),n(l+2))?(u=12,l=He(e,l)):n(l)===37?(u=11,l++):u=10}function i(){let t=l;if(l=He(e,l),Le(e,t,l,`url`)&&n(l)===40){if(l=ze(e,l+1),n(l)===34||n(l)===39){u=2,l=t+4;return}o()}else n(l)===40?(u=2,l++):u=1}function a(t){for(t||=n(l++),u=5;l<e.length;l++){let r=e.charCodeAt(l);switch(Ne(r)){case t:l++;return;case 130:if(Oe(r)){l+=Fe(e,l,r),u=6;return}break;case 92:if(l===e.length-1)break;let i=n(l+1);Oe(i)?l+=Fe(e,l+1,i):U(r,i)&&(l=Ve(e,l)-1)}}}function o(){for(u=7,l=ze(e,l);l<e.length;l++){let t=e.charCodeAt(l);switch(Ne(t)){case 41:l++;return;case 130:if(l=ze(e,l),n(l)===41||l>=e.length){l<e.length&&l++;return}l=We(e,l),u=8;return;case 34:case 39:case 40:case 133:l=We(e,l),u=8;return;case 92:if(U(t,n(l+1))){l=Ve(e,l)-1;break}l=We(e,l),u=8;return}}}e=String(e||``);let s=e.length,c=je(n(0)),l=c,u;for(;l<s;){let o=e.charCodeAt(l);switch(Ne(o)){case 130:u=13,l=ze(e,l+1);break;case 34:a();break;case 35:Ee(n(l+1))||U(n(l+1),n(l+2))?(u=4,l=He(e,l+1)):(u=9,l++);break;case 39:a();break;case 40:u=21,l++;break;case 41:u=22,l++;break;case 43:Ae(o,n(l+1),n(l+2))?r():(u=9,l++);break;case 44:u=18,l++;break;case 45:Ae(o,n(l+1),n(l+2))?r():n(l+1)===45&&n(l+2)===62?(u=15,l+=3):ke(o,n(l+1),n(l+2))?i():(u=9,l++);break;case 46:Ae(o,n(l+1),n(l+2))?r():(u=9,l++);break;case 47:n(l+1)===42?(u=25,l=e.indexOf(`*/`,l+2),l=l===-1?e.length:l+2):(u=9,l++);break;case 58:u=16,l++;break;case 59:u=17,l++;break;case 60:n(l+1)===33&&n(l+2)===45&&n(l+3)===45?(u=14,l+=4):(u=9,l++);break;case 64:ke(n(l+1),n(l+2),n(l+3))?(u=3,l=He(e,l+1)):(u=9,l++);break;case 91:u=19,l++;break;case 92:U(o,n(l+1))?i():(u=9,l++);break;case 93:u=20,l++;break;case 123:u=23,l++;break;case 125:u=24,l++;break;case 131:r();break;case 132:i();break;default:u=9,l++}t(u,c,c=l)}}function at(e){let t=this.createList(),n=!1,r={recognizer:e};for(;!this.eof;){switch(this.tokenType){case 25:this.next();continue;case 13:n=!0,this.next();continue}let i=e.getNode.call(this,r);if(i===void 0)break;n&&=(e.onWhiteSpace&&e.onWhiteSpace.call(this,i,t,r),!1),t.push(i)}return n&&e.onWhiteSpace&&e.onWhiteSpace.call(this,null,t,r),t}var ot=()=>{},st=33,ct=35,lt=59,ut=123,dt=0,ft={createList(){return[]},createSingleNodeList(e){return[e]},getFirstListNode(e){return e&&e[0]||null},getLastListNode(e){return e&&e.length>0?e[e.length-1]:null}},pt={createList(){return new ge},createSingleNodeList(e){return new ge().appendData(e)},getFirstListNode(e){return e&&e.first},getLastListNode(e){return e&&e.last}};function mt(e){return function(){return this[e]()}}function ht(e){let t=Object.create(null);for(let n of Object.keys(e)){let r=e[n],i=r.parse||r;i&&(t[n]=i)}return t}function gt(e){let t={context:Object.create(null),features:Object.assign(Object.create(null),e.features),scope:Object.assign(Object.create(null),e.scope),atrule:ht(e.atrule),pseudo:ht(e.pseudo),node:ht(e.node)};for(let[n,r]of Object.entries(e.parseContext))switch(typeof r){case`function`:t.context[n]=r;break;case`string`:t.context[n]=mt(r)}return{config:t,...t,...t.node}}function _t(e){let t=``,n=`<unknown>`,r=!1,i=ot,a=!1,o=new $e,s=Object.assign(new rt,gt(e||{}),{parseAtrulePrelude:!0,parseRulePrelude:!0,parseValue:!0,parseCustomProperty:!1,readSequence:at,consumeUntilBalanceEnd:()=>0,consumeUntilLeftCurlyBracket(e){return+(e===ut)},consumeUntilLeftCurlyBracketOrSemicolon(e){return+(e===ut||e===lt)},consumeUntilExclamationMarkOrSemicolon(e){return+(e===st||e===lt)},consumeUntilSemicolonIncluded(e){return e===lt?2:0},createList:ot,createSingleNodeList:ot,getFirstListNode:ot,getLastListNode:ot,parseWithFallback(e,t){let n=this.tokenIndex;try{return e.call(this)}catch(e){if(a)throw e;this.skip(n-this.tokenIndex);let r=t.call(this);return a=!0,i(e,r),a=!1,r}},lookupNonWSType(e){let t;do if(t=this.lookupType(e++),t!==13&&t!==25)return t;while(t!==dt);return dt},charCodeAt(e){return e>=0&&e<t.length?t.charCodeAt(e):0},substring(e,n){return t.substring(e,n)},substrToCursor(e){return this.source.substring(e,this.tokenStart)},cmpChar(e,n){return Ie(t,e,n)},cmpStr(e,n,r){return Le(t,e,n,r)},consume(e){let t=this.tokenStart;return this.eat(e),this.substrToCursor(t)},consumeFunctionName(){let e=t.substring(this.tokenStart,this.tokenEnd-1);return this.eat(2),e},consumeNumber(e){let n=t.substring(this.tokenStart,Ue(t,this.tokenStart));return this.eat(e),n},eat(e){if(this.tokenType!==e){let t=Ke[e].slice(0,-6).replace(/-/g,` `).replace(/^./,e=>e.toUpperCase()),n=`${/[[\](){}]/.test(t)?`"${t}"`:t} is expected`,r=this.tokenStart;switch(e){case 1:this.tokenType===2||this.tokenType===7?(r=this.tokenEnd-1,n=`Identifier is expected but function found`):n=`Identifier is expected`;break;case 4:this.isDelim(ct)&&(this.next(),r++,n=`Name is expected`);break;case 11:this.tokenType===10&&(r=this.tokenEnd,n=`Percent sign is expected`)}this.error(n,r)}this.next()},eatIdent(e){(this.tokenType!==1||this.lookupValue(0,e)===!1)&&this.error(`Identifier "${e}" is expected`),this.next()},eatDelim(e){this.isDelim(e)||this.error(`Delim "${String.fromCharCode(e)}" is expected`),this.next()},getLocation(e,t){return r?o.getLocationRange(e,t,n):null},getLocationFromList(e){if(r){let t=this.getFirstListNode(e),r=this.getLastListNode(e);return o.getLocationRange(t===null?this.tokenStart:t.loc.start.offset-o.startOffset,r===null?this.tokenStart:r.loc.end.offset-o.startOffset,n)}return null},error(e,n){let r=n!==void 0&&n<t.length?o.getLocation(n):this.eof?o.getLocation(Re(t,t.length-1)):o.getLocation(this.tokenStart);throw new L(e||`Unexpected input`,t,r.offset,r.line,r.column,o.startLine,o.startColumn)}}),c=()=>({filename:n,source:t,tokenCount:s.tokenCount,getTokenType:e=>s.getTokenType(e),getTokenTypeName:e=>Ke[s.getTokenType(e)],getTokenStart:e=>s.getTokenStart(e),getTokenEnd:e=>s.getTokenEnd(e),getTokenValue:e=>s.source.substring(s.getTokenStart(e),s.getTokenEnd(e)),substring:(e,t)=>s.source.substring(e,t),balance:s.balance.subarray(0,s.tokenCount+1),isBlockOpenerTokenType:s.isBlockOpenerTokenType,isBlockCloserTokenType:s.isBlockCloserTokenType,getBlockTokenPairIndex:e=>s.getBlockTokenPairIndex(e),getLocation:e=>o.getLocation(e,n),getRangeLocation:(e,t)=>o.getLocationRange(e,t,n)});return Object.assign(function(e,l){t=e,l||={},s.setSource(t,it),o.setSource(t,l.offset,l.line,l.column),n=l.filename||`<unknown>`,r=!!l.positions,i=typeof l.onParseError==`function`?l.onParseError:ot,a=!1,s.parseAtrulePrelude=`parseAtrulePrelude`in l?!!l.parseAtrulePrelude:!0,s.parseRulePrelude=`parseRulePrelude`in l?!!l.parseRulePrelude:!0,s.parseValue=`parseValue`in l?!!l.parseValue:!0,s.parseCustomProperty=`parseCustomProperty`in l&&!!l.parseCustomProperty;let{context:u=`default`,list:d=!0,onComment:f,onToken:p}=l;if(!(u in s.context))throw Error("Unknown context `"+u+"`");Object.assign(s,d?pt:ft),Array.isArray(p)?s.forEachToken((e,t,n)=>{p.push({type:e,start:t,end:n})}):typeof p==`function`&&s.forEachToken(p.bind(c())),typeof f==`function`&&s.forEachToken((e,n,r)=>{if(e===25){let e=s.getLocation(n,r),i=Le(t,r-2,r,`*/`)?t.slice(n+2,r-2):t.slice(n+2,r);f(i,e)}});let m=s.context[u].call(s,l);return s.eof||s.error(),m},{SyntaxError:L,config:s.config})}var vt=35,yt=42,bt=43,xt=45,St=47,Ct=117;function wt(e){switch(this.tokenType){case 4:return this.Hash();case 18:return this.Operator();case 21:return this.Parentheses(this.readSequence,e.recognizer);case 19:return this.Brackets(this.readSequence,e.recognizer);case 5:return this.String();case 12:return this.Dimension();case 11:return this.Percentage();case 10:return this.Number();case 2:return this.cmpStr(this.tokenStart,this.tokenEnd,`url(`)?this.Url():this.Function(this.readSequence,e.recognizer);case 7:return this.Url();case 1:return this.cmpChar(this.tokenStart,Ct)&&this.cmpChar(this.tokenStart+1,bt)?this.UnicodeRange():this.Identifier();case 9:{let e=this.charCodeAt(this.tokenStart);if(e===St||e===yt||e===bt||e===xt)return this.Operator();e===vt&&this.error(`Hex or identifier is expected`,this.tokenStart+1);break}}}var Tt={getNode:wt},Et=35,Dt=38,Ot=42,kt=43,At=47,jt=46,Mt=62,Nt=124,Pt=126;function Ft(e,t){t.last!==null&&t.last.type!==`Combinator`&&e!==null&&e.type!==`Combinator`&&t.push({type:`Combinator`,loc:null,name:` `})}function It(){switch(this.tokenType){case 19:return this.AttributeSelector();case 4:return this.IdSelector();case 16:return this.lookupType(1)===16?this.PseudoElementSelector():this.PseudoClassSelector();case 1:return this.TypeSelector();case 10:case 11:return this.Percentage();case 12:this.charCodeAt(this.tokenStart)===jt&&this.error(`Identifier is expected`,this.tokenStart+1);break;case 9:switch(this.charCodeAt(this.tokenStart)){case kt:case Mt:case Pt:case At:return this.Combinator();case jt:return this.ClassSelector();case Ot:case Nt:return this.TypeSelector();case Et:return this.IdSelector();case Dt:return this.NestingSelector()}}}var Lt={onWhiteSpace:Ft,getNode:It};function Rt(){return this.createSingleNodeList(this.Raw(null,!1))}function zt(){let e=this.createList();if(this.skipSC(),e.push(this.Identifier()),this.skipSC(),this.tokenType===18){e.push(this.Operator());let t=this.tokenIndex,n=this.parseCustomProperty?this.Value(null):this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1);if(n.type===`Value`&&n.children.isEmpty){for(let e=t-this.tokenIndex;e<=0;e++)if(this.lookupType(e)===13){n.children.appendData({type:`WhiteSpace`,loc:null,value:` `});break}}e.push(n)}return e}function Bt(e){return e!==null&&e.type===`Operator`&&(e.value[e.value.length-1]===`-`||e.value[e.value.length-1]===`+`)}var Vt={getNode:wt,onWhiteSpace(e,t){Bt(e)&&(e.value=` `+e.value),Bt(t.last)&&(t.last.value+=` `)},expression:Rt,var:zt},Ht=e({AtrulePrelude:()=>Tt,Selector:()=>Lt,Value:()=>Vt}),Ut=new Set([`none`,`and`,`not`,`or`]),Wt={parse:{prelude(){let e=this.createList();if(this.tokenType===1){let t=this.substring(this.tokenStart,this.tokenEnd);Ut.has(t.toLowerCase())||e.push(this.Identifier())}return e.push(this.Condition(`container`)),e},block(e=!1){return this.Block(e)}}},Gt={parse:{prelude:null,block(){return this.Block(!0)}}};function Kt(e,t){return this.parseWithFallback(()=>{try{return e.call(this)}finally{this.skipSC(),this.lookupNonWSType(0)!==22&&this.error()}},t||(()=>this.Raw(null,!0)))}var qt={layer(){this.skipSC();let e=this.createList(),t=Kt.call(this,this.Layer);return(t.type!==`Raw`||t.value!==``)&&e.push(t),e},supports(){this.skipSC();let e=this.createList(),t=Kt.call(this,this.Declaration,()=>Kt.call(this,()=>this.Condition(`supports`)));return(t.type!==`Raw`||t.value!==``)&&e.push(t),e}},Jt={container:Wt,"font-face":Gt,import:{parse:{prelude(){let e=this.createList();switch(this.tokenType){case 5:e.push(this.String());break;case 7:case 2:e.push(this.Url());break;default:this.error(`String or url() is expected`)}return this.skipSC(),this.tokenType===1&&this.cmpStr(this.tokenStart,this.tokenEnd,`layer`)?e.push(this.Identifier()):this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,`layer(`)&&e.push(this.Function(null,qt)),this.skipSC(),this.tokenType===2&&this.cmpStr(this.tokenStart,this.tokenEnd,`supports(`)&&e.push(this.Function(null,qt)),(this.lookupNonWSType(0)===1||this.lookupNonWSType(0)===21)&&e.push(this.MediaQueryList()),e},block:null}},layer:{parse:{prelude(){return this.createSingleNodeList(this.LayerList())},block(){return this.Block(!1)}}},media:{parse:{prelude(){return this.createSingleNodeList(this.MediaQueryList())},block(e=!1){return this.Block(e)}}},nest:{parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},page:{parse:{prelude(){return this.createSingleNodeList(this.SelectorList())},block(){return this.Block(!0)}}},scope:{parse:{prelude(){return this.createSingleNodeList(this.Scope())},block(e=!1){return this.Block(e)}}},"starting-style":{parse:{prelude:null,block(e=!1){return this.Block(e)}}},supports:{parse:{prelude(){return this.createSingleNodeList(this.Condition(`supports`))},block(e=!1){return this.Block(e)}}}};function Yt(){let e=this.createList();this.skipSC();loop:for(;!this.eof;){switch(this.tokenType){case 1:e.push(this.Identifier());break;case 5:e.push(this.String());break;case 18:e.push(this.Operator());break;case 22:break loop;default:this.error(`Identifier, string or comma is expected`)}this.skipSC()}return e}var Xt={parse(){return this.createSingleNodeList(this.SelectorList())}},Zt={parse(){return this.createSingleNodeList(this.Selector())}},Qt={parse(){return this.createSingleNodeList(this.Identifier())}},$t={parse:Yt},en={parse(){return this.createSingleNodeList(this.Nth())}},tn={dir:Qt,has:Xt,lang:$t,matches:Xt,is:Xt,"-moz-any":Xt,"-webkit-any":Xt,where:Xt,not:Xt,"nth-child":en,"nth-last-child":en,"nth-last-of-type":en,"nth-of-type":en,slotted:Zt,host:Zt,"host-context":Zt},nn=e({generate:()=>pn,name:()=>un,parse:()=>fn,structure:()=>dn}),J=43,Y=45,rn=110,an=!0,on=!1;function sn(e,t){let n=this.tokenStart+e,r=this.charCodeAt(n);for((r===J||r===Y)&&(t&&this.error(`Number sign is not allowed`),n++);n<this.tokenEnd;n++)R(this.charCodeAt(n))||this.error(`Integer is expected`,n)}function cn(e){return sn.call(this,0,e)}function X(e,t){if(!this.cmpChar(this.tokenStart+e,t)){let n=``;switch(t){case rn:n=`N is expected`;break;case Y:n=`HyphenMinus is expected`}this.error(n,this.tokenStart+e)}}function ln(){let e=0,t=0,n=this.tokenType;for(;n===13||n===25;)n=this.lookupType(++e);if(n!==10){if(this.isDelim(J,e)||this.isDelim(Y,e)){t=this.isDelim(J,e)?J:Y;do n=this.lookupType(++e);while(n===13||n===25);n!==10&&(this.skip(e),cn.call(this,an))}else return null}return e>0&&this.skip(e),t===0&&(n=this.charCodeAt(this.tokenStart),n!==J&&n!==Y&&this.error(`Number sign is expected`)),cn.call(this,t!==0),t===Y?`-`+this.consume(10):this.consume(10)}var un=`AnPlusB`,dn={a:[String,null],b:[String,null]};function fn(){let e=this.tokenStart,t=null,n=null;if(this.tokenType===10)cn.call(this,on),n=this.consume(10);else if(this.tokenType===1&&this.cmpChar(this.tokenStart,Y))switch(t=`-1`,X.call(this,1,rn),this.tokenEnd-this.tokenStart){case 2:this.next(),n=ln.call(this);break;case 3:X.call(this,2,Y),this.next(),this.skipSC(),cn.call(this,an),n=`-`+this.consume(10);break;default:X.call(this,2,Y),sn.call(this,3,an),this.next(),n=this.substrToCursor(e+2)}else if(this.tokenType===1||this.isDelim(J)&&this.lookupType(1)===1){let r=0;switch(t=`1`,this.isDelim(J)&&(r=1,this.next()),X.call(this,0,rn),this.tokenEnd-this.tokenStart){case 1:this.next(),n=ln.call(this);break;case 2:X.call(this,1,Y),this.next(),this.skipSC(),cn.call(this,an),n=`-`+this.consume(10);break;default:X.call(this,1,Y),sn.call(this,2,an),this.next(),n=this.substrToCursor(e+r+1)}}else if(this.tokenType===12){let r=this.charCodeAt(this.tokenStart),i=r===J||r===Y,a=this.tokenStart+i;for(;a<this.tokenEnd&&R(this.charCodeAt(a));a++);a===this.tokenStart+i&&this.error(`Integer is expected`,this.tokenStart+i),X.call(this,a-this.tokenStart,rn),t=this.substring(e,a),a+1===this.tokenEnd?(this.next(),n=ln.call(this)):(X.call(this,a-this.tokenStart+1,Y),a+2===this.tokenEnd?(this.next(),this.skipSC(),cn.call(this,an),n=`-`+this.consume(10)):(sn.call(this,a-this.tokenStart+2,an),this.next(),n=this.substrToCursor(a+1)))}else this.error();return t!==null&&t.charCodeAt(0)===J&&(t=t.substr(1)),n!==null&&n.charCodeAt(0)===J&&(n=n.substr(1)),{type:`AnPlusB`,loc:this.getLocation(e,this.tokenStart),a:t,b:n}}function pn(e){if(e.a){let t=e.a===`+1`&&`n`||e.a===`1`&&`n`||e.a===`-1`&&`-n`||e.a+`n`;if(e.b){let n=e.b[0]===`-`||e.b[0]===`+`?e.b:`+`+e.b;this.tokenize(t+n)}else this.tokenize(t)}else this.tokenize(e.b)}var mn=e({generate:()=>xn,name:()=>_n,parse:()=>bn,structure:()=>yn,walkContext:()=>vn});function hn(){return this.Raw(this.consumeUntilLeftCurlyBracketOrSemicolon,!0)}function gn(){for(let e=1,t;t=this.lookupType(e);e++){if(t===24)return!0;if(t===23||t===3)return!1}return!1}var _n=`Atrule`,vn=`atrule`,yn={name:String,prelude:[`AtrulePrelude`,`Raw`,null],block:[`Block`,null]};function bn(e=!1){let t=this.tokenStart,n,r,i=null,a=null;switch(this.eat(3),n=this.substrToCursor(t+1),r=n.toLowerCase(),this.skipSC(),this.eof===!1&&this.tokenType!==23&&this.tokenType!==17&&(i=this.parseAtrulePrelude?this.parseWithFallback(this.AtrulePrelude.bind(this,n,e),hn):hn.call(this,this.tokenIndex),this.skipSC()),this.tokenType){case 17:this.next();break;case 23:a=hasOwnProperty.call(this.atrule,r)&&typeof this.atrule[r].block==`function`?this.atrule[r].block.call(this,e):this.Block(gn.call(this))}return{type:`Atrule`,loc:this.getLocation(t,this.tokenStart),name:n,prelude:i,block:a}}function xn(e){this.token(3,`@`+e.name),e.prelude!==null&&this.node(e.prelude),e.block?this.node(e.block):this.token(17,`;`)}var Sn=e({generate:()=>Dn,name:()=>Cn,parse:()=>En,structure:()=>Tn,walkContext:()=>wn}),Cn=`AtrulePrelude`,wn=`atrulePrelude`,Tn={children:[[]]};function En(e){let t=null;return e!==null&&(e=e.toLowerCase()),this.skipSC(),t=hasOwnProperty.call(this.atrule,e)&&typeof this.atrule[e].prelude==`function`?this.atrule[e].prelude.call(this):this.readSequence(this.scope.AtrulePrelude),this.skipSC(),this.eof!==!0&&this.tokenType!==23&&this.tokenType!==17&&this.error(`Semicolon or block is expected`),{type:`AtrulePrelude`,loc:this.getLocationFromList(t),children:t}}function Dn(e){this.children(e)}var On=e({generate:()=>Bn,name:()=>Ln,parse:()=>zn,structure:()=>Rn}),kn=36,An=42,jn=61,Mn=94,Nn=124,Pn=126;function Fn(){this.eof&&this.error(`Unexpected end of input`);let e=this.tokenStart,t=!1;return this.isDelim(An)?(t=!0,this.next()):this.isDelim(Nn)||this.eat(1),this.isDelim(Nn)?this.charCodeAt(this.tokenStart+1)===jn?t&&this.error(`Identifier is expected`,this.tokenEnd):(this.next(),this.eat(1)):t&&this.error(`Vertical line is expected`),{type:`Identifier`,loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function In(){let e=this.tokenStart,t=this.charCodeAt(e);return t!==jn&&t!==Pn&&t!==Mn&&t!==kn&&t!==An&&t!==Nn&&this.error(`Attribute selector (=, ~=, ^=, $=, *=, |=) is expected`),this.next(),t!==jn&&(this.isDelim(jn)||this.error(`Equal sign is expected`),this.next()),this.substrToCursor(e)}var Ln=`AttributeSelector`,Rn={name:`Identifier`,matcher:[String,null],value:[`String`,`Identifier`,null],flags:[String,null]};function zn(){let e=this.tokenStart,t,n=null,r=null,i=null;return this.eat(19),this.skipSC(),t=Fn.call(this),this.skipSC(),this.tokenType!==20&&(this.tokenType!==1&&(n=In.call(this),this.skipSC(),r=this.tokenType===5?this.String():this.Identifier(),this.skipSC()),this.tokenType===1&&(i=this.consume(1),this.skipSC())),this.eat(20),{type:`AttributeSelector`,loc:this.getLocation(e,this.tokenStart),name:t,matcher:n,value:r,flags:i}}function Bn(e){this.token(9,`[`),this.node(e.name),e.matcher!==null&&(this.tokenize(e.matcher),this.node(e.value)),e.flags!==null&&this.token(1,e.flags),this.token(9,`]`)}var Vn=e({generate:()=>Zn,name:()=>qn,parse:()=>Xn,structure:()=>Yn,walkContext:()=>Jn}),Hn=38;function Un(){return this.Raw(null,!0)}function Wn(){return this.parseWithFallback(this.Rule,Un)}function Gn(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}function Kn(){if(this.tokenType===17)return Gn.call(this,this.tokenIndex);let e=this.parseWithFallback(this.Declaration,Gn);return this.tokenType===17&&this.next(),e}var qn=`Block`,Jn=`block`,Yn={children:[[`Atrule`,`Rule`,`Declaration`]]};function Xn(e){let t=e?Kn:Wn,n=this.tokenStart,r=this.createList();this.eat(23);scan:for(;!this.eof;)switch(this.tokenType){case 24:break scan;case 13:case 25:this.next();break;case 3:r.push(this.parseWithFallback(this.Atrule.bind(this,e),Un));break;default:e&&this.isDelim(Hn)?r.push(Wn.call(this)):r.push(t.call(this))}return this.eof||this.eat(24),{type:`Block`,loc:this.getLocation(n,this.tokenStart),children:r}}function Zn(e){this.token(23,`{`),this.children(e,e=>{e.type===`Declaration`&&this.token(17,`;`)}),this.token(24,`}`)}var Qn=e({generate:()=>nr,name:()=>$n,parse:()=>tr,structure:()=>er}),$n=`Brackets`,er={children:[[]]};function tr(e,t){let n=this.tokenStart,r=null;return this.eat(19),r=e.call(this,t),this.eof||this.eat(20),{type:`Brackets`,loc:this.getLocation(n,this.tokenStart),children:r}}function nr(e){this.token(9,`[`),this.children(e),this.token(9,`]`)}var rr=e({generate:()=>or,name:()=>`CDC`,parse:()=>ar,structure:()=>ir}),ir=[];function ar(){let e=this.tokenStart;return this.eat(15),{type:`CDC`,loc:this.getLocation(e,this.tokenStart)}}function or(){this.token(15,`-->`)}var sr=e({generate:()=>ur,name:()=>`CDO`,parse:()=>lr,structure:()=>cr}),cr=[];function lr(){let e=this.tokenStart;return this.eat(14),{type:`CDO`,loc:this.getLocation(e,this.tokenStart)}}function ur(){this.token(14,`<!--`)}var dr=e({generate:()=>gr,name:()=>pr,parse:()=>hr,structure:()=>mr}),fr=46,pr=`ClassSelector`,mr={name:String};function hr(){return this.eatDelim(fr),{type:`ClassSelector`,loc:this.getLocation(this.tokenStart-1,this.tokenEnd),name:this.consume(1)}}function gr(e){this.token(9,`.`),this.token(1,e.name)}var _r=e({generate:()=>Tr,name:()=>Sr,parse:()=>wr,structure:()=>Cr}),vr=43,yr=47,br=62,xr=126,Sr=`Combinator`,Cr={name:String};function wr(){let e=this.tokenStart,t;switch(this.tokenType){case 13:t=` `;break;case 9:switch(this.charCodeAt(this.tokenStart)){case br:case vr:case xr:this.next();break;case yr:this.next(),this.eatIdent(`deep`),this.eatDelim(yr);break;default:this.error(`Combinator is expected`)}t=this.substrToCursor(e)}return{type:`Combinator`,loc:this.getLocation(e,this.tokenStart),name:t}}function Tr(e){this.tokenize(e.name)}var Er=e({generate:()=>Mr,name:()=>kr,parse:()=>jr,structure:()=>Ar}),Dr=42,Or=47,kr=`Comment`,Ar={value:String};function jr(){let e=this.tokenStart,t=this.tokenEnd;return this.eat(25),t-e+2>=2&&this.charCodeAt(t-2)===Dr&&this.charCodeAt(t-1)===Or&&(t-=2),{type:`Comment`,loc:this.getLocation(e,this.tokenStart),value:this.substring(e+2,t)}}function Mr(e){this.token(25,`/*`+e.value+`*/`)}var Nr=e({generate:()=>Br,name:()=>Fr,parse:()=>zr,structure:()=>Ir}),Pr=new Set([16,22,0]),Fr=`Condition`,Ir={kind:String,children:[[`Identifier`,`Feature`,`FeatureFunction`,`FeatureRange`,`SupportsDeclaration`]]};function Lr(e){return this.lookupTypeNonSC(1)===1&&Pr.has(this.lookupTypeNonSC(2))?this.Feature(e):this.FeatureRange(e)}var Rr={media:Lr,container:Lr,supports(){return this.SupportsDeclaration()}};function zr(e=`media`){let t=this.createList();scan:for(;!this.eof;)switch(this.tokenType){case 25:case 13:this.next();continue;case 1:t.push(this.Identifier());break;case 21:{let n=this.parseWithFallback(()=>Rr[e].call(this,e),()=>null);n||=this.parseWithFallback(()=>{this.eat(21);let t=this.Condition(e);return this.eat(22),t},()=>this.GeneralEnclosed(e)),t.push(n);break}case 2:{let n=this.parseWithFallback(()=>this.FeatureFunction(e),()=>null);n||=this.GeneralEnclosed(e),t.push(n);break}default:break scan}return t.isEmpty&&this.error(`Condition is expected`),{type:`Condition`,loc:this.getLocationFromList(t),kind:e,children:t}}function Br(e){e.children.forEach(e=>{e.type===`Condition`?(this.token(21,`(`),this.node(e),this.token(22,`)`)):this.node(e)})}var Vr=45;function Hr(e,t){return t||=0,e.length-t>=2&&e.charCodeAt(t)===Vr&&e.charCodeAt(t+1)===Vr}var Ur=e({generate:()=>ii,name:()=>ei,parse:()=>ri,structure:()=>ni,walkContext:()=>ti}),Wr=33,Gr=35,Kr=36,qr=38,Jr=42,Yr=43,Xr=47;function Zr(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!0)}function Qr(){return this.Raw(this.consumeUntilExclamationMarkOrSemicolon,!1)}function $r(){let e=this.tokenIndex,t=this.Value();return t.type!==`Raw`&&this.eof===!1&&this.tokenType!==17&&this.isDelim(Wr)===!1&&this.isBalanceEdge(e)===!1&&this.error(),t}var ei=`Declaration`,ti=`declaration`,ni={important:[Boolean,String],property:String,value:[`Value`,`Raw`]};function ri(){let e=this.tokenStart,t=this.tokenIndex,n=ai.call(this),r=Hr(n),i=r?this.parseCustomProperty:this.parseValue,a=r?Qr:Zr,o=!1,s;this.skipSC(),this.eat(16);let c=this.tokenIndex;if(r||this.skipSC(),s=i?this.parseWithFallback($r,a):a.call(this,this.tokenIndex),r&&s.type===`Value`&&s.children.isEmpty){for(let e=c-this.tokenIndex;e<=0;e++)if(this.lookupType(e)===13){s.children.appendData({type:`WhiteSpace`,loc:null,value:` `});break}}return this.isDelim(Wr)&&(o=oi.call(this),this.skipSC()),this.eof===!1&&this.tokenType!==17&&this.isBalanceEdge(t)===!1&&this.error(),{type:`Declaration`,loc:this.getLocation(e,this.tokenStart),important:o,property:n,value:s}}function ii(e){this.token(1,e.property),this.token(16,`:`),this.node(e.value),e.important&&(this.token(9,`!`),this.token(1,e.important===!0?`important`:e.important))}function ai(){let e=this.tokenStart;if(this.tokenType===9)switch(this.charCodeAt(this.tokenStart)){case Jr:case Kr:case Yr:case Gr:case qr:this.next();break;case Xr:this.next(),this.isDelim(Xr)&&this.next()}return this.tokenType===4?this.eat(4):this.eat(1),this.substrToCursor(e)}function oi(){this.eat(9),this.skipSC();let e=this.consume(1);return e===`important`||e}var si=e({generate:()=>pi,name:()=>ui,parse:()=>fi,structure:()=>di}),ci=38;function li(){return this.Raw(this.consumeUntilSemicolonIncluded,!0)}var ui=`DeclarationList`,di={children:[[`Declaration`,`Atrule`,`Rule`]]};function fi(){let e=this.createList();scan:for(;!this.eof;)switch(this.tokenType){case 13:case 25:case 17:this.next();break;case 3:e.push(this.parseWithFallback(this.Atrule.bind(this,!0),li));break;default:this.isDelim(ci)?e.push(this.parseWithFallback(this.Rule,li)):e.push(this.parseWithFallback(this.Declaration,li))}return{type:`DeclarationList`,loc:this.getLocationFromList(e),children:e}}function pi(e){this.children(e,e=>{e.type===`Declaration`&&this.token(17,`;`)})}var mi=e({generate:()=>vi,name:()=>hi,parse:()=>_i,structure:()=>gi}),hi=`Dimension`,gi={value:String,unit:String};function _i(){let e=this.tokenStart,t=this.consumeNumber(12);return{type:`Dimension`,loc:this.getLocation(e,this.tokenStart),value:t,unit:this.substring(e+t.length,this.tokenStart)}}function vi(e){this.token(12,e.value+e.unit)}var yi=e({generate:()=>wi,name:()=>xi,parse:()=>Ci,structure:()=>Si}),bi=47,xi=`Feature`,Si={kind:String,name:String,value:[`Identifier`,`Number`,`Dimension`,`Ratio`,`Function`,null]};function Ci(e){let t=this.tokenStart,n,r=null;if(this.eat(21),this.skipSC(),n=this.consume(1),this.skipSC(),this.tokenType!==22){switch(this.eat(16),this.skipSC(),this.tokenType){case 10:r=this.lookupNonWSType(1)===9?this.Ratio():this.Number();break;case 12:r=this.Dimension();break;case 1:r=this.Identifier();break;case 2:r=this.parseWithFallback(()=>{let e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(bi)&&this.error(),e},()=>this.Ratio());break;default:this.error(`Number, dimension, ratio or identifier is expected`)}this.skipSC()}return this.eof||this.eat(22),{type:`Feature`,loc:this.getLocation(t,this.tokenStart),kind:e,name:n,value:r}}function wi(e){this.token(21,`(`),this.token(1,e.name),e.value!==null&&(this.token(16,`:`),this.node(e.value)),this.token(22,`)`)}var Ti=e({generate:()=>Ai,name:()=>Ei,parse:()=>ki,structure:()=>Di}),Ei=`FeatureFunction`,Di={kind:String,feature:String,value:[`Declaration`,`Selector`]};function Oi(e,t){let n=(this.features[e]||{})[t];return typeof n!=`function`&&this.error(`Unknown feature ${t}()`),n}function ki(e=`unknown`){let t=this.tokenStart,n=this.consumeFunctionName(),r=Oi.call(this,e,n.toLowerCase());this.skipSC();let i=this.parseWithFallback(()=>{let e=this.tokenIndex,t=r.call(this);return this.eof===!1&&this.isBalanceEdge(e)===!1&&this.error(),t},()=>this.Raw(null,!1));return this.eof||this.eat(22),{type:`FeatureFunction`,loc:this.getLocation(t,this.tokenStart),kind:e,feature:n,value:i}}function Ai(e){this.token(2,e.feature+`(`),this.node(e.value),this.token(22,`)`)}var ji=e({generate:()=>Vi,name:()=>Ii,parse:()=>Bi,structure:()=>Li}),Mi=47,Ni=60,Pi=61,Fi=62,Ii=`FeatureRange`,Li={kind:String,left:[`Identifier`,`Number`,`Dimension`,`Ratio`,`Function`],leftComparison:String,middle:[`Identifier`,`Number`,`Dimension`,`Ratio`,`Function`],rightComparison:[String,null],right:[`Identifier`,`Number`,`Dimension`,`Ratio`,`Function`,null]};function Ri(){switch(this.skipSC(),this.tokenType){case 10:return this.isDelim(Mi,this.lookupOffsetNonSC(1))?this.Ratio():this.Number();case 12:return this.Dimension();case 1:return this.Identifier();case 2:return this.parseWithFallback(()=>{let e=this.Function(this.readSequence,this.scope.Value);return this.skipSC(),this.isDelim(Mi)&&this.error(),e},()=>this.Ratio());default:this.error(`Number, dimension, ratio or identifier is expected`)}}function zi(e){if(this.skipSC(),this.isDelim(Ni)||this.isDelim(Fi)){let e=this.source[this.tokenStart];return this.next(),this.isDelim(Pi)?(this.next(),e+`=`):e}if(this.isDelim(Pi))return`=`;this.error(`Expected ${e?`":", `:``}"<", ">", "=" or ")"`)}function Bi(e=`unknown`){let t=this.tokenStart;this.skipSC(),this.eat(21);let n=Ri.call(this),r=zi.call(this,n.type===`Identifier`),i=Ri.call(this),a=null,o=null;return this.lookupNonWSType(0)!==22&&(a=zi.call(this),o=Ri.call(this)),this.skipSC(),this.eat(22),{type:`FeatureRange`,loc:this.getLocation(t,this.tokenStart),kind:e,left:n,leftComparison:r,middle:i,rightComparison:a,right:o}}function Vi(e){this.token(21,`(`),this.node(e.left),this.tokenize(e.leftComparison),this.node(e.middle),e.right&&(this.tokenize(e.rightComparison),this.node(e.right)),this.token(22,`)`)}var Hi=e({generate:()=>qi,name:()=>Ui,parse:()=>Ki,structure:()=>Gi,walkContext:()=>Wi}),Ui=`Function`,Wi=`function`,Gi={name:String,children:[[]]};function Ki(e,t){let n=this.tokenStart,r=this.consumeFunctionName(),i=r.toLowerCase(),a;return a=t.hasOwnProperty(i)?t[i].call(this,t):e.call(this,t),this.eof||this.eat(22),{type:`Function`,loc:this.getLocation(n,this.tokenStart),name:r,children:a}}function qi(e){this.token(2,e.name+`(`),this.children(e),this.token(22,`)`)}var Ji=e({generate:()=>Qi,name:()=>Yi,parse:()=>Zi,structure:()=>Xi}),Yi=`GeneralEnclosed`,Xi={kind:String,function:[String,null],children:[[]]};function Zi(e){let t=this.tokenStart,n=null;this.tokenType===2?n=this.consumeFunctionName():this.eat(21);let r=this.parseWithFallback(()=>{let e=this.tokenIndex,t=this.readSequence(this.scope.Value);return this.eof===!1&&this.isBalanceEdge(e)===!1&&this.error(),t},()=>this.createSingleNodeList(this.Raw(null,!1)));return this.eof||this.eat(22),{type:`GeneralEnclosed`,loc:this.getLocation(t,this.tokenStart),kind:e,function:n,children:r}}function Qi(e){e.function?this.token(2,e.function+`(`):this.token(21,`(`),this.children(e),this.token(22,`)`)}var $i=e({generate:()=>ra,name:()=>ea,parse:()=>na,structure:()=>ta,xxx:()=>`XXX`}),ea=`Hash`,ta={value:String};function na(){let e=this.tokenStart;return this.eat(4),{type:`Hash`,loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e+1)}}function ra(e){this.token(4,`#`+e.value)}var ia=e({generate:()=>ca,name:()=>aa,parse:()=>sa,structure:()=>oa}),aa=`Identifier`,oa={name:String};function sa(){return{type:`Identifier`,loc:this.getLocation(this.tokenStart,this.tokenEnd),name:this.consume(1)}}function ca(e){this.token(1,e.name)}var la=e({generate:()=>pa,name:()=>ua,parse:()=>fa,structure:()=>da}),ua=`IdSelector`,da={name:String};function fa(){let e=this.tokenStart;return this.eat(4),{type:`IdSelector`,loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e+1)}}function pa(e){this.token(9,`#`+e.name)}var ma=e({generate:()=>ya,name:()=>ga,parse:()=>va,structure:()=>_a}),ha=46,ga=`Layer`,_a={name:String};function va(){let e=this.tokenStart,t=this.consume(1);for(;this.isDelim(ha);)this.eat(9),t+=`.`+this.consume(1);return{type:`Layer`,loc:this.getLocation(e,this.tokenStart),name:t}}function ya(e){this.tokenize(e.name)}var ba=e({generate:()=>wa,name:()=>xa,parse:()=>Ca,structure:()=>Sa}),xa=`LayerList`,Sa={children:[[`Layer`]]};function Ca(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.Layer()),this.lookupTypeNonSC(0)===18);)this.skipSC(),this.next(),this.skipSC();return{type:`LayerList`,loc:this.getLocationFromList(e),children:e}}function wa(e){this.children(e,()=>this.token(18,`,`))}var Ta=e({generate:()=>ka,name:()=>Ea,parse:()=>Oa,structure:()=>Da}),Ea=`MediaQuery`,Da={modifier:[String,null],mediaType:[String,null],condition:[`Condition`,null]};function Oa(){let e=this.tokenStart,t=null,n=null,r=null;if(this.skipSC(),this.tokenType===1&&this.lookupTypeNonSC(1)!==21){let e=this.consume(1),i=e.toLowerCase();switch(i===`not`||i===`only`?(this.skipSC(),t=i,n=this.consume(1)):n=e,this.lookupTypeNonSC(0)){case 1:this.skipSC(),this.eatIdent(`and`),r=this.Condition(`media`);break;case 23:case 17:case 18:case 0:break;default:this.error(`Identifier or parenthesis is expected`)}}else switch(this.tokenType){case 1:case 21:case 2:r=this.Condition(`media`);break;case 23:case 17:case 0:break;default:this.error(`Identifier or parenthesis is expected`)}return{type:`MediaQuery`,loc:this.getLocation(e,this.tokenStart),modifier:t,mediaType:n,condition:r}}function ka(e){e.mediaType?(e.modifier&&this.token(1,e.modifier),this.token(1,e.mediaType),e.condition&&(this.token(1,`and`),this.node(e.condition))):e.condition&&this.node(e.condition)}var Aa=e({generate:()=>Pa,name:()=>ja,parse:()=>Na,structure:()=>Ma}),ja=`MediaQueryList`,Ma={children:[[`MediaQuery`]]};function Na(){let e=this.createList();for(this.skipSC();!this.eof&&(e.push(this.MediaQuery()),this.tokenType===18);)this.next();return{type:`MediaQueryList`,loc:this.getLocationFromList(e),children:e}}function Pa(e){this.children(e,()=>this.token(18,`,`))}var Fa=e({generate:()=>Ba,name:()=>La,parse:()=>za,structure:()=>Ra}),Ia=38,La=`NestingSelector`,Ra={};function za(){let e=this.tokenStart;return this.eatDelim(Ia),{type:`NestingSelector`,loc:this.getLocation(e,this.tokenStart)}}function Ba(){this.token(9,`&`)}var Va=e({generate:()=>Wa,name:()=>`Nth`,parse:()=>Ua,structure:()=>Ha}),Ha={nth:[`AnPlusB`,`Identifier`],selector:[`SelectorList`,null]};function Ua(){this.skipSC();let e=this.tokenStart,t=e,n=null,r;return r=this.lookupValue(0,`odd`)||this.lookupValue(0,`even`)?this.Identifier():this.AnPlusB(),t=this.tokenStart,this.skipSC(),this.lookupValue(0,`of`)&&(this.next(),n=this.SelectorList(),t=this.tokenStart),{type:`Nth`,loc:this.getLocation(e,t),nth:r,selector:n}}function Wa(e){this.node(e.nth),e.selector!==null&&(this.token(1,`of`),this.node(e.selector))}var Ga=e({generate:()=>Ya,name:()=>Ka,parse:()=>Ja,structure:()=>qa}),Ka=`Number`,qa={value:String};function Ja(){return{type:`Number`,loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consume(10)}}function Ya(e){this.token(10,e.value)}var Xa=e({generate:()=>eo,name:()=>Za,parse:()=>$a,structure:()=>Qa}),Za=`Operator`,Qa={value:String};function $a(){let e=this.tokenStart;return this.next(),{type:`Operator`,loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function eo(e){this.tokenize(e.value)}var to=e({generate:()=>ao,name:()=>no,parse:()=>io,structure:()=>ro}),no=`Parentheses`,ro={children:[[]]};function io(e,t){let n=this.tokenStart,r=null;return this.eat(21),r=e.call(this,t),this.eof||this.eat(22),{type:`Parentheses`,loc:this.getLocation(n,this.tokenStart),children:r}}function ao(e){this.token(21,`(`),this.children(e),this.token(22,`)`)}var oo=e({generate:()=>uo,name:()=>so,parse:()=>lo,structure:()=>co}),so=`Percentage`,co={value:String};function lo(){return{type:`Percentage`,loc:this.getLocation(this.tokenStart,this.tokenEnd),value:this.consumeNumber(11)}}function uo(e){this.token(11,e.value+`%`)}var fo=e({generate:()=>_o,name:()=>po,parse:()=>go,structure:()=>ho,walkContext:()=>mo}),po=`PseudoClassSelector`,mo=`function`,ho={name:String,children:[[`Raw`],null]};function go(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:`PseudoClassSelector`,loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function _o(e){this.token(16,`:`),e.children===null?this.token(1,e.name):(this.token(2,e.name+`(`),this.children(e),this.token(22,`)`))}var vo=e({generate:()=>Co,name:()=>yo,parse:()=>So,structure:()=>xo,walkContext:()=>bo}),yo=`PseudoElementSelector`,bo=`function`,xo={name:String,children:[[`Raw`],null]};function So(){let e=this.tokenStart,t=null,n,r;return this.eat(16),this.eat(16),this.tokenType===2?(n=this.consumeFunctionName(),r=n.toLowerCase(),this.lookupNonWSType(0)==22?t=this.createList():hasOwnProperty.call(this.pseudo,r)?(this.skipSC(),t=this.pseudo[r].call(this),this.skipSC()):(t=this.createList(),t.push(this.Raw(null,!1))),this.eat(22)):n=this.consume(1),{type:`PseudoElementSelector`,loc:this.getLocation(e,this.tokenStart),name:n,children:t}}function Co(e){this.token(16,`:`),this.token(16,`:`),e.children===null?this.token(1,e.name):(this.token(2,e.name+`(`),this.children(e),this.token(22,`)`))}var wo=e({generate:()=>Ao,name:()=>Do,parse:()=>ko,structure:()=>Oo}),To=47;function Eo(){switch(this.skipSC(),this.tokenType){case 10:return this.Number();case 2:return this.Function(this.readSequence,this.scope.Value);default:this.error(`Number of function is expected`)}}var Do=`Ratio`,Oo={left:[`Number`,`Function`],right:[`Number`,`Function`,null]};function ko(){let e=this.tokenStart,t=Eo.call(this),n=null;return this.skipSC(),this.isDelim(To)&&(this.eatDelim(To),n=Eo.call(this)),{type:`Ratio`,loc:this.getLocation(e,this.tokenStart),left:t,right:n}}function Ao(e){this.node(e.left),this.token(9,`/`),e.right?this.node(e.right):this.node(10,1)}var jo=e({generate:()=>Fo,name:()=>`Raw`,parse:()=>Po,structure:()=>No});function Mo(){return this.tokenIndex>0&&this.lookupType(-1)===13?this.tokenIndex>1?this.getTokenStart(this.tokenIndex-1):this.firstCharOffset:this.tokenStart}var No={value:String};function Po(e,t){let n=this.getTokenStart(this.tokenIndex),r;return this.skipUntilBalanced(this.tokenIndex,e||this.consumeUntilBalanceEnd),r=t&&this.tokenStart>n?Mo.call(this):this.tokenStart,{type:`Raw`,loc:this.getLocation(n,r),value:this.substring(n,r)}}function Fo(e){this.tokenize(e.value)}var Io=e({generate:()=>Uo,name:()=>zo,parse:()=>Ho,structure:()=>Vo,walkContext:()=>Bo});function Lo(){return this.Raw(this.consumeUntilLeftCurlyBracket,!0)}function Ro(){let e=this.SelectorList();return e.type!==`Raw`&&this.eof===!1&&this.tokenType!==23&&this.error(),e}var zo=`Rule`,Bo=`rule`,Vo={prelude:[`SelectorList`,`Raw`],block:[`Block`]};function Ho(){let e=this.tokenIndex,t=this.tokenStart,n,r;return n=this.parseRulePrelude?this.parseWithFallback(Ro,Lo):Lo.call(this,e),r=this.Block(!0),{type:`Rule`,loc:this.getLocation(t,this.tokenStart),prelude:n,block:r}}function Uo(e){this.node(e.prelude),this.node(e.block)}var Wo=e({generate:()=>Jo,name:()=>Go,parse:()=>qo,structure:()=>Ko}),Go=`Scope`,Ko={root:[`SelectorList`,`Raw`,null],limit:[`SelectorList`,`Raw`,null]};function qo(){let e=null,t=null;this.skipSC();let n=this.tokenStart;return this.tokenType===21&&(this.next(),this.skipSC(),e=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),this.lookupNonWSType(0)===1&&(this.skipSC(),this.eatIdent(`to`),this.skipSC(),this.eat(21),this.skipSC(),t=this.parseWithFallback(this.SelectorList,()=>this.Raw(!1,!0)),this.skipSC(),this.eat(22)),{type:`Scope`,loc:this.getLocation(n,this.tokenStart),root:e,limit:t}}function Jo(e){e.root&&(this.token(21,`(`),this.node(e.root),this.token(22,`)`)),e.limit&&(this.token(1,`to`),this.token(21,`(`),this.node(e.limit),this.token(22,`)`))}var Yo=e({generate:()=>$o,name:()=>Xo,parse:()=>Qo,structure:()=>Zo}),Xo=`Selector`,Zo={children:[[`TypeSelector`,`IdSelector`,`ClassSelector`,`AttributeSelector`,`PseudoClassSelector`,`PseudoElementSelector`,`Combinator`]]};function Qo(){let e=this.readSequence(this.scope.Selector);return this.getFirstListNode(e)===null&&this.error(`Selector is expected`),{type:`Selector`,loc:this.getLocationFromList(e),children:e}}function $o(e){this.children(e)}var es=e({generate:()=>as,name:()=>ts,parse:()=>is,structure:()=>rs,walkContext:()=>ns}),ts=`SelectorList`,ns=`selector`,rs={children:[[`Selector`,`Raw`]]};function is(){let e=this.createList();for(;!this.eof&&(e.push(this.Selector()),this.tokenType===18);)this.next();return{type:`SelectorList`,loc:this.getLocationFromList(e),children:e}}function as(e){this.children(e,()=>this.token(18,`,`))}var os=92,ss=34,cs=39;function ls(e){let t=e.length,n=e.charCodeAt(0),r=+(n===ss||n===cs),i=r===1&&t>1&&e.charCodeAt(t-1)===n?t-2:t-1,a=``;for(let n=r;n<=i;n++){let r=e.charCodeAt(n);if(r===os){if(n===i){n!==t-1&&(a=e.substr(n+1));break}if(r=e.charCodeAt(++n),U(os,r)){let t=n-1,r=Ve(e,t);n=r-1,a+=Ge(e.substring(t+1,r))}else r===13&&e.charCodeAt(n+1)===10&&n++}else a+=e[n]}return a}function us(e,t){let n=t?`'`:`"`,r=t?cs:ss,i=``,a=!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);n===0?i+=`�`:n<=31||n===127?(i+=`\\`+n.toString(16),a=!0):n===r||n===os?(i+=`\\`+e.charAt(t),a=!1):(a&&(z(n)||H(n))&&(i+=` `),i+=e.charAt(t),a=!1)}return n+i+n}var ds=e({generate:()=>hs,name:()=>fs,parse:()=>ms,structure:()=>ps}),fs=`String`,ps={value:String};function ms(){return{type:`String`,loc:this.getLocation(this.tokenStart,this.tokenEnd),value:ls(this.consume(5))}}function hs(e){this.token(5,us(e.value))}var gs=e({generate:()=>Cs,name:()=>ys,parse:()=>Ss,structure:()=>xs,walkContext:()=>bs}),_s=33;function vs(){return this.Raw(null,!1)}var ys=`StyleSheet`,bs=`stylesheet`,xs={children:[[`Comment`,`CDO`,`CDC`,`Atrule`,`Rule`,`Raw`]]};function Ss(){let e=this.tokenStart,t=this.createList(),n;scan:for(;!this.eof;){switch(this.tokenType){case 13:this.next();continue;case 25:if(this.charCodeAt(this.tokenStart+2)!==_s){this.next();continue}n=this.Comment();break;case 14:n=this.CDO();break;case 15:n=this.CDC();break;case 3:n=this.parseWithFallback(this.Atrule,vs);break;default:n=this.parseWithFallback(this.Rule,vs)}t.push(n)}return{type:`StyleSheet`,loc:this.getLocation(e,this.tokenStart),children:t}}function Cs(e){this.children(e)}var ws=e({generate:()=>Os,name:()=>Ts,parse:()=>Ds,structure:()=>Es}),Ts=`SupportsDeclaration`,Es={declaration:`Declaration`};function Ds(){let e=this.tokenStart;this.eat(21),this.skipSC();let t=this.Declaration();return this.eof||this.eat(22),{type:`SupportsDeclaration`,loc:this.getLocation(e,this.tokenStart),declaration:t}}function Os(e){this.token(21,`(`),this.node(e.declaration),this.token(22,`)`)}var ks=e({generate:()=>Is,name:()=>Ns,parse:()=>Fs,structure:()=>Ps}),As=42,js=124;function Ms(){this.tokenType!==1&&this.isDelim(As)===!1&&this.error(`Identifier or asterisk is expected`),this.next()}var Ns=`TypeSelector`,Ps={name:String};function Fs(){let e=this.tokenStart;return this.isDelim(js)?(this.next(),Ms.call(this)):(Ms.call(this),this.isDelim(js)&&(this.next(),Ms.call(this))),{type:`TypeSelector`,loc:this.getLocation(e,this.tokenStart),name:this.substrToCursor(e)}}function Is(e){this.tokenize(e.name)}var Ls=e({generate:()=>Js,name:()=>Gs,parse:()=>qs,structure:()=>Ks}),Rs=43,zs=45,Bs=63;function Vs(e,t){let n=0;for(let r=this.tokenStart+e;r<this.tokenEnd;r++){let i=this.charCodeAt(r);if(i===zs&&t&&n!==0)return Vs.call(this,e+n+1,!1),-1;z(i)||this.error(t&&n!==0?`Hyphen minus`+(n<6?` or hex digit`:``)+` is expected`:n<6?`Hex digit is expected`:`Unexpected input`,r),++n>6&&this.error(`Too many hex digits`,r)}return this.next(),n}function Hs(e){let t=0;for(;this.isDelim(Bs);)++t>e&&this.error(`Too many question marks`),this.next()}function Us(e){this.charCodeAt(this.tokenStart)!==e&&this.error((e===Rs?`Plus sign`:`Hyphen minus`)+` is expected`)}function Ws(){let e=0;switch(this.tokenType){case 10:if(e=Vs.call(this,1,!0),this.isDelim(Bs)){Hs.call(this,6-e);break}if(this.tokenType===12||this.tokenType===10){Us.call(this,zs),Vs.call(this,1,!1);break}break;case 12:e=Vs.call(this,1,!0),e>0&&Hs.call(this,6-e);break;default:if(this.eatDelim(Rs),this.tokenType===1){e=Vs.call(this,0,!0),e>0&&Hs.call(this,6-e);break}if(this.isDelim(Bs)){this.next(),Hs.call(this,5);break}this.error(`Hex digit or question mark is expected`)}}var Gs=`UnicodeRange`,Ks={value:String};function qs(){let e=this.tokenStart;return this.eatIdent(`u`),Ws.call(this),{type:`UnicodeRange`,loc:this.getLocation(e,this.tokenStart),value:this.substrToCursor(e)}}function Js(e){this.tokenize(e.value)}var Ys=32,Xs=92,Zs=34,Qs=39,$s=40,ec=41;function tc(e){let t=e.length,n=4,r=e.charCodeAt(t-1)===ec?t-2:t-1,i=``;for(;n<r&&H(e.charCodeAt(n));)n++;for(;n<r&&H(e.charCodeAt(r));)r--;for(let a=n;a<=r;a++){let n=e.charCodeAt(a);if(n===Xs){if(a===r){a!==t-1&&(i=e.substr(a+1));break}if(n=e.charCodeAt(++a),U(Xs,n)){let t=a-1,n=Ve(e,t);a=n-1,i+=Ge(e.substring(t+1,n))}else n===13&&e.charCodeAt(a+1)===10&&a++}else i+=e[a]}return i}function nc(e){let t=``,n=!1;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i===0?t+=`�`:i<=31||i===127?(t+=`\\`+i.toString(16),n=!0):i===Ys||i===Xs||i===Zs||i===Qs||i===$s||i===ec?(t+=`\\`+e.charAt(r),n=!1):(n&&z(i)&&(t+=` `),t+=e.charAt(r),n=!1)}return`url(`+t+`)`}var rc=e({generate:()=>oc,name:()=>`Url`,parse:()=>ac,structure:()=>ic}),ic={value:String};function ac(){let e=this.tokenStart,t;switch(this.tokenType){case 7:t=tc(this.consume(7));break;case 2:this.cmpStr(this.tokenStart,this.tokenEnd,`url(`)||this.error("Function name must be `url`"),this.eat(2),this.skipSC(),t=ls(this.consume(5)),this.skipSC(),this.eof||this.eat(22);break;default:this.error(`Url or Function is expected`)}return{type:`Url`,loc:this.getLocation(e,this.tokenStart),value:t}}function oc(e){this.token(7,nc(e.value))}var sc=e({generate:()=>dc,name:()=>cc,parse:()=>uc,structure:()=>lc}),cc=`Value`,lc={children:[[]]};function uc(){let e=this.tokenStart,t=this.readSequence(this.scope.Value);return{type:`Value`,loc:this.getLocation(e,this.tokenStart),children:t}}function dc(e){this.children(e)}var fc=e({generate:()=>_c,name:()=>mc,parse:()=>gc,structure:()=>hc}),pc=Object.freeze({type:`WhiteSpace`,loc:null,value:` `}),mc=`WhiteSpace`,hc={value:String};function gc(){return this.eat(13),pc}function _c(e){this.token(13,e.value)}var vc=_t({parseContext:{default:`StyleSheet`,stylesheet:`StyleSheet`,atrule:`Atrule`,atrulePrelude(e){return this.AtrulePrelude(e.atrule?String(e.atrule):null)},mediaQueryList:`MediaQueryList`,mediaQuery:`MediaQuery`,condition(e){return this.Condition(e.kind)},rule:`Rule`,selectorList:`SelectorList`,selector:`Selector`,block(){return this.Block(!0)},declarationList:`DeclarationList`,declaration:`Declaration`,value:`Value`},features:{supports:{selector(){return this.Selector()}},container:{style(){return this.Declaration()}}},scope:Ht,atrule:Jt,pseudo:tn,node:e({AnPlusB:()=>fn,Atrule:()=>bn,AtrulePrelude:()=>En,AttributeSelector:()=>zn,Block:()=>Xn,Brackets:()=>tr,CDC:()=>ar,CDO:()=>lr,ClassSelector:()=>hr,Combinator:()=>wr,Comment:()=>jr,Condition:()=>zr,Declaration:()=>ri,DeclarationList:()=>fi,Dimension:()=>_i,Feature:()=>Ci,FeatureFunction:()=>ki,FeatureRange:()=>Bi,Function:()=>Ki,GeneralEnclosed:()=>Zi,Hash:()=>na,IdSelector:()=>fa,Identifier:()=>sa,Layer:()=>va,LayerList:()=>Ca,MediaQuery:()=>Oa,MediaQueryList:()=>Na,NestingSelector:()=>za,Nth:()=>Ua,Number:()=>Ja,Operator:()=>$a,Parentheses:()=>io,Percentage:()=>lo,PseudoClassSelector:()=>go,PseudoElementSelector:()=>So,Ratio:()=>ko,Raw:()=>Po,Rule:()=>Ho,Scope:()=>qo,Selector:()=>Qo,SelectorList:()=>is,String:()=>ms,StyleSheet:()=>Ss,SupportsDeclaration:()=>Ds,TypeSelector:()=>Fs,UnicodeRange:()=>qs,Url:()=>ac,Value:()=>uc,WhiteSpace:()=>gc})}),{hasOwnProperty:yc}=Object.prototype,bc=function(){};function xc(e){return typeof e==`function`?e:bc}function Sc(e,t){return function(n,r,i){n.type===t&&e.call(this,n,r,i)}}function Cc(e,t){let n=t.structure,r=[];for(let e in n){if(yc.call(n,e)===!1)continue;let t=n[e],i={name:e,type:!1,nullable:!1};Array.isArray(t)||(t=[t]);for(let e of t)e===null?i.nullable=!0:typeof e==`string`?i.type=`node`:Array.isArray(e)&&(i.type=`list`);i.type&&r.push(i)}return r.length?{context:t.walkContext,fields:r}:null}function wc(e){let t={};for(let n in e.node)if(yc.call(e.node,n)){let r=e.node[n];if(!r.structure)throw Error("Missed `structure` field in `"+n+"` node type definition");t[n]=Cc(n,r)}return t}function Tc(e,t){let n=e.fields.slice(),r=e.context,i=typeof r==`string`;return t&&n.reverse(),function(e,a,o,s){let c;i&&(c=a[r],a[r]=e);for(let r of n){let n=e[r.name];if(!r.nullable||n){if(r.type===`list`){if(t?n.reduceRight(s,!1):n.reduce(s,!1))return!0}else if(o(n))return!0}}i&&(a[r]=c)}}function Ec({StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:i}){return{Atrule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Rule:{StyleSheet:e,Atrule:t,Rule:n,Block:r},Declaration:{StyleSheet:e,Atrule:t,Rule:n,Block:r,DeclarationList:i}}}function Dc(e){let t=wc(e),n={},r={},i=Symbol(`break-walk`),a=Symbol(`skip-node`);for(let e in t)yc.call(t,e)&&t[e]!==null&&(n[e]=Tc(t[e],!1),r[e]=Tc(t[e],!0));let o=Ec(n),s=Ec(r),c=function(e,c){function l(e,t,n){let r=u.call(m,e,t,n);return r===i||r!==a&&!!(f.hasOwnProperty(e.type)&&f[e.type](e,m,l,p)||d.call(m,e,t,n)===i)}let u=bc,d=bc,f=n,p=(e,t,n,r)=>e||l(t,n,r),m={break:i,skip:a,root:e,stylesheet:null,atrule:null,atrulePrelude:null,rule:null,selector:null,block:null,declaration:null,function:null};if(typeof c==`function`)u=c;else if(c&&(u=xc(c.enter),d=xc(c.leave),c.reverse&&(f=r),c.visit)){if(o.hasOwnProperty(c.visit))f=c.reverse?s[c.visit]:o[c.visit];else if(!t.hasOwnProperty(c.visit))throw Error("Bad value `"+c.visit+"` for `visit` option (should be: "+Object.keys(t).sort().join(`, `)+`)`);u=Sc(u,c.visit),d=Sc(d,c.visit)}if(u===bc&&d===bc)throw Error("Neither `enter` nor `leave` walker handler is set or both aren't a function");l(e)};return c.break=i,c.skip=a,c.find=function(e,t){let n=null;return c(e,function(e,r,a){if(t.call(this,e,r,a))return n=e,i}),n},c.findLast=function(e,t){let n=null;return c(e,{reverse:!0,enter(e,r,a){if(t.call(this,e,r,a))return n=e,i}}),n},c.findAll=function(e,t){let n=[];return c(e,function(e,r,i){t.call(this,e,r,i)&&n.push(e)}),n},c}var Oc=Dc({node:e({AnPlusB:()=>nn,Atrule:()=>mn,AtrulePrelude:()=>Sn,AttributeSelector:()=>On,Block:()=>Vn,Brackets:()=>Qn,CDC:()=>rr,CDO:()=>sr,ClassSelector:()=>dr,Combinator:()=>_r,Comment:()=>Er,Condition:()=>Nr,Declaration:()=>Ur,DeclarationList:()=>si,Dimension:()=>mi,Feature:()=>yi,FeatureFunction:()=>Ti,FeatureRange:()=>ji,Function:()=>Hi,GeneralEnclosed:()=>Ji,Hash:()=>$i,IdSelector:()=>la,Identifier:()=>ia,Layer:()=>ma,LayerList:()=>ba,MediaQuery:()=>Ta,MediaQueryList:()=>Aa,NestingSelector:()=>Fa,Nth:()=>Va,Number:()=>Ga,Operator:()=>Xa,Parentheses:()=>to,Percentage:()=>oo,PseudoClassSelector:()=>fo,PseudoElementSelector:()=>vo,Ratio:()=>wo,Raw:()=>jo,Rule:()=>Io,Scope:()=>Wo,Selector:()=>Yo,SelectorList:()=>es,String:()=>ds,StyleSheet:()=>gs,SupportsDeclaration:()=>ws,TypeSelector:()=>ks,UnicodeRange:()=>Ls,Url:()=>rc,Value:()=>sc,WhiteSpace:()=>fc})}),kc=n((e=>{var t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`.split(``);e.encode=function(e){if(0<=e&&e<t.length)return t[e];throw TypeError(`Must be between 0 and 63: `+e)},e.decode=function(e){var t=65,n=90,r=97,i=122,a=48;return t<=e&&e<=n?e-t:r<=e&&e<=i?e-r+26:a<=e&&e<=57?e-a+52:e==43?62:e==47?63:-1}})),Ac=n((e=>{var t=kc(),n=5,r=1<<n,i=r-1,a=r;function o(e){return e<0?(-e<<1)+1:(e<<1)+0}function s(e){var t=(e&1)==1,n=e>>1;return t?-n:n}e.encode=function(e){var r=``,s,c=o(e);do s=c&i,c>>>=n,c>0&&(s|=a),r+=t.encode(s);while(c>0);return r},e.decode=function(e,r,o){var c=e.length,l=0,u=0,d,f;do{if(r>=c)throw Error(`Expected more digits in base 64 VLQ value.`);if(f=t.decode(e.charCodeAt(r++)),f===-1)throw Error(`Invalid base64 digit: `+e.charAt(r-1));d=!!(f&a),f&=i,l+=f<<u,u+=n}while(d);o.value=s(l),o.rest=r}})),jc=n((e=>{function t(e,t,n){if(t in e)return e[t];if(arguments.length===3)return n;throw Error(`"`+t+`" is a required argument.`)}e.getArg=t;var n=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function i(e){var t=e.match(n);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}e.urlParse=i;function a(e){var t=``;return e.scheme&&(t+=e.scheme+`:`),t+=`//`,e.auth&&(t+=e.auth+`@`),e.host&&(t+=e.host),e.port&&(t+=`:`+e.port),e.path&&(t+=e.path),t}e.urlGenerate=a;var o=32;function s(e){var t=[];return function(n){for(var r=0;r<t.length;r++)if(t[r].input===n){var i=t[0];return t[0]=t[r],t[r]=i,t[0].result}var a=e(n);return t.unshift({input:n,result:a}),t.length>o&&t.pop(),a}}var c=s(function(t){var n=t,r=i(t);if(r){if(!r.path)return t;n=r.path}for(var o=e.isAbsolute(n),s=[],c=0,l=0;;){if(c=l,l=n.indexOf(`/`,c),l===-1){s.push(n.slice(c));break}for(s.push(n.slice(c,l));l<n.length&&n[l]===`/`;)l++}for(var u,d=0,l=s.length-1;l>=0;l--)u=s[l],u===`.`?s.splice(l,1):u===`..`?d++:d>0&&(u===``?(s.splice(l+1,d),d=0):(s.splice(l,2),d--));return n=s.join(`/`),n===``&&(n=o?`/`:`.`),r?(r.path=n,a(r)):n});e.normalize=c;function l(e,t){e===``&&(e=`.`),t===``&&(t=`.`);var n=i(t),o=i(e);if(o&&(e=o.path||`/`),n&&!n.scheme)return o&&(n.scheme=o.scheme),a(n);if(n||t.match(r))return t;if(o&&!o.host&&!o.path)return o.host=t,a(o);var s=t.charAt(0)===`/`?t:c(e.replace(/\/+$/,``)+`/`+t);return o?(o.path=s,a(o)):s}e.join=l,e.isAbsolute=function(e){return e.charAt(0)===`/`||n.test(e)};function u(e,t){e===``&&(e=`.`),e=e.replace(/\/$/,``);for(var n=0;t.indexOf(e+`/`)!==0;){var r=e.lastIndexOf(`/`);if(r<0||(e=e.slice(0,r),e.match(/^([^\/]+:\/)?\/*$/)))return t;++n}return Array(n+1).join(`../`)+t.substr(e.length+1)}e.relative=u;var d=function(){return!(`__proto__`in Object.create(null))}();function f(e){return e}function p(e){return h(e)?`$`+e:e}e.toSetString=d?f:p;function m(e){return h(e)?e.slice(1):e}e.fromSetString=d?f:m;function h(e){if(!e)return!1;var t=e.length;if(t<9||e.charCodeAt(t-1)!==95||e.charCodeAt(t-2)!==95||e.charCodeAt(t-3)!==111||e.charCodeAt(t-4)!==116||e.charCodeAt(t-5)!==111||e.charCodeAt(t-6)!==114||e.charCodeAt(t-7)!==112||e.charCodeAt(t-8)!==95||e.charCodeAt(t-9)!==95)return!1;for(var n=t-10;n>=0;n--)if(e.charCodeAt(n)!==36)return!1;return!0}function g(e,t,n){var r=b(e.source,t.source);return r!==0||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:b(e.name,t.name)}e.compareByOriginalPositions=g;function _(e,t,n){var r=e.originalLine-t.originalLine;return r!==0||(r=e.originalColumn-t.originalColumn,r!==0||n)||(r=e.generatedColumn-t.generatedColumn,r!==0)||(r=e.generatedLine-t.generatedLine,r!==0)?r:b(e.name,t.name)}e.compareByOriginalPositionsNoSource=_;function v(e,t,n){var r=e.generatedLine-t.generatedLine;return r!==0||(r=e.generatedColumn-t.generatedColumn,r!==0||n)||(r=b(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:b(e.name,t.name)}e.compareByGeneratedPositionsDeflated=v;function y(e,t,n){var r=e.generatedColumn-t.generatedColumn;return r!==0||n||(r=b(e.source,t.source),r!==0)||(r=e.originalLine-t.originalLine,r!==0)||(r=e.originalColumn-t.originalColumn,r!==0)?r:b(e.name,t.name)}e.compareByGeneratedPositionsDeflatedNoLine=y;function b(e,t){return e===t?0:e===null?1:t===null?-1:e>t?1:-1}function ee(e,t){var n=e.generatedLine-t.generatedLine;return n!==0||(n=e.generatedColumn-t.generatedColumn,n!==0)||(n=b(e.source,t.source),n!==0)||(n=e.originalLine-t.originalLine,n!==0)||(n=e.originalColumn-t.originalColumn,n!==0)?n:b(e.name,t.name)}e.compareByGeneratedPositionsInflated=ee;function x(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,``))}e.parseSourceMapInput=x;function S(e,t,n){if(t||=``,e&&(e[e.length-1]!==`/`&&t[0]!==`/`&&(e+=`/`),t=e+t),n){var r=i(n);if(!r)throw Error(`sourceMapURL could not be parsed`);if(r.path){var o=r.path.lastIndexOf(`/`);o>=0&&(r.path=r.path.substring(0,o+1))}t=l(a(r),t)}return c(t)}e.computeSourceURL=S})),Mc=n((e=>{var t=jc(),n=Object.prototype.hasOwnProperty,r=typeof Map<`u`;function i(){this._array=[],this._set=r?new Map:Object.create(null)}i.fromArray=function(e,t){for(var n=new i,r=0,a=e.length;r<a;r++)n.add(e[r],t);return n},i.prototype.size=function(){return r?this._set.size:Object.getOwnPropertyNames(this._set).length},i.prototype.add=function(e,i){var a=r?e:t.toSetString(e),o=r?this.has(e):n.call(this._set,a),s=this._array.length;(!o||i)&&this._array.push(e),o||(r?this._set.set(e,s):this._set[a]=s)},i.prototype.has=function(e){if(r)return this._set.has(e);var i=t.toSetString(e);return n.call(this._set,i)},i.prototype.indexOf=function(e){if(r){var i=this._set.get(e);if(i>=0)return i}else{var a=t.toSetString(e);if(n.call(this._set,a))return this._set[a]}throw Error(`"`+e+`" is not in the set.`)},i.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw Error(`No element indexed by `+e)},i.prototype.toArray=function(){return this._array.slice()},e.ArraySet=i})),Nc=n((e=>{var t=jc();function n(e,n){var r=e.generatedLine,i=n.generatedLine,a=e.generatedColumn,o=n.generatedColumn;return i>r||i==r&&o>=a||t.compareByGeneratedPositionsInflated(e,n)<=0}function r(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}r.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},r.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},r.prototype.toArray=function(){return this._sorted||=(this._array.sort(t.compareByGeneratedPositionsInflated),!0),this._array},e.MappingList=r})),Pc=n((e=>{var t=Ac(),n=jc(),r=Mc().ArraySet,i=Nc().MappingList;function a(e){e||={},this._file=n.getArg(e,`file`,null),this._sourceRoot=n.getArg(e,`sourceRoot`,null),this._skipValidation=n.getArg(e,`skipValidation`,!1),this._ignoreInvalidMapping=n.getArg(e,`ignoreInvalidMapping`,!1),this._sources=new r,this._names=new r,this._mappings=new i,this._sourcesContents=null}a.prototype._version=3,a.fromSourceMap=function(e,t){var r=e.sourceRoot,i=new a(Object.assign(t||{},{file:e.file,sourceRoot:r}));return e.eachMapping(function(e){var t={generated:{line:e.generatedLine,column:e.generatedColumn}};e.source!=null&&(t.source=e.source,r!=null&&(t.source=n.relative(r,t.source)),t.original={line:e.originalLine,column:e.originalColumn},e.name!=null&&(t.name=e.name)),i.addMapping(t)}),e.sources.forEach(function(t){var a=t;r!==null&&(a=n.relative(r,t)),i._sources.has(a)||i._sources.add(a);var o=e.sourceContentFor(t);o!=null&&i.setSourceContent(t,o)}),i},a.prototype.addMapping=function(e){var t=n.getArg(e,`generated`),r=n.getArg(e,`original`,null),i=n.getArg(e,`source`,null),a=n.getArg(e,`name`,null);(this._skipValidation||this._validateMapping(t,r,i,a)!==!1)&&(i!=null&&(i=String(i),this._sources.has(i)||this._sources.add(i)),a!=null&&(a=String(a),this._names.has(a)||this._names.add(a)),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:i,name:a}))},a.prototype.setSourceContent=function(e,t){var r=e;this._sourceRoot!=null&&(r=n.relative(this._sourceRoot,r)),t==null?this._sourcesContents&&(delete this._sourcesContents[n.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null)):(this._sourcesContents||=Object.create(null),this._sourcesContents[n.toSetString(r)]=t)},a.prototype.applySourceMap=function(e,t,i){var a=t;if(t==null){if(e.file==null)throw Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);a=e.file}var o=this._sourceRoot;o!=null&&(a=n.relative(o,a));var s=new r,c=new r;this._mappings.unsortedForEach(function(t){if(t.source===a&&t.originalLine!=null){var r=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});r.source!=null&&(t.source=r.source,i!=null&&(t.source=n.join(i,t.source)),o!=null&&(t.source=n.relative(o,t.source)),t.originalLine=r.line,t.originalColumn=r.column,r.name!=null&&(t.name=r.name))}var l=t.source;l!=null&&!s.has(l)&&s.add(l);var u=t.name;u!=null&&!c.has(u)&&c.add(u)},this),this._sources=s,this._names=c,e.sources.forEach(function(t){var r=e.sourceContentFor(t);r!=null&&(i!=null&&(t=n.join(i,t)),o!=null&&(t=n.relative(o,t)),this.setSourceContent(t,r))},this)},a.prototype._validateMapping=function(e,t,n,r){if(t&&typeof t.line!=`number`&&typeof t.column!=`number`){var i=`original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.`;if(this._ignoreInvalidMapping)return typeof console<`u`&&console.warn&&console.warn(i),!1;throw Error(i)}if(!(e&&`line`in e&&`column`in e&&e.line>0&&e.column>=0&&!t&&!n&&!r)&&!(e&&`line`in e&&`column`in e&&t&&`line`in t&&`column`in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&n)){var i=`Invalid mapping: `+JSON.stringify({generated:e,source:n,original:t,name:r});if(this._ignoreInvalidMapping)return typeof console<`u`&&console.warn&&console.warn(i),!1;throw Error(i)}},a.prototype._serializeMappings=function(){for(var e=0,r=1,i=0,a=0,o=0,s=0,c=``,l,u,d,f,p=this._mappings.toArray(),m=0,h=p.length;m<h;m++){if(u=p[m],l=``,u.generatedLine!==r){e=0;var g=u.generatedLine-r;l+=g===1?`;`:`;`.repeat(g),r=u.generatedLine}else if(m>0){if(!n.compareByGeneratedPositionsInflated(u,p[m-1]))continue;l+=`,`}l+=t.encode(u.generatedColumn-e),e=u.generatedColumn,u.source!=null&&(f=this._sources.indexOf(u.source),l+=t.encode(f-s),s=f,l+=t.encode(u.originalLine-1-a),a=u.originalLine-1,l+=t.encode(u.originalColumn-i),i=u.originalColumn,u.name!=null&&(d=this._names.indexOf(u.name),l+=t.encode(d-o),o=d)),c+=l}return c},a.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;t!=null&&(e=n.relative(t,e));var r=n.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},a.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},a.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.SourceMapGenerator=a}))(),Fc=new Set([`Atrule`,`Selector`,`Declaration`]);function Ic(e){let t=new Pc.SourceMapGenerator,n={line:1,column:0},r={line:0,column:0},i={line:1,column:0},a={generated:i},o=1,s=0,c=!1,l=e.node;e.node=function(e){if(e.loc&&e.loc.start&&Fc.has(e.type)){let l=e.loc.start.line,u=e.loc.start.column-1;(r.line!==l||r.column!==u)&&(r.line=l,r.column=u,n.line=o,n.column=s,c&&(c=!1,(n.line!==i.line||n.column!==i.column)&&t.addMapping(a)),c=!0,t.addMapping({source:e.loc.source,original:r,generated:n}))}l.call(this,e),c&&Fc.has(e.type)&&(i.line=o,i.column=s)};let u=e.emit;e.emit=function(e,t,n){for(let t=0;t<e.length;t++)e.charCodeAt(t)===10?(o++,s=0):s++;u(e,t,n)};let d=e.result;return e.result=function(){return c&&t.addMapping(a),{css:d(),map:t}},e}var Lc=e({safe:()=>Gc,spec:()=>Wc}),Rc=43,zc=45,Bc=(e,t)=>(e===9&&(e=t),typeof e==`string`&&(e=Math.min(e.charCodeAt(0),128)<<6),e<<1),Vc=[[1,1],[1,2],[1,7],[1,8],[1,`-`],[1,10],[1,11],[1,12],[1,15],[1,21],[3,1],[3,2],[3,7],[3,8],[3,`-`],[3,10],[3,11],[3,12],[3,15],[4,1],[4,2],[4,7],[4,8],[4,`-`],[4,10],[4,11],[4,12],[4,15],[12,1],[12,2],[12,7],[12,8],[12,`-`],[12,10],[12,11],[12,12],[12,15],[`#`,1],[`#`,2],[`#`,7],[`#`,8],[`#`,`-`],[`#`,10],[`#`,11],[`#`,12],[`#`,15],[`-`,1],[`-`,2],[`-`,7],[`-`,8],[`-`,`-`],[`-`,10],[`-`,11],[`-`,12],[`-`,15],[10,1],[10,2],[10,7],[10,8],[10,10],[10,11],[10,12],[10,`%`],[10,15],[`@`,1],[`@`,2],[`@`,7],[`@`,8],[`@`,`-`],[`@`,15],[`.`,10],[`.`,11],[`.`,12],[`+`,10],[`+`,11],[`+`,12],[`/`,`*`]],Hc=Vc.concat([[1,4],[12,4],[4,4],[3,21],[3,5],[3,16],[11,11],[11,12],[11,2],[11,`-`],[22,1],[22,2],[22,11],[22,12],[22,4],[22,`-`]]);function Uc(e){let t=new Set(e.map(([e,t])=>Bc(e)<<16|Bc(t)));return function(e,n,r){let i=Bc(n,r),a=r.charCodeAt(0);return i|(a===zc&&n!==1&&n!==2&&n!==15||a===Rc?t.has((e&65534)<<16|a<<7):t.has((e&65534)<<16|i))}}var Wc=Uc(Vc),Gc=Uc(Hc),Kc=92;function qc(e,t){if(typeof t==`function`){let n=null;e.children.forEach(e=>{n!==null&&t.call(this,n),this.node(e),n=e})}else e.children.forEach(this.node,this)}function Jc(e){let t=new Map;for(let[n,r]of Object.entries(e.node))typeof(r.generate||r)==`function`&&t.set(n,r.generate||r);return function(e,n){let r=``,i=0,a={node(e){if(t.has(e.type))t.get(e.type).call(o,e);else throw Error(`Unknown node type: `+e.type)},tokenBefore:Gc,token(e,t,n){i=this.tokenBefore(i,e,t),!n&&i&1&&this.emit(` `,13,!0),this.emit(t,e,!1),e===9&&t.charCodeAt(0)===Kc&&this.emit(`
5
+ `,13,!0)},emit(e){r+=e},result(){return r}};n&&(typeof n.decorator==`function`&&(a=n.decorator(a)),n.sourceMap&&(a=Ic(a)),n.mode in Lc&&(a.tokenBefore=Lc[n.mode]));let o={node:e=>a.node(e),children:qc,token:(e,t)=>a.token(e,t),tokenize:e=>it(e,(t,n,r)=>{a.token(t,e.slice(n,r),n!==0)})};return a.node(e),a.result()}}var Yc=Jc({node:e({AnPlusB:()=>pn,Atrule:()=>xn,AtrulePrelude:()=>Dn,AttributeSelector:()=>Bn,Block:()=>Zn,Brackets:()=>nr,CDC:()=>or,CDO:()=>ur,ClassSelector:()=>gr,Combinator:()=>Tr,Comment:()=>Mr,Condition:()=>Br,Declaration:()=>ii,DeclarationList:()=>pi,Dimension:()=>vi,Feature:()=>wi,FeatureFunction:()=>Ai,FeatureRange:()=>Vi,Function:()=>qi,GeneralEnclosed:()=>Qi,Hash:()=>ra,IdSelector:()=>pa,Identifier:()=>ca,Layer:()=>ya,LayerList:()=>wa,MediaQuery:()=>ka,MediaQueryList:()=>Pa,NestingSelector:()=>Ba,Nth:()=>Wa,Number:()=>Ya,Operator:()=>eo,Parentheses:()=>ao,Percentage:()=>uo,PseudoClassSelector:()=>_o,PseudoElementSelector:()=>Co,Ratio:()=>Ao,Raw:()=>Fo,Rule:()=>Uo,Scope:()=>Jo,Selector:()=>$o,SelectorList:()=>as,String:()=>hs,StyleSheet:()=>Cs,SupportsDeclaration:()=>Os,TypeSelector:()=>Is,UnicodeRange:()=>Js,Url:()=>oc,Value:()=>dc,WhiteSpace:()=>_c})}),Xc=92;function Zc(e){let t=e.length-1,n=``;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i===Xc){if(r===t)break;if(i=e.charCodeAt(++r),U(Xc,i)){let t=r-1,i=Ve(e,t);r=i-1,n+=Ge(e.substring(t+1,i))}else i===13&&e.charCodeAt(r+1)===10&&r++}else n+=e[r]}return n}var Qc=class extends Error{code;suggestions;status;details;constructor(e,t,n={}){super(t,n.cause===void 0?void 0:{cause:n.cause}),this.name=`RvwError`,this.code=e,this.suggestions=n.suggestions??[],this.status=n.status??400,this.details=n.details}toJSON(){return{code:this.code,message:this.message,suggestions:this.suggestions,...this.details===void 0?{}:{details:this.details}}}};function $c(e){let t=e.startsWith(`rvw-asset:`)?e.slice(10):e.replace(/^\.\//u,``);return/^[A-Za-z0-9_-]+(?:[./][A-Za-z0-9_-]+)*$/u.test(t)&&!t.split(`/`).some(e=>e===`.`||e===`..`)?t:null}function el(e,t,n,r){let i=e=>{throw new Qc(`INVALID_INPUT`,`Unsafe or unsupported CSS: ${e}`)},a;try{a=vc(e,{context:t,parseCustomProperty:!0,onParseError:e=>{throw e}})}catch{return i(`invalid syntax`)}let o=0;return Oc(a,{enter(e){if(e.type===`Raw`&&i(`unparsed syntax`),e.type===`Atrule`){let t=Zc(e.name).toLowerCase();[`media`,`supports`,`container`,`layer`,`keyframes`,`-webkit-keyframes`,`font-face`,`property`,`scope`,`starting-style`].includes(t)||i(`@${t}`),t===`font-face`&&o++}if(e.type===`Declaration`){let t=Zc(e.property).toLowerCase();[`behavior`,`-moz-binding`].includes(t)&&i(t),o&&t===`src`&&Oc(e.value,e=>{e.type===`Function`&&![`format`,`tech`].includes(Zc(e.name).toLowerCase())&&i(`font src must use bundled URL`)})}if(e.type===`Function`&&Zc(e.name).toLowerCase()===`attr`){let t=e.children.toArray().filter(e=>e.type!==`WhiteSpace`);(t[0]?.type!==`Identifier`||t.length>1&&(t[1]?.type!==`Operator`||t[1].value!==`,`))&&i(`typed attr()`),e.children.forEach(e=>{(e.type===`Function`||e.type===`Url`)&&i(`typed or dynamic attr()`)})}if(e.type===`Function`&&[`expression`,`image`,`image-set`,`-webkit-image-set`,`paint`,`element`,`-moz-element`,`local`,`url`,`src`].includes(Zc(e.name).toLowerCase())&&i(e.name),e.type===`Url`){let t=e.value;if(/^#[A-Za-z_][\w:.-]*$/u.test(t)&&!o)return;let a=$c(t);a||i(`resource ${t}`),n.push({path:a,kind:o?`font`:`image`}),e.value=r?.get(a)??`data:,`}},leave(e){e.type===`Atrule`&&Zc(e.name).toLowerCase()===`font-face`&&o--}}),Yc(a)}var tl={abandonedHeadElementChild:{reason:`Unexpected metadata element after head`,description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:`Unexpected abruptly closed empty comment`,description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:`Unexpected abruptly closed public identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:`Unexpected abruptly closed system identifier`,description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:`Unexpected non-digit at start of numeric character reference`,description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:`Unexpected CDATA section in HTML`,description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:`Unexpected too big numeric character reference`,description:`Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)`},closingOfElementWithOpenChildElements:{reason:`Unexpected closing tag with open child elements`,description:`Unexpectedly closing tag. Expected other tags to be closed first`,url:!1},controlCharacterInInputStream:{reason:`Unexpected control character`,description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:`Unexpected control character reference`,description:`Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace`},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:`Unexpected duplicate attribute`,description:`Unexpectedly double attribute. Expected attributes to occur only once`},endTagWithAttributes:{reason:`Unexpected attribute on closing tag`,description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:`Unexpected slash at end of closing tag`,description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:`Unexpected unopened end tag`,description:`Unexpected end tag. Expected no end tag or another end tag`,url:!1},eofBeforeTagName:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected tag name instead`},eofInCdata:{reason:`Unexpected end of file in CDATA`,description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:`Unexpected end of file in comment`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:`Unexpected end of file in doctype`,description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:`Unexpected end of file in element that can only contain text`,description:`Unexpected end of file. Expected text or a closing tag`,url:!1},eofInScriptHtmlCommentLikeText:{reason:`Unexpected end of file in comment inside script`,description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:`Unexpected end of file in tag`,description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:`Incorrectly closed comment`,description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:`Incorrectly opened comment`,description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:`Invalid sequence after doctype name`,description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:`Invalid first character in tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:`Misplaced doctype`,description:`Unexpected doctype. Expected doctype before head`,url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:`Missing attribute value`,description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:`Missing doctype before other content`,description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:`Missing doctype name`,description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:`Missing public identifier in doctype`,description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:`Missing system identifier in doctype`,description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:`Missing name in end tag`,description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:`Missing quote before public identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:`Missing quote before system identifier in doctype`,description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:`Missing semicolon after character reference`,description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:`Missing whitespace after public identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:`Missing whitespace after system identifier in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:`Missing whitespace before doctype name`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:`Missing whitespace between attributes`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:`Missing whitespace between public and system identifiers in doctype`,description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:`Unexpected nested comment`,description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:`Unexpected non-conforming doctype declaration`,description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:`Unexpected trailing slash on start tag of non-void element`,description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:`Unexpected noncharacter code point referenced by character reference`,description:`Unexpected code point. Do not use noncharacters in HTML`},noncharacterInInputStream:{reason:`Unexpected noncharacter character`,description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:`Unexpected NULL character referenced by character reference`,description:`Unexpected code point. Do not use NULL characters in HTML`},openElementsLeftAfterEof:{reason:`Unexpected end of file`,description:`Unexpected end of file. Expected closing tag instead`,url:!1},surrogateCharacterReference:{reason:`Unexpected surrogate character referenced by character reference`,description:`Unexpected code point. Do not use lone surrogate characters in HTML`},surrogateInInputStream:{reason:`Unexpected surrogate character`,description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:`Invalid character after system identifier in doctype`,description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:`Unexpected character in attribute name`,description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:`Unexpected character in unquoted attribute value`,description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:`Unexpected equals sign before attribute name`,description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:`Unexpected NULL character`,description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:`Unexpected question mark instead of tag name`,description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:`Unexpected slash in tag`,description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:`Unexpected unknown named character reference`,description:`Unexpected character reference. Expected known named character references`}},nl=`https://html.spec.whatwg.org/multipage/parsing.html#parse-error-`,rl=/-[a-z]/g,il=/%c(?:([-+])(\d+))?/g,al=/%x/g,ol={2:!0,1:!1,0:null},sl={};function cl(e,t){let n=t||sl,r=n.onerror,i=e instanceof w?e:new w(e),a=n.fragment?h:D,o=String(i),s=a(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?c:null,scriptingEnabled:!1});return l(s,{file:i,space:n.space,verbose:n.verbose});function c(e){let t=e.code,a=ll(t),s=n[a]??!0,c=typeof s==`number`?s:+!!s;if(c){let n=tl[a],o=new C(l(n.reason),{place:{start:{line:e.startLine,column:e.startCol,offset:e.startOffset},end:{line:e.endLine,column:e.endCol,offset:e.endOffset}},ruleId:t,source:`hast-util-from-html`});i.path&&(o.file=i.path,o.name=i.path+`:`+o.name),o.fatal=ol[c],o.note=l(n.description),o.url=n.url===!1?void 0:nl+t,r(o)}function l(t){return t.replace(il,n).replace(al,r);function n(t,n,r){let i=(r?Number.parseInt(r,10):0)*(n===`-`?-1:1);return dl(o.charAt(e.startOffset+i))}function r(){return fl(o.charCodeAt(e.startOffset))}}}}function ll(e){return e.replace(rl,ul)}function ul(e){return e.charAt(1).toUpperCase()}function dl(e){return e==="`"?"` ` `":e}function fl(e){return`0x`+e.toString(16).toUpperCase()}var pl=`rvw-ref:`,ml=`rvw-source:`,hl=/^[A-Za-z][A-Za-z\d+.-]*:/u,gl=/^data:image\/(?:png|jpeg|gif|webp|avif);base64,[A-Za-z\d+/=\s]+$/u,_l=/<\s*\/?\s*(?:html|head|body)(?:\s|>)/iu,vl=new Set(`html.head.body.title.meta.a.article.aside.b.blockquote.br.button.caption.code.col.colgroup.dd.details.div.dl.dt.em.figcaption.figure.footer.h1.h2.h3.h4.h5.h6.header.hr.i.img.input.kbd.label.li.main.mark.nav.ol.option.p.pre.section.select.small.span.strong.style.sub.summary.sup.table.tbody.td.textarea.tfoot.th.thead.tr.ul`.split(`.`)),yl=new Set([`circle`,`clipPath`,`defs`,`desc`,`ellipse`,`g`,`line`,`linearGradient`,`marker`,`mask`,`path`,`polygon`,`polyline`,`radialGradient`,`rect`,`stop`,`svg`,`symbol`,`text`,`title`,`tspan`,`use`]),bl=new Set([`audio`,`base`,`canvas`,`embed`,`frame`,`iframe`,`link`,`object`,`script`,`video`,`foreignobject`]),xl=new Set([`p`,`li`,`blockquote`,`pre`,`div`,`td`,`th`,`tr`,`article`,`aside`,`details`,`figure`,`img`,`section`,`svg`,`table`]),Sl=new Set([`ariaDescribedBy`,`ariaLabel`,`ariaLabelledBy`,`className`,`dir`,`hidden`,`id`,`lang`,`role`,`style`,`tabIndex`,`title`]),Cl=new Map([[`style`,new Set([`media`,`type`])],[`a`,new Set([`href`,`hrefLang`])],[`blockquote`,new Set([`cite`])],[`button`,new Set([`disabled`,`name`,`type`,`value`])],[`col`,new Set([`span`,`width`])],[`details`,new Set([`open`])],[`img`,new Set([`alt`,`decoding`,`height`,`loading`,`src`,`width`])],[`input`,new Set([`accept`,`autoComplete`,`checked`,`disabled`,`max`,`maxLength`,`min`,`minLength`,`multiple`,`name`,`placeholder`,`readOnly`,`required`,`size`,`step`,`type`,`value`])],[`label`,new Set([`htmlFor`])],[`li`,new Set([`value`])],[`ol`,new Set([`reversed`,`start`,`type`])],[`option`,new Set([`disabled`,`label`,`selected`,`value`])],[`select`,new Set([`disabled`,`multiple`,`name`,`required`,`size`])],[`td`,new Set([`colSpan`,`headers`,`rowSpan`])],[`textarea`,new Set([`cols`,`disabled`,`maxLength`,`minLength`,`name`,`placeholder`,`readOnly`,`required`,`rows`,`wrap`])],[`th`,new Set([`abbr`,`colSpan`,`headers`,`rowSpan`,`scope`])]]),wl=new Set(`alignmentBaseline.clipPath.clipPathUnits.cx.cy.d.dominantBaseline.dx.dy.fill.fillOpacity.fillRule.fontFamily.fontSize.fontStyle.fontWeight.gradientTransform.gradientUnits.height.href.lengthAdjust.markerEnd.markerHeight.markerMid.markerStart.markerUnits.markerWidth.mask.maskContentUnits.maskUnits.offset.opacity.orient.pathLength.points.preserveAspectRatio.r.refX.refY.rx.ry.spreadMethod.stopColor.stopOpacity.stroke.strokeDasharray.strokeDashoffset.strokeLinecap.strokeLinejoin.strokeMiterlimit.strokeOpacity.strokeWidth.textAnchor.textLength.transform.vectorEffect.viewBox.width.x.x1.x2.xmlns.y.y1.y2`.split(`.`)),Tl=new Set([`clipPath`,`fill`,`markerEnd`,`markerMid`,`markerStart`,`mask`,`stroke`]);function El(e){let t=o(e),n=[],r=e=>{if(e.type===`code`&&e.lang===`html-preview`&&typeof e.value==`string`&&e.position){let t=e.position.start.line+1;n.push({startLine:t,endLine:t+Math.max(1,e.value.split(`
6
+ `).length)-1})}e.children?.forEach(r)};return r(t),n}function Dl(e,t){return t+(e?.start.line??1)}function Z(e,t){throw new Qc(`INVALID_INPUT`,`html-preview L${e}: ${t}`)}function Ol(e){let t=e.trim();if(t.length===0||t.startsWith(`#`)||t.startsWith(`?`)||t.startsWith(`//`)||hl.test(t))return null;let n=t.split(/[?#]/u,1)[0];if(!n)return null;let r;try{r=decodeURIComponent(n)}catch{return null}if(r.includes(`\\`)||r.includes(`\0`))return null;let i=[];for(let e of r.split(`/`))if(e&&e!==`.`){if(e===`..`){if(i.length===0)return null;i.pop()}else i.push(e)}return i.length>0?i.join(`/`):null}function kl(e,t,n){return e===`meta`&&[`charSet`,`name`,`content`].includes(t)||Sl.has(t)||/^aria[A-Z]/u.test(t)||/^data[A-Z]/u.test(t)||n&&wl.has(t)?!0:Cl.get(e)?.has(t)??!1}function Q(e,t){let n=e.properties?.[t];return typeof n==`string`?n:typeof n==`number`||typeof n==`boolean`||typeof n==`bigint`?String(n):Array.isArray(n)?n.filter(e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`).map(String).join(` `):null}function Al(e,t,n,r){let i=e.trim();i.toLowerCase().startsWith(pl)?(n&&Z(t,`inline SVGのhrefはfragmentだけを使用できます。`),r.push(i.slice(8))):i.startsWith(`#`)||(n||!/^https?:/iu.test(i)&&!Ol(i))&&(/^javascript:/iu.test(i)&&Z(t,`javascript: URLは使用できません。`),Z(t,n?`inline SVGのexternal hrefは使用できません。`:`link ${i} は使用できません。`))}function jl(e,t,n,r){try{el(e,t,n)}catch(e){Z(r,`network resourceを参照するCSSまたは未対応のCSSは使用できません。 ${e instanceof Error?e.message:`Invalid CSS`}`)}}function Ml(e,t){let n=[],r=[],i=[],a=new Set,o=0,s=(e,c)=>{if(e.type===`comment`){e.value?.startsWith(ml)&&Z(Dl(e.position,t),`内部source markerは指定できません。`);return}if(e.type===`doctype`)return;if(e.type!==`element`||!e.tagName){e.children?.forEach(e=>s(e,c));return}let l=e.tagName,u=l.toLowerCase(),d=Dl(e.position,t),f=c||u===`svg`;if(l===`meta`){let t=e.properties??{};Object.keys(t).every(e=>e===`charSet`)||Object.keys(t).every(e=>[`name`,`content`].includes(e))&&[`viewport`,`color-scheme`,`description`].includes(String(t.name))||Z(d,`Only charset, viewport, color-scheme and description metadata are supported.`)}bl.has(u)&&Z(d,`<${l}> は使用できません。`),!vl.has(l)&&!yl.has(l)&&Z(d,`<${l}> は使用できません。`);for(let t of Object.keys(e.properties??{}))/^on/iu.test(t)&&Z(d,`${t.toLowerCase()} attribute は使用できません。`),t===`srcDoc`&&Z(d,`srcdoc attribute は使用できません。`),(/^dataRvwSource/iu.test(t)||/^dataRvw(?:Node|Text|CommentSurface)/iu.test(t))&&Z(d,`内部data-rvw-source-* attributeは指定できません。`),kl(l,t,f)||Z(d,`<${l}>の${t} attribute は使用できません。`),a.add(t);let p=Q(e,`style`);p!==null&&jl(p,`declarationList`,i,d),l===`style`&&jl(e.children?.map(e=>e.value??``).join(``)??``,`stylesheet`,i,d);let m=Q(e,`href`);if(m!==null&&Al(m,d,f,n),f)for(let t of Tl){let n=Q(e,t);n!==null&&jl(n,`value`,i,d)}if(l===`img`){o+=1;let t=Q(e,`src`);if(t||Z(d,`<img>にはsrcが必要です。`),t.startsWith(`data:`))gl.test(t)||Z(d,`inline imageは対応するbase64 data:imageだけを使用できます。`);else if(t.startsWith(`rvw-asset:`)){let e=$c(t);e||Z(d,`Invalid bundled image path.`),i.push({path:e,kind:`image`})}else{let e=Ol(t);e||Z(d,`外部画像 ${t} は使用できません。`),r.push(e)}}e.children?.forEach(e=>s(e,f))};return s(e,!1),o>32&&Z(t,`画像はWalkthrough全体で32件以下にしてください。`),{referenceIds:n,repositoryImages:r,propertyNames:a,imageCount:o,assetReferences:i}}function Nl(e){return{allowComments:!0,allowDoctypes:!0,ancestors:{},attributes:{"*":[...e]},clobber:[],protocols:{href:[`http`,`https`,`rvw-ref`],src:[`data`,`rvw-asset`]},required:{},strip:[...bl],tagNames:[...vl,...yl]}}function Pl(e,t){return e.position?{startLine:t+e.position.start.line,endLine:t+e.position.end.line}:null}function Fl(e,t){let n=Q(e,`alt`)?.trim(),r=Q(e,`title`)?.trim();e.tagName=`span`,e.properties={className:[`rvw-html-image-placeholder`],dataRvwImagePath:t,role:`img`,ariaLabel:n||r||`Missing image: ${t}`,...r?{title:r}:{}},e.children=[{type:`text`,value:n||r||`Image unavailable: ${t}`}]}function Il(e,t,n){let r=(e,i=!1)=>{if(e.type!==`element`||!e.tagName){if(e.children){let n=[];for(let a of e.children){let e=!i&&a.type===`text`?Pl(a,t):null;e&&a.value?.trim()&&n.push({type:`comment`,value:`${ml}${e.startLine}:${e.endLine}`}),r(a,i),n.push(a)}e.children=n}return}let a=Pl(e,t);e.properties??={},a&&(e.properties.dataRvwSourceStartLine=a.startLine,e.properties.dataRvwSourceEndLine=a.endLine),(xl.has(e.tagName)||Object.hasOwn(e.properties,`dataRvwCommentable`))&&(e.properties.dataRvwCommentSurface=`true`);let o=Q(e,`style`);o!==null&&(e.properties.style=el(o,`declarationList`,[],n)),e.tagName===`style`&&(e.children=[{type:`text`,value:el(e.children?.map(e=>e.value??``).join(``)??``,`stylesheet`,[],n)}]);for(let t of Tl){let r=Q(e,t);r!==null&&(e.properties[t]=el(r,`value`,[],n))}if(e.tagName===`img`){let t=Q(e,`src`);if(t&&!t.startsWith(`data:`)){let r=t.startsWith(`rvw-asset:`)?$c(t):Ol(t),i=r?n.get(r):null;r&&i?(e.properties.src=i,e.properties.dataRvwImagePath=r):r&&Fl(e,r)}}if(e.children){let n=[];for(let i of e.children){let a=e.tagName!==`style`&&i.type===`text`?Pl(i,t):null;a&&i.value?.trim()&&n.push({type:`comment`,value:`${ml}${a.startLine}:${a.endLine}`}),r(i,e.tagName===`style`),n.push(i)}e.children=n}};r(e)}function Ll(e,t,n=new Map){let r=_l.test(e)||/^\s*<!doctype\s/iu.test(e),i=cl(e,{fragment:!r}),a=Ml(i,t),o=m(i,Nl(a.propertyNames));Il(o,t,n);let s=Math.max(1,e.split(`
7
+ `).length);return{startLine:t+1,endLine:t+s,imageCount:a.imageCount,referenceIds:a.referenceIds,repositoryImages:a.repositoryImages,assetReferences:a.assetReferences,standalone:r,html:M(o)}}function Rl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function zl(e,t,n,r){return[...r].sort((e,t)=>t.length-e.length).find(r=>{let i=`${t}${r}`;return n?RegExp(`${Rl(i)}-\\d+$`).test(e):e.endsWith(i)})??null}function Bl(e,t,n,r,i=!0){return Array.from(e.querySelectorAll(t)).flatMap(e=>{let t=zl(e.id,n,i,r);return t?[{bindingKey:t,element:e}]:[]})}var Vl={flowchart:{targets:(e,t)=>Bl(e,`g.node[id]`,`-flowchart-`,t)},classDiagram:{targets:(e,t)=>Bl(e,`g.node[id]`,`-classId-`,t)},sequenceDiagram:{targets:(e,t)=>{let n=new Set(t);return Array.from(e.querySelectorAll(`g[data-et="participant"][data-id]`)).flatMap(e=>{let t=e.dataset.id;return t&&n.has(t)?[{bindingKey:t,element:e}]:[]})}},"stateDiagram-v2":{targets:(e,t)=>Bl(e,`g.statediagram-state[id]`,`-state-`,t)},erDiagram:{targets:(e,t)=>Bl(e,`g.node[id]`,`-entity-`,t)},"architecture-beta":{targets:(e,t)=>Bl(e,`g.architecture-service[id]`,`-service-`,t,!1)}};function Hl(e){for(let t of e.split(`
8
+ `)){let e=t.trim();if(!e||e.startsWith(`%%`))continue;let n=e.match(/^(flowchart|graph|classDiagram|sequenceDiagram|stateDiagram-v2|erDiagram|architecture-beta)\b/)?.[1];return n===`graph`?`flowchart`:n??null}return null}function Ul(e,t,n){let r=Hl(e);return r?Vl[r].targets(t,n):[]}var Wl=`.code-inline-reference{border:1px solid color-mix(in srgb, var(--accent) 45%, var(--line))!important;background:color-mix(in srgb, var(--accent) 8%, var(--panel))!important;max-width:100%!important;color:var(--accent)!important;cursor:pointer!important;-webkit-user-select:text!important;user-select:text!important;vertical-align:baseline!important;border-radius:5px!important;align-items:center!important;gap:5px!important;margin:0 2px!important;padding:2px 6px!important;line-height:1.35!important;text-decoration:none!important;display:inline-flex!important}.code-inline-reference:hover{border-color:var(--accent)!important;background:var(--accent-soft)!important}.code-inline-reference svg{flex:none!important;width:13px!important;height:13px!important}.code-inline-reference>span{font:650 12px var(--mono)!important;text-overflow:ellipsis!important;white-space:nowrap!important;overflow:hidden!important}.code-inline-reference small{color:var(--muted)!important;font:9px var(--mono)!important;white-space:nowrap!important}a.code-inline-reference{font:650 12px var(--mono)!important;cursor:pointer!important;text-decoration:none!important}a.code-inline-reference:before{content:""!important;background:var(--rvw-ref-icon) center / contain no-repeat!important;flex:none!important;width:13px!important;height:13px!important}a.code-inline-reference:after{content:attr(data-rvw-ref-location)!important;color:var(--muted)!important;font:9px var(--mono)!important;white-space:nowrap!important}.code-inline-reference:focus-visible{outline:2px solid var(--accent)!important;outline-offset:2px!important}`;function Gl(e,t){let n=[],r=t;for(;r!==e;){let e=r.parentNode;if(!e)return null;n.unshift(Array.prototype.indexOf.call(e.childNodes,r)),r=e}return n}function Kl(e,t){let n=e.querySelector(`.rvw-preview-root`);if(!n)return null;let r=e=>{let t=n;for(let n of e){let e=t.childNodes.item(n);if(!e)return null;t=e}return t},i=r(t.path);if(!i)return null;if(t.startOffset===void 0)return i.nodeType===1?i:null;let a=t.endPath?r(t.endPath):null;if(!a||t.endOffset===void 0)return null;try{let n=e.createRange();return n.setStart(i,t.startOffset),n.setEnd(a,t.endOffset),n.collapsed?null:n}catch{return null}}var $=k();function ql({action:e,markers:t,composer:n,composerAnchor:r,onComment:i,onActivateComment:a,renderCommentThread:o}){let[s,c]=(0,I.useState)(null),l=(0,I.useId)(),u=(0,I.useRef)(null),d=(0,I.useRef)(null),f=t.find(e=>e.id===s),m=f?.id??null,h=()=>{let e=d.current?.querySelector(`[data-html-comment-id="${CSS.escape(s??``)}"]`);c(null),e?.focus()};(0,I.useLayoutEffect)(()=>{m&&(u.current?.focus({preventScroll:!0}),u.current?.scrollIntoView({block:`nearest`,inline:`nearest`}))},[m]);let g=(0,I.useRef)(null);return(0,I.useLayoutEffect)(()=>{if(!n)return;let e=window.requestAnimationFrame(()=>{g.current?.scrollIntoView({block:`nearest`,inline:`nearest`})});return()=>window.cancelAnimationFrame(e)},[n]),(0,$.jsxs)(`div`,{ref:d,className:`walkthrough-html-overlay`,"aria-hidden":e===null&&t.length===0&&!n,children:[t.map(e=>(0,$.jsx)(`button`,{className:`walkthrough-html-marker${e.active?` is-active`:``}`,style:{left:e.left,top:e.top},"aria-label":e.label,title:e.label,"data-html-comment-id":e.id,"aria-expanded":s===e.id,"aria-controls":s===e.id?l:void 0,onClick:()=>{s===e.id?h():(c(e.id),a(e.id))},children:(0,$.jsx)(p,{})},e.id)),f&&(0,$.jsxs)(`div`,{ref:u,id:l,role:`dialog`,"aria-label":`HTML上のコメント`,tabIndex:-1,className:`walkthrough-html-comment-thread`,style:{left:`clamp(12px, ${f.left}px, max(12px, 100% - 432px))`,top:f.top+24},onKeyDown:e=>{e.key===`Escape`&&!e.nativeEvent.isComposing&&!e.defaultPrevented&&(e.preventDefault(),e.stopPropagation(),h())},children:[(0,$.jsx)(`button`,{className:`button--quiet`,"aria-label":`コメントを閉じる`,onClick:h,children:`閉じる`}),o(f.id)]}),e&&(0,$.jsx)($.Fragment,{children:(0,$.jsx)(`button`,{className:`walkthrough-html-comment-action`,style:{left:e.left,top:e.top},"aria-label":e.label,title:e.label,onPointerDown:e=>e.preventDefault(),onMouseEnter:e.onPreview,onMouseLeave:e.onPreviewEnd,onFocus:e.onPreview,onBlur:e.onPreviewEnd,onClick:()=>{c(null),i(e)},children:(0,$.jsx)(p,{})})}),n&&r&&(0,$.jsx)(`div`,{ref:g,className:`walkthrough-html-comment-composer`,style:{left:r.left,top:r.top},children:n})]})}var Jl=240,Yl=2e4,Xl=/^rvw-source:(\d+):(\d+)$/u,Zl=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/avif`,`image/svg+xml`]),Ql=`default-src 'none'; script-src 'none'; style-src 'unsafe-inline'; img-src data:; font-src data:; connect-src 'none'; media-src 'none'; object-src 'none'; frame-src 'none'; worker-src 'none'; base-uri 'none'; form-action 'none'`;function $l(e,t){let n=`
9
+ --rvw-bg: #262624;
10
+ --rvw-fg: #ecebe5;
11
+ --rvw-muted: #b5b3aa;
12
+ --rvw-border: #45453f;
13
+ --rvw-accent: #a9c7e8;
14
+ --rvw-panel: #30302d;
15
+ --rvw-highlight: #d6aa81;
16
+ ${t?``:`color-scheme: dark;`}`,r=`
17
+ --rvw-bg: #fffefb;
18
+ --rvw-fg: #30302b;
19
+ --rvw-muted: #6b6a61;
20
+ --rvw-border: #e5e3da;
21
+ --rvw-accent: #37658c;
22
+ --rvw-panel: #f5f4ee;
23
+ --rvw-highlight: #a66a43;
24
+ ${t?``:`color-scheme: light;`}`;return e===`dark`?`:where(:root) {${n}}`:e===`light`?`:where(:root) {${r}}`:`:where(:root) {${r}} @media (prefers-color-scheme: dark) { :where(:root) {${n}} }`}function eu(e,t){return`${$l(e,t)}
25
+ @layer rvw-selection-defaults {
26
+ :root::selection { background-color: #b9dafa; color: #172b40; }
27
+ }
28
+ ${t?``:`:where(html) { background: var(--rvw-bg); color: var(--rvw-fg); font: 15px/1.5 ui-sans-serif, sans-serif; } :where(a) { color: var(--rvw-accent); }`}
29
+ ${t?``:`.rvw-preview-root { min-width: 0; }`}
30
+ .rvw-html-image-placeholder { display: grid; min-height: 96px; place-items: center; padding: 16px; border: 1px dashed var(--rvw-border); border-radius: 6px; background: var(--rvw-panel); color: var(--rvw-muted); text-align: center; }
31
+ p, h1, h2, h3, h4, h5, h6, li, dt, dd, blockquote, pre, td, th, figcaption { cursor: text; }
32
+ a, a * { cursor: pointer; }
33
+ ::highlight(rvw-pane-find-left-match), ::highlight(rvw-pane-find-right-match) { background-color: light-dark(rgb(234 179 8 / 0.42), rgb(250 204 21 / 0.38)); }
34
+ ::highlight(rvw-pane-find-left-current), ::highlight(rvw-pane-find-right-current) { background-color: light-dark(rgb(245 139 10 / 0.82), rgb(249 115 22 / 0.78)); color: light-dark(#17120a, #fff); }
35
+ `}var tu=`
36
+ ::highlight(rvw-comment) { background: color-mix(in srgb, var(--rvw-highlight) 28%, transparent); }
37
+ .rvw-html-comment-target,
38
+ .rvw-html-active-comment {
39
+ outline: 2px solid var(--rvw-highlight) !important;
40
+ outline-offset: 2px !important;
41
+ }
42
+ `;function nu(e,t,n){let r=`<meta http-equiv="Content-Security-Policy" content="${Ql}"><style>${eu(t,n)}</style>`,i=`<style>.code-inline-reference { --accent: var(--rvw-accent); --line: var(--rvw-border); --panel: var(--rvw-bg); --muted: var(--rvw-muted); --mono: var(--rvw-font-mono, "SFMono-Regular", Consolas, monospace); --accent-soft: color-mix(in srgb, var(--rvw-accent) 12%, var(--rvw-bg)); } ${Wl} ${tu}</style>`;return n?e.replace(/<head([^>]*)>/u,`<head$1>${r}`).replace(/<\/body>/u,`${i}</body>`):`${r}<style>:where(body) { margin: 0; }</style><div class="rvw-preview-root" data-pane-find-text>${e}</div>${i}`}function ru(e){if(!e)return null;let t=e,n=Number(t.dataset.rvwSourceStartLine),r=Number(t.dataset.rvwSourceEndLine);return!Number.isInteger(n)||!Number.isInteger(r)||n<1||r<1?null:{startLine:Math.min(n,r),endLine:Math.max(n,r)}}function iu(e){return e&&typeof e==`object`&&`closest`in e?e:null}function au(e,t){return e.startLine<=t.endLine&&e.endLine>=t.startLine}function ou(e){let t=0,n=e;for(;n;)t+=1,n=n.parentElement;return t}function su(e,t){let n=[...e.querySelectorAll(`[data-rvw-source-start-line]`)].map(e=>({element:e,range:ru(e)})).filter(e=>e.range!==null&&au(e.range,t));return n.sort((e,n)=>(e.range.startLine<=t.startLine&&e.range.endLine>=t.endLine?0:1)-(n.range.startLine<=t.startLine&&n.range.endLine>=t.endLine?0:1)||e.range.endLine-e.range.startLine-(n.range.endLine-n.range.startLine)||ou(n.element)-ou(e.element)),n[0]?.element??null}function cu(e,t){let n=``,r=32768;for(let t=0;t<e.length;t+=r)n+=String.fromCharCode(...e.subarray(t,t+r));return`data:${t};base64,${window.btoa(n)}`}async function lu(e,t,n,r){let i=[...new Set(n)],a=new Map,o=0;for(let n of i)if(o>=20971520)a.set(n,null);else try{let i=await fetch(x(e,t,n),{signal:r}),s=i.headers.get(`content-type`)?.split(`;`,1)[0]?.toLowerCase(),c=Number(i.headers.get(`content-length`));if(!i.ok||!s||!Zl.has(s)||Number.isFinite(c)&&(c>5242880||o+c>20971520)){await i.body?.cancel(),a.set(n,null);continue}let l=new Uint8Array(await i.arrayBuffer());if(l.byteLength>5242880||o+l.byteLength>20971520){a.set(n,null);continue}o+=l.byteLength,a.set(n,cu(l,s))}catch(e){if(r.aborted)throw e;a.set(n,null)}return a}function uu({walkthroughId:e,assets:t,source:n,fenceRange:r,pullRequestId:i,sourceOid:a,references:o,placedComments:s,activeCommentId:c,navigationLine:l,themePreference:u,commentComposer:d,renderCommentThread:f,onOpenReference:p,onOpenRepositoryLink:m,onCommentRange:h,onActivateComment:g}){let _=(0,I.useRef)(null),v=(0,I.useRef)(null),b=(0,I.useRef)(null),ee=(0,I.useRef)(new WeakMap),x=(0,I.useRef)(t);x.current=t;let S=t.map(e=>`${e.path}:${e.sha256}`).join(`|`),[te,C]=(0,I.useState)(``),[w,T]=(0,I.useState)(null),[ne,re]=(0,I.useState)(new Map),[ie,E]=(0,I.useState)(Jl),[D,O]=(0,I.useState)(null),[oe,se]=(0,I.useState)(null),[ce,k]=(0,I.useState)([]),A=(0,I.useMemo)(()=>{try{return{value:Ll(n,r.startLine,ne)}}catch(e){return{error:e instanceof Error?e.message:`HTML previewを表示できません。`}}},[r.startLine,ne,n]),j=(0,I.useMemo)(()=>{try{return Ll(n,r.startLine).repositoryImages}catch{return[]}},[r.startLine,n]);(0,I.useEffect)(()=>{let t=new AbortController;return T(null),C(``),re(new Map),(async()=>{let n=x.current,r=await lu(i,a,j.filter(e=>!n.some(t=>t.path===e)),t.signal);for(let a of n){let n=await fetch(`/api/pull-requests/${encodeURIComponent(i)}/walkthroughs/${encodeURIComponent(e)}/asset?${new URLSearchParams({path:a.path,sha256:a.sha256})}`,{signal:t.signal});if(!n.ok)throw Error(`Bundled asset unavailable: ${a.path}`);let o=new Uint8Array(await n.arrayBuffer());if(o.length!==a.byteLength)throw Error(`Bundled asset length mismatch: ${a.path}`);let s=await window.crypto.subtle.digest(`SHA-256`,o);if([...new Uint8Array(s)].map(e=>e.toString(16).padStart(2,`0`)).join(``)!==a.sha256||n.headers.get(`content-type`)?.split(`;`,1)[0]!==a.mediaType)throw Error(`Bundled asset integrity mismatch: ${a.path}`);r.set(a.path,cu(o,a.mediaType))}t.signal.aborted||(T(null),C(S),re(r))})().catch(e=>{t.signal.aborted||T(e instanceof Error?e.message:`Bundled assets unavailable.`)}),()=>t.abort()},[S,e,j,i,a]);let M=(0,I.useCallback)(()=>{let e=b.current,t=_.current,n=v.current,i=e?.contentDocument;if(!e||!t||!n||!i)return;let a=Math.max(i.documentElement.scrollHeight,i.body?.scrollHeight??0),o=Math.min(Yl,Math.max(Jl,a));E(e=>Math.abs(e-o)<1?e:o),i.body&&(i.body.style.overflowY=a>Yl?`auto`:`hidden`);let l=e.getBoundingClientRect(),u=n.getBoundingClientRect(),d=[];k(s.flatMap(({comment:e,placement:t})=>{if(t.outdated||!t.range)return[];let n=e.target.kind===`walkthrough`?e.target.htmlAnchor:void 0;if(n&&n.fenceStartLine!==r.startLine)return[];let a=n?Kl(i,n):su(i,t.range);if(!a)return[];let o=a.getBoundingClientRect(),s=l.left-u.left+o.right,f=l.top-u.top+o.top;for(;d.some(e=>Math.abs(e.left-s)<28&&Math.abs(e.top-f)<28);)f+=28;return d.push({left:s,top:f}),[{id:e.id,left:s,top:f,active:e.id===c,label:`${e.id}のコメントを開く`}]}))},[c,s,r.startLine]);return(0,I.useLayoutEffect)(()=>{M()},[ie,M]),(0,I.useEffect)(()=>{let e=b.current,t=_.current,n=v.current;if(!e||!t||!n||!A.value)return;let i=()=>void 0,s=()=>{i();let s=e.contentDocument;if(!s)return;A.value?.standalone&&(s.body.classList.add(`rvw-preview-root`),s.body.setAttribute(`data-pane-find-text`,``));for(let e of s.querySelectorAll(`a[href^="rvw-ref:"]`)){let t=o.get(e.getAttribute(`href`).slice(8));t&&(e.classList.add(`code-inline-reference`),e.title=y(t),e.dataset.rvwRefLocation=ae(t)??`File`,e.style.setProperty(`--rvw-ref-icon`,`url("${le(t.path,s.defaultView.getComputedStyle(s.documentElement).colorScheme===`dark`)}")`))}let c=new WeakMap,l=s.createTreeWalker(s,NodeFilter.SHOW_COMMENT),u=l.nextNode();for(;u;){let e=Xl.exec(u.nodeValue??``),t=u.nextSibling;e&&t?.nodeType===Node.TEXT_NODE&&c.set(t,{startLine:Number(e[1]),endLine:Number(e[2])}),u=l.nextNode()}ee.current=c;let d=e=>Math.max(96,Math.min(n.clientWidth-96,e)),f=()=>{let e=s.getSelection();if(!e||e.rangeCount===0||e.isCollapsed||!e.toString().trim())return null;let t=e.getRangeAt(0),n=s.querySelector(`.rvw-preview-root`),i=n&&Gl(n,t.startContainer),a=n&&Gl(n,t.endContainer);if(!i||!a)return null;let o=s.createTreeWalker(s,NodeFilter.SHOW_TEXT),l=[],u=o.nextNode();for(;u;){if(t.intersectsNode(u)){let e=c.get(u);e&&l.push(e)}u=o.nextNode()}if(l.length===0){let e=ru((t.commonAncestorContainer.nodeType===Node.ELEMENT_NODE?t.commonAncestorContainer:t.commonAncestorContainer.parentElement)?.closest(`[data-rvw-source-start-line]`)??null);e&&l.push(e)}return l.length===0?null:{range:{htmlAnchor:{fenceStartLine:r.startLine,path:i,startOffset:t.startOffset,endPath:a,endOffset:t.endOffset},startLine:Math.min(...l.map(e=>e.startLine)),endLine:Math.max(...l.map(e=>e.endLine))},rect:t.getBoundingClientRect()}},h=null,g=()=>{h=null;let t=f();if(!t){O(null);return}let r=e.getBoundingClientRect(),i=n.getBoundingClientRect();O({range:t.range,left:d(r.left-i.left+t.rect.left+t.rect.width/2),top:r.top-i.top+t.rect.bottom+8,label:`選択したテキストへコメント`})},_=e=>{let t=ru(e),n=s.querySelector(`.rvw-preview-root`),i=e&&n&&Gl(n,e);return t&&i?{...t,htmlAnchor:{fenceStartLine:r.startLine,path:i}}:null},v=()=>{for(let e of s.querySelectorAll(`.rvw-html-comment-target`))e.classList.remove(`rvw-html-comment-target`)},b=e=>{v(),e.classList.add(`rvw-html-comment-target`)},x=t=>{if(v(),s.getSelection()?.toString().trim()){h=null;return}let r=iu(t.target),i=r?.closest(`[data-rvw-commentable]`)??r?.closest(`[data-rvw-comment-surface='true']`)??null,a=e.getBoundingClientRect();if(h&&i!==h.surface){let e=n.querySelector(`.walkthrough-html-comment-action`)?.getBoundingClientRect();if(e){let n=a.left+t.clientX,r=a.top+t.clientY,i=a.left+h.x,o=a.top+h.y;if(n>=Math.min(i,e.left)-4&&n<=Math.max(i,e.right)+4&&r>=Math.min(o,e.top)-4&&r<=Math.max(o,e.bottom)+4)return}}h=null;let o=_(i);if(!i||!o)return;h={surface:i,x:t.clientX,y:t.clientY};let c=i.getBoundingClientRect(),l=n.getBoundingClientRect();O({range:o,left:d(a.left-l.left+c.right),top:a.top-l.top+c.bottom+4,label:`この要素へコメント`,composerTop:a.top-l.top+c.bottom,onPreview:()=>b(i),onPreviewEnd:v})},S=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey)return;let t=e.key.toLowerCase(),n=t===`f`&&!e.shiftKey,r=t===`p`&&!e.shiftKey,i=t===`f`&&e.shiftKey;if(!n&&!r&&!i)return;let a=new KeyboardEvent(`keydown`,{key:e.key,code:e.code,location:e.location,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,altKey:e.altKey,repeat:e.repeat,bubbles:!0,cancelable:!0});window.document.dispatchEvent(a)||e.preventDefault()},te=e=>{let t=iu(e.target)?.closest(`a[href]`);if(!t)return;e.preventDefault(),e.stopPropagation();let n=t.getAttribute(`href`)?.trim()??``,r=e.metaKey||e.ctrlKey;if(n.startsWith(`rvw-ref:`)){let i=s.getSelection();if(e.detail>0&&i&&!i.isCollapsed&&i.containsNode(t,!0))return;let a=o.get(n.slice(8));a&&p(a,r);return}if(n.startsWith(`#`)){s.getElementById(n.slice(1))?.scrollIntoView({block:`center`});return}if(/^https?:/iu.test(n)){window.open(n,`_blank`,`noopener,noreferrer`);return}let i=Ol(n);i&&m(i,a,r)};s.addEventListener(`selectionchange`,g),s.addEventListener(`pointerup`,g),s.addEventListener(`pointermove`,x),s.addEventListener(`keydown`,S),s.addEventListener(`click`,te,!0),s.addEventListener(`toggle`,M,!0);let C=null,w=()=>{h=null,C===null&&(C=window.requestAnimationFrame(()=>{C=null,M()}))};s.addEventListener(`scroll`,w,!0);let ne=[...s.images];for(let e of ne)e.addEventListener(`load`,M),e.addEventListener(`error`,M);let re=new ResizeObserver(M);re.observe(s.documentElement),s.body&&re.observe(s.body);let ie=new ResizeObserver(M);ie.observe(t),M(),s.fonts.ready.then(()=>{e.contentDocument===s&&M()});let E=()=>{e.contentDocument===s&&T(`A bundled font could not be decoded. Supply a valid WOFF2 font.`)};s.fonts.addEventListener(`loadingdone`,M),s.fonts.addEventListener(`loadingerror`,E),i=()=>{s.fonts.removeEventListener(`loadingerror`,E),s.fonts.removeEventListener(`loadingdone`,M),s.removeEventListener(`selectionchange`,g),s.removeEventListener(`pointerup`,g),s.removeEventListener(`pointermove`,x),s.removeEventListener(`keydown`,S),s.removeEventListener(`click`,te,!0),s.removeEventListener(`toggle`,M,!0),s.removeEventListener(`scroll`,w,!0),C!==null&&window.cancelAnimationFrame(C);for(let e of ne)e.removeEventListener(`load`,M),e.removeEventListener(`error`,M);re.disconnect(),ie.disconnect()}};return e.addEventListener(`load`,s),e.contentDocument?.readyState===`complete`&&s(),()=>{e.removeEventListener(`load`,s),i()}},[p,m,o,A.value,a,M,r.startLine]),(0,I.useEffect)(()=>{let e=b.current?.contentDocument;if(!e)return;let t=e.defaultView;t?.CSS?.highlights?.delete(`rvw-comment`);for(let t of e.querySelectorAll(`.rvw-html-active-comment`))t.classList.remove(`rvw-html-active-comment`);let n=s.find(({comment:e,placement:t})=>e.id===c&&!t.outdated&&t.range)?.placement;if(!n?.range)return;let i=s.find(({comment:e})=>e.id===c)?.comment,a=i?.target.kind===`walkthrough`?i.target.htmlAnchor:void 0;if(a&&a.fenceStartLine!==r.startLine)return;let o=a?Kl(e,a):su(e,n.range);o&&(`startContainer`in o?(t?.Highlight&&t.CSS.highlights.set(`rvw-comment`,new t.Highlight(o)),o.startContainer.parentElement?.scrollIntoView({block:`nearest`})):(o.classList.add(`rvw-html-active-comment`),_.current?.scrollIntoView({block:`nearest`,inline:`nearest`}),o.scrollIntoView({block:`center`,inline:`nearest`}),M()))},[c,s,M,r.startLine]),(0,I.useEffect)(()=>{if(l===null)return;let e=b.current?.contentDocument;if(!e)return;let t=su(e,{startLine:l,endLine:l});t&&(_.current?.scrollIntoView({block:`center`,inline:`nearest`}),t.scrollIntoView({block:`center`,inline:`nearest`}))},[l,A.value]),w?(0,$.jsx)(`div`,{role:`alert`,className:`walkthrough-html-preview-error`,children:w}):A.error?(0,$.jsx)(`div`,{className:`walkthrough-html-preview-error`,role:`alert`,children:A.error}):t.length>0&&te!==S?(0,$.jsx)(`div`,{className:`walkthrough-html-preview-shell`,role:`status`,children:`アセットを読み込んでいます…`}):(0,$.jsx)(`div`,{className:`walkthrough-html-preview-shell`,ref:_,"data-rvw-navigation-start-line":r.startLine,"data-rvw-navigation-end-line":r.endLine,children:(0,$.jsxs)(`div`,{className:`walkthrough-html-preview-frame-shell`,ref:v,onPointerLeave:()=>O(null),children:[(0,$.jsx)(`iframe`,{ref:b,title:`Walkthrough HTML preview L${r.startLine}`,"data-pane-find-child-document":!0,sandbox:`allow-same-origin`,srcDoc:nu(A.value?.html??``,u,A.value?.standalone??!1),style:{height:ie}}),(0,$.jsx)(ql,{action:D,markers:ce,renderCommentThread:f,composer:oe?d(oe.label):null,composerAnchor:oe,onComment:e=>{e.onPreviewEnd?.(),b.current?.contentDocument?.getSelection()?.removeAllRanges(),O(null);let t=_.current?.clientWidth??0,n=Math.min(420,Math.max(0,t-24))/2,r=t>0?Math.max(12+n,Math.min(t-12-n,e.left)):e.left;se({...e,left:r,top:e.composerTop??e.top}),h(e.range)},onActivateComment:g})]})})}var du=2400,fu=new Intl.DateTimeFormat(`ja-JP`,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`});function pu(e){return I.Children.toArray(e).map(e=>typeof e==`string`||typeof e==`number`?String(e):(0,I.isValidElement)(e)?pu(e.props.children):``).join(``)}function mu(e,t){return!!(e&&t&&e.startLine===t.startLine&&e.endLine===t.endLine)}function hu(){return(0,$.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,width:`16`,height:`16`,children:(0,$.jsx)(`path`,{fill:`currentColor`,d:`M5.5 1.75A1.75 1.75 0 0 1 7.25 0h1.5a1.75 1.75 0 0 1 1.75 1.75V2h3a.75.75 0 0 1 0 1.5h-.64l-.68 10.03A2.5 2.5 0 0 1 9.69 16H6.31a2.5 2.5 0 0 1-2.49-2.47L3.14 3.5H2.5a.75.75 0 0 1 0-1.5h3v-.25Zm1.5 0V2h2v-.25a.25.25 0 0 0-.25-.25h-1.5a.25.25 0 0 0-.25.25ZM4.65 3.5l.67 9.96c.02.58.46 1.04.99 1.04h3.38c.53 0 .97-.46.99-1.04l.67-9.96h-6.7Z`})})}function gu({source:e,sourceRange:t,commented:n,bindings:r,references:i,themePreference:o,onOpenReference:s,onCommentRange:c,commentComposer:l,reviewContext:d}){let f=(0,I.useRef)(null),m=!!l,[h,g]=(0,I.useState)(!1),[v,y]=(0,I.useState)(``);(0,I.useLayoutEffect)(()=>{if(!m)return;let e=window.requestAnimationFrame(()=>{f.current?.scrollIntoView({block:`nearest`,inline:`nearest`})});return()=>window.cancelAnimationFrame(e)},[m]);let b=(0,I.useCallback)(e=>{if(!(e instanceof Element))return;let t=e.closest(`[data-walkthrough-reference-id]`)?.dataset.walkthroughReferenceId;return t?i.get(t):void 0},[i]),ee=(0,I.useCallback)(t=>{for(let{bindingKey:n,element:a}of Ul(e,t,Object.keys(r))){let e=r[n],t=e?i.get(e):void 0;t&&(a.classList.add(`walkthrough-diagram-node--linked`),a.setAttribute(`role`,`button`),a.setAttribute(`tabindex`,`0`),a.setAttribute(`aria-label`,`${t.label}をコードで開く`),a.dataset.walkthroughReferenceId=t.id)}},[r,i,e]),x=t?d.placedComments.filter(({placement:e})=>mu(e.range,t)):[],S=t?{pullRequestId:d.pullRequestId,commentCount:x.length,onOpenCodeReference:d.onOpenCommentCodeReference,diagramReferenceBindings:{sourceOid:d.sourceOid,onRendered:ee,referenceFromTarget:b,resolveForPeek:d.onResolveReferenceForPeek,onOpenInReview:s},renderComments:e=>(0,$.jsxs)(`div`,{className:`mermaid-diagram-comments`,children:[x.length===0&&!h&&(0,$.jsx)(`p`,{className:`mermaid-comments-empty`,children:`この diagram へのコメントはありません。`}),x.map(({comment:n,placement:r})=>(0,$.jsx)(te,{comment:n,variant:`sidebar`,draftScope:`${d.draftScope}:mermaid:${t.startLine}-${t.endLine}`,placement:r,markdownSourceOid:d.sourceOid,themePreference:o,cancelDraftOnEscape:!0,onActiveChange:d.onCommentActiveChange,onOpenCodeReference:e,onOpenRepositoryLink:d.onOpenRepositoryLink},n.id)),h?(0,$.jsx)(u,{body:v,label:`Comment on diagram`,pending:d.diagramCommentPending,error:d.diagramCommentError,validationError:void 0,placement:`line`,onBodyChange:y,onCancel:()=>{g(!1),y(``),d.onCancelDiagramComment()},onSubmit:e=>{d.onCreateExpandedDiagramComment(t,v,e).then(()=>{g(!1),y(``)}).catch(()=>void 0)}}):(0,$.jsxs)(`button`,{className:`mermaid-comment-action`,onClick:()=>{d.onCancelDiagramComment(),g(!0)},children:[(0,$.jsx)(p,{}),`Comment on diagram`]})]})}:void 0;return(0,$.jsx)(_,{source:e,themePreference:o,renderIdPrefix:`rvwWalkthrough`,review:S,renderInline:r=>(0,$.jsxs)(`div`,{className:`walkthrough-diagram-shell${n?` has-comment`:``}`,...t?{"data-rvw-navigation-start-line":t.startLine,"data-rvw-navigation-end-line":t.endLine}:{},children:[(0,$.jsxs)(`div`,{className:`walkthrough-diagram-toolbar`,children:[(0,$.jsx)(`span`,{children:`Mermaid diagram`}),(0,$.jsx)(`span`,{children:`強調された要素を選択してコードを開く · Cmd/Ctrlで反対のペイン`}),t&&(0,$.jsx)(`button`,{className:`button--quiet walkthrough-diagram-comment`,"aria-label":`図全体へコメント`,title:`図全体へコメント`,onPointerDown:e=>{e.button===0&&(e.preventDefault(),c(t))},onClick:e=>{e.detail===0&&c(t)},children:(0,$.jsx)(p,{})}),r]}),(0,$.jsx)(a,{className:`walkthrough-diagram`,source:e,themePreference:o,renderIdPrefix:`rvwWalkthrough`,errorClassName:`walkthrough-diagram-error`,onRendered:ee,onPointerDown:e=>{let t=b(e.target);t&&(e.preventDefault(),e.stopPropagation(),s(t,e.metaKey||e.ctrlKey))},onKeyDown:e=>{if(e.key!==`Enter`&&e.key!==` `)return;let t=b(e.target);t&&(e.preventDefault(),s(t,!1))}}),l&&(0,$.jsx)(`div`,{className:`walkthrough-diagram-comment-composer`,ref:f,children:l})]})})}var _u=(0,I.createContext)(null);function vu({range:e,label:t,pending:n,error:r,onCancel:i,onSubmit:a}){let[o,s]=(0,I.useState)(``),c=t??(e.startLine===e.endLine?`L${e.startLine}へコメント`:`L${e.startLine}–${e.endLine}へコメント`);return(0,$.jsx)(u,{body:o,label:c,pending:n,error:r,validationError:void 0,placement:`line`,onBodyChange:s,onCancel:i,onSubmit:e=>a(o,e)})}var yu=({children:e,node:t,...n})=>{let r=(0,I.useContext)(_u),i=I.Children.count(e)===1?I.Children.only(e):null;if(!r||!(0,I.isValidElement)(i))return(0,$.jsx)(`pre`,{...n,children:e});let a=de(t);if(i.props.className===`language-html-preview`&&a){let e=r.diagramCommentRange&&r.diagramCommentRange.startLine>=a.startLine&&r.diagramCommentRange.endLine<=a.endLine?r.diagramCommentRange:null;return(0,$.jsx)(uu,{source:pu(i.props.children).replace(/\n$/u,``),fenceRange:a,walkthroughId:r.walkthroughId,assets:r.assets,pullRequestId:r.pullRequestId,sourceOid:r.sourceOid,references:r.references,placedComments:r.placedComments,activeCommentId:r.activeCommentId,navigationLine:r.navigationLine,themePreference:r.themePreference,onOpenReference:r.onOpenReference,onOpenRepositoryLink:r.onOpenRepositoryLink,onCommentRange:r.onCommentRange,onActivateComment:e=>r.onCommentActiveChange(e,!0),renderCommentThread:e=>{let t=r.placedComments.find(({comment:t})=>t.id===e);return t?(0,$.jsx)(te,{comment:t.comment,variant:`sidebar`,draftScope:`${r.draftScope}:html:${a.startLine}`,placement:t.placement,markdownSourceOid:r.sourceOid,themePreference:r.themePreference,cancelDraftOnEscape:!0,replyContextLabel:`HTML`,onOpenCodeReference:r.onOpenCommentCodeReference,onOpenRepositoryLink:r.onOpenRepositoryLink}):null},commentComposer:t=>e?(0,$.jsx)(vu,{range:e,label:t,pending:r.diagramCommentPending,error:r.diagramCommentError,onCancel:r.onCancelDiagramComment,onSubmit:(t,n)=>r.onSubmitDiagramComment(e,t,n)},`${e.startLine}:${e.endLine}`):null})}return i.props.className===`language-mermaid`?(0,$.jsx)(gu,{source:pu(i.props.children).trim(),sourceRange:a,commented:!!(a&&r.activeCommentId&&r.placedComments.some(({comment:e,placement:t})=>e.id===r.activeCommentId&&t.range&&t.range.startLine<=a.endLine&&t.range.endLine>=a.startLine)),bindings:r.diagramBindings,references:r.references,themePreference:r.themePreference,onOpenReference:r.onOpenReference,onCommentRange:r.onCommentRange,commentComposer:a&&mu(a,r.diagramCommentRange)?(0,$.jsx)(vu,{range:a,pending:r.diagramCommentPending,error:r.diagramCommentError,onCancel:r.onCancelDiagramComment,onSubmit:(e,t)=>r.onSubmitDiagramComment(a,e,t)},`${a.startLine}:${a.endLine}`):null,reviewContext:r}):(0,$.jsx)(`pre`,{...n,children:e})},bu=[],xu=(0,I.memo)(function({walkthroughId:e,assets:t,pullRequestId:n,body:r,diagramBindings:i,references:a,placedComments:o,activeCommentId:l,navigationLine:u,selectedRange:d,selectionComposerOpen:p,diagramCommentRange:m,markdownSourceOid:h,draftScope:g,themePreference:_,onOpenReference:y,onResolveReferenceForPeek:ee,onOpenCommentCodeReference:x,onOpenRepositoryLink:S,onCommentActiveChange:C,onActivateComment:w,onCommentRange:ne,diagramCommentPending:re,diagramCommentError:ie,onCancelDiagramComment:ae,onSubmitDiagramComment:D,onCreateExpandedDiagramComment:se}){let ce=(0,I.useMemo)(()=>El(r),[r]),k=(0,I.useMemo)(()=>o.filter(({placement:e})=>{let t=e.range;return!(t&&ce.some(e=>t.startLine>=e.startLine&&t.endLine<=e.endLine))}),[ce,o]),le=(0,I.useMemo)(()=>k.map(({comment:e,placement:t})=>({id:e.id,range:t.range})),[k]),A=(0,I.useMemo)(()=>new Map(k.map(({comment:e,placement:t})=>[e.id,{comment:e,placement:t}])),[k]),j=(0,I.useCallback)(({node:e,children:t,...n})=>{let r=P(e);return r.length===0?(0,$.jsx)(`div`,{...n,children:t}):(0,$.jsx)(`div`,{className:`markdown-inline-comments`,children:r.map(e=>{let t=A.get(e);return t?(0,$.jsx)(te,{comment:t.comment,variant:`inline`,draftScope:g,placement:t.placement,markdownSourceOid:h,themePreference:_,onActiveChange:C,onOpenCodeReference:x,onOpenRepositoryLink:S},e):null})})},[A,g,h,C,x,S,_]);return(0,$.jsx)(_u.Provider,{value:{walkthroughId:e,assets:t,pullRequestId:n,sourceOid:h,diagramBindings:i,references:a,placedComments:o,activeCommentId:l,navigationLine:u,diagramCommentRange:m,themePreference:_,onOpenReference:y,onResolveReferenceForPeek:ee,onOpenCommentCodeReference:x,onOpenRepositoryLink:S,onCommentActiveChange:C,onActivateComment:w,onCommentRange:ne,diagramCommentPending:re,diagramCommentError:ie,onCancelDiagramComment:ae,onSubmitDiagramComment:D,onCreateExpandedDiagramComment:se,draftScope:g},children:(0,$.jsx)(ue.Provider,{value:j,children:(0,$.jsx)(`article`,{className:`walkthrough-markdown`,children:(0,$.jsx)(c,{rehypePlugins:[s,[O,b],[pe,{annotations:le,activeCommentId:l,selectedRange:d,composerOpen:p}]],remarkPlugins:[oe],urlTransform:e=>e.startsWith(`rvw-ref:`)?e:f(e),components:{div:me,table:F,a:({href:e,children:t,node:n,...r})=>{let i=T(e),o=i?a.get(i):void 0;return o?(0,$.jsx)(v,{reference:o,className:`walkthrough-inline-reference`,onOpen:y,children:t}):(0,$.jsx)(`a`,{...N(n),...r,href:e,children:t})},img:({alt:e,title:t,node:n})=>(0,$.jsx)(E,{alt:e,title:t,sourceAttributes:N(n)}),pre:yu},children:r})})})})});function Su({walkthrough:e,paneId:t,comments:n,activeCommentId:a,navigationTarget:o,onNavigationApplied:s,themePreference:c,onCommentActiveChange:l,onActivateComment:f,onOpenReference:m,onResolveReferenceForPeek:h,onOpenCommentCodeReference:_,onOpenRepositoryLink:v,onDeleted:y}){let b=r(),x=g(t,{kind:`walkthrough`,id:e.id,title:e.title,sourceOid:e.sourceOid}),C=(0,I.useRef)(null),w=(0,I.useRef)(null),T=(0,I.useRef)(s);T.current=s;let[E,ae]=(0,I.useState)(!1),[D,O]=(0,I.useState)(null),[oe,k]=(0,I.useState)(null),[le,j]=(0,I.useState)(null),[M,N]=(0,I.useState)(``),[ue,de]=(0,I.useState)(null),pe=(0,I.useRef)(0),P=(0,I.useRef)(null),me=(0,I.useRef)(e);me.current=e;let F=(0,I.useRef)({onOpenReference:m,onResolveReferenceForPeek:h,onOpenCommentCodeReference:_,onOpenRepositoryLink:v,onCommentActiveChange:l,onActivateComment:f});F.current={onOpenReference:m,onResolveReferenceForPeek:h,onOpenCommentCodeReference:_,onOpenRepositoryLink:v,onCommentActiveChange:l,onActivateComment:f};let he=(0,I.useMemo)(()=>new Map(e.references.map(e=>[e.id,e])),[e.references]);(0,I.useLayoutEffect)(()=>{if(!o||w.current===o.requestId)return;let e=o.requestId,t=window.requestAnimationFrame(()=>{let t=C.current;if(!t)return;if(o.line===null){t.scrollIntoView({behavior:`auto`,block:`start`,inline:`nearest`}),w.current=e,T.current(e);return}let n=String(o.line),r=t.querySelector(`[data-rvw-navigation-start-line="${n}"]`)??t.querySelector(`[data-rvw-source-start-line="${n}"]`)??[...t.querySelectorAll(`[data-rvw-navigation-start-line]`)].find(e=>{let t=Number(e.dataset.rvwNavigationStartLine),n=Number(e.dataset.rvwNavigationEndLine);return t<=o.line&&n>=o.line}),i=r?.closest(`details:not([open])`);i&&(i.open=!0),r&&(r.scrollIntoView({behavior:`auto`,block:`center`,inline:`nearest`}),w.current=e,T.current(e))});return()=>window.cancelAnimationFrame(t)},[o]);let ge=(0,I.useCallback)((e,t)=>{pe.current+=1;let n=pe.current;P.current!==null&&(window.clearTimeout(P.current),P.current=null),de(null),F.current.onOpenReference(me.current,e,t).then(e=>{n===pe.current&&e&&(de(e),P.current=window.setTimeout(()=>{de(null),P.current=null},du))})},[]),_e=(0,I.useCallback)((e,t)=>F.current.onResolveReferenceForPeek(me.current,e,t),[]),ve=(0,I.useCallback)((e,t,n)=>F.current.onOpenCommentCodeReference(e,t,n),[]),ye=(0,I.useCallback)((e,t,n)=>F.current.onOpenRepositoryLink(e,t,n),[]),be=(0,I.useCallback)((e,t)=>F.current.onCommentActiveChange(e,t),[]),xe=(0,I.useCallback)(e=>F.current.onActivateComment(e),[]);(0,I.useEffect)(()=>()=>{pe.current+=1,P.current!==null&&window.clearTimeout(P.current)},[]);let L=(0,I.useMemo)(()=>n.filter(t=>t.target.kind===`walkthrough`&&t.target.walkthroughId===e.id),[n,e.id]),Se=L.reduce((e,t)=>e+t.posts.length,0),R=(0,I.useMemo)(()=>[...L].sort((e,t)=>e.id.localeCompare(t.id)),[L]),z=i({queryKey:[`walkthrough-comment-placements`,e.id,e.body,R.map(e=>[e.id,e.target])],queryFn:async({signal:t})=>await ce(e.pullRequestId,R.map(({id:e})=>e),[{kind:`walkthrough`,walkthroughId:e.id}],t),enabled:R.length>0,staleTime:1/0}),Ce=(0,I.useMemo)(()=>{let e=new Map(z.data?.comments.map(({commentId:e,placements:t})=>[e,t[0]?.placement])??[]);return L.flatMap(t=>{let n=e.get(t.id);return n?[{comment:t,placement:n}]:[]})},[z.data,L]),we=(0,I.useMemo)(()=>Ce.filter(({placement:e})=>!e.outdated&&e.range!==null),[Ce]),Te=(0,I.useMemo)(()=>Ce.filter(({comment:e,placement:t})=>e.target.kind===`walkthrough`&&e.target.startLine===null||t.outdated),[Ce]),B=S({mutationFn:async({range:t,body:n,allowChanges:r})=>await se(`/api/comments`,A({pullRequestId:e.pullRequestId,target:{kind:`walkthrough`,walkthroughId:e.id,...t?.htmlAnchor?{htmlAnchor:t.htmlAnchor,expectedDocumentHash:Array.from(new Uint8Array(await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode((t.htmlSourceBody??e.body).replace(/\r\n?/g,`
43
+ `))))).map(e=>e.toString(16).padStart(2,`0`)).join(``)}:{},startLine:t?.startLine??null,endLine:t?.endLine??null},body:n,allowChanges:r,authorLabel:`You`})),onMutate:async()=>await ee(b,e.pullRequestId),onError:()=>re(b,e.pullRequestId),onSuccess:({comment:t})=>{window.getSelection()?.removeAllRanges(),N(``),ae(!1),O(null),k(null),j(null),ne(b,e.pullRequestId,t)}}),V=(0,I.useRef)(B);V.current=B;let Ee=S({mutationFn:async()=>await se(`/api/pull-requests/${e.pullRequestId}/walkthroughs/${e.id}`,{...A({}),method:`DELETE`}),onSuccess:async()=>{y(e),await Promise.all([b.invalidateQueries({queryKey:[`walkthroughs`]}),b.invalidateQueries({queryKey:[`walkthrough`]}),b.invalidateQueries({queryKey:[`comments`]}),b.invalidateQueries({queryKey:[`change-sequence`]})])}}),De=L.filter(e=>e.resolvedAt===null).length,Oe=()=>{let e=L.length===0?`紐づくコメントはありません。`:`紐づくコメント ${L.length}件と投稿 ${Se}件も削除されます。`;window.confirm(`このウォークスルーを削除します。\n${e}\nコピー済みの参照は無効になります。\n\nこの操作は元に戻せません。`)&&Ee.mutate()},H=D?D.startLine===D.endLine?`L${D.startLine}`:`L${D.startLine}–${D.endLine}`:null,U=(0,I.useCallback)(()=>{window.getSelection()?.removeAllRanges(),V.current.reset(),N(``),O(null),k(null),j(null)},[]),ke=(0,I.useCallback)(t=>{V.current.reset(),N(``),ae(!1),O(null),k(t.htmlAnchor?{...t,htmlSourceBody:e.body}:t),j(`diagram`)},[e.body]),Ae=(0,I.useCallback)((e,t,n)=>{V.current.mutate({range:e,body:t,allowChanges:n})},[]),je=(0,I.useCallback)(async(e,t,n)=>{await V.current.mutateAsync({range:e,body:t,allowChanges:n})},[]),Me=D?(0,$.jsx)(u,{body:M,label:`${H??`選択範囲`}へコメント`,pending:B.isPending,error:B.error,validationError:void 0,placement:`line`,onBodyChange:N,onCancel:U,onSubmit:e=>B.mutate({range:D,body:M,allowChanges:e})}):null,Ne=(0,$.jsx)(xu,{walkthroughId:e.id,assets:e.assets??bu,pullRequestId:e.pullRequestId,body:e.body,diagramBindings:e.diagramBindings,references:he,placedComments:we,activeCommentId:a,navigationLine:o?.line??null,selectedRange:le===`selection`?D:null,selectionComposerOpen:le===`selection`,diagramCommentRange:oe,markdownSourceOid:e.sourceOid,draftScope:x,themePreference:c,onOpenReference:ge,onResolveReferenceForPeek:_e,onOpenCommentCodeReference:ve,onOpenRepositoryLink:ye,onCommentActiveChange:be,onActivateComment:xe,onCommentRange:ke,diagramCommentPending:B.isPending,diagramCommentError:B.error,onCancelDiagramComment:U,onSubmitDiagramComment:Ae,onCreateExpandedDiagramComment:je});return(0,$.jsxs)(`div`,{className:`walkthrough-viewer`,ref:C,children:[(0,$.jsxs)(`header`,{className:`walkthrough-viewer-header`,children:[(0,$.jsxs)(`div`,{className:`walkthrough-viewer-title`,children:[(0,$.jsx)(`span`,{className:`walkthrough-viewer-icon`,children:(0,$.jsx)(ie,{})}),(0,$.jsxs)(`div`,{className:`walkthrough-viewer-heading-copy`,children:[(0,$.jsxs)(`span`,{className:`walkthrough-kicker`,children:[`Agent-provided walkthrough · `,(0,$.jsx)(`span`,{className:`walkthrough-meta`,children:`最終更新 `}),(0,$.jsx)(`time`,{className:`walkthrough-meta`,dateTime:e.updatedAt,children:fu.format(new Date(e.updatedAt))})]}),(0,$.jsx)(`h2`,{title:e.title,children:e.title})]})]}),(0,$.jsxs)(`div`,{className:`walkthrough-viewer-actions`,children:[(0,$.jsxs)(`button`,{className:`comment-icon-button walkthrough-comment-button`,"aria-label":`ウォークスルー全体へコメント`,title:`ウォークスルー全体へコメント`,"aria-pressed":E,onClick:()=>{B.reset(),N(``),O(null),k(null),j(null),ae(e=>!e)},children:[(0,$.jsx)(p,{}),De>0&&(0,$.jsx)(`span`,{children:De})]}),(0,$.jsx)(`button`,{className:`comment-icon-button walkthrough-delete-button`,"aria-label":`ウォークスルーを削除`,title:`ウォークスルーを削除`,disabled:Ee.isPending,onClick:Oe,children:(0,$.jsx)(hu,{})})]}),ue&&(0,$.jsx)(`div`,{className:`code-reference-notice walkthrough-reference-notice`,role:`status`,"aria-live":`polite`,children:ue})]}),(0,$.jsx)(d,{error:Ee.error}),(0,$.jsx)(d,{error:z.error}),(E||Te.length>0)&&(0,$.jsxs)(`div`,{className:`walkthrough-comment-area`,children:[E&&(0,$.jsx)(u,{body:M,label:`ウォークスルー全体へコメント`,pending:B.isPending,error:B.error,validationError:void 0,placement:`file`,onBodyChange:N,onCancel:()=>{B.reset(),N(``),ae(!1)},onSubmit:e=>B.mutate({range:null,body:M,allowChanges:e})}),Te.map(({comment:t,placement:n})=>(0,$.jsx)(te,{comment:t,variant:`inline`,draftScope:x,placement:n,markdownSourceOid:e.sourceOid,themePreference:c,onActiveChange:l,onOpenCodeReference:_,onOpenRepositoryLink:v},t.id))]}),(0,$.jsx)(fe,{className:`walkthrough-markdown-surface`,selectedRange:D,composerOpen:le===`selection`,onSelection:e=>{e?(B.reset(),N(``),ae(!1),O(e),k(null),j(null)):(O(null),j(e=>e===`selection`?null:e))},onOpenComposer:()=>j(`selection`),composer:Me,children:(0,$.jsx)(`div`,{"data-pane-find-surface":!0,"data-pane-find-text":!0,children:Ne})})]})}export{Su as WalkthroughViewer};