import{j as t,r as e}from"./vendor-react-Dp9pL_Wn.js";import{b1 as n,b2 as r,b3 as i}from"./index-XoaBlZfC.js";const o=/^((?:\u2502\s*)*)[\u251c\u2514]\u2500\u2500\s*(.*)$/,a=/^\[p=([\d.]+)\]\s*(.*)$/;function c(t){const e=t.split("\n").map(t=>t.trimEnd());let n=null,r=0;for(;r<e.length&&""===e[r].trim();)r++;r<e.length&&!o.test(e[r])&&(n=e[r].trim(),r++);const i=[],c=[];for(;r<e.length;r++){const t=e[r].match(o);if(!t)continue;const[,n,l]=t,s=(n.match(/\u2502/g)??[]).length,u=l.match(a),p=u?Number(u[1]):NaN,f={probability:Number.isFinite(p)?p:null,label:u?u[2].trim():l.trim(),children:[]};for(;c.length>0&&c[c.length-1].depth>=s;)c.pop();0===c.length?i.push(f):c[c.length-1].node.children.push(f),c.push({depth:s,node:f})}return{question:n,roots:i}}const l="search_tree",s=/<search_tree>([\s\S]*?)<\/search_tree>/g;function u(t){return t.includes("<search_tree>")?t.replace(s,(t,e)=>`\n\n\`\`\`${l}\n${e.trim()}\n\`\`\`\n\n`):t}function p(e,o){if(!n(e))return t.jsx("span",{children:e},o);const a=r(e);return t.jsx("span",{children:a.map((e,n)=>{const r=i(e.style);return r?t.jsx("span",{style:r,children:e.text},n):e.text})},o)}function f({children:o}){if(!e.useMemo(()=>n(o),[o]))return o;const a=r(o);return t.jsx(t.Fragment,{children:a.map((e,n)=>{const r=i(e.style);return r?t.jsx("span",{style:r,children:e.text},n):e.text})})}const m=e.createContext(null);function d(){return e.useContext(m)}var h,x={break:!0,case:!0,chan:!0,const:!0,continue:!0,default:!0,defer:!0,else:!0,fallthrough:!0,for:!0,func:!0,go:!0,goto:!0,if:!0,import:!0,interface:!0,map:!0,package:!0,range:!0,return:!0,select:!0,struct:!0,switch:!0,type:!0,var:!0,bool:!0,byte:!0,complex64:!0,complex128:!0,float32:!0,float64:!0,int8:!0,int16:!0,int32:!0,int64:!0,string:!0,uint8:!0,uint16:!0,uint32:!0,uint64:!0,int:!0,uint:!0,uintptr:!0,error:!0,rune:!0},g={true:!0,false:!0,iota:!0,nil:!0,append:!0,cap:!0,close:!0,complex:!0,copy:!0,delete:!0,imag:!0,len:!0,make:!0,new:!0,panic:!0,print:!0,println:!0,real:!0,recover:!0},y=/[+\-*&^%:=<>!|\/]/;function b(t,e){var n,r=t.next();if('"'==r||"'"==r||"`"==r)return e.tokenize=(n=r,function(t,e){for(var r,i=!1,o=!1;null!=(r=t.next());){if(r==n&&!i){o=!0;break}i=!i&&"`"!=n&&"\\"==r}return(o||!i&&"`"!=n)&&(e.tokenize=b),"string"}),e.tokenize(t,e);if(/[\d\.]/.test(r))return"."==r?t.match(/^[0-9]+([eE][\-+]?[0-9]+)?/):"0"==r?t.match(/^[xX][0-9a-fA-F]+/)||t.match(/^0[0-7]+/):t.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/),"number";if(/[\[\]{}\(\),;\:\.]/.test(r))return h=r,null;if("/"==r){if(t.eat("*"))return e.tokenize=k,k(t,e);if(t.eat("/"))return t.skipToEnd(),"comment"}if(y.test(r))return t.eatWhile(y),"operator";t.eatWhile(/[\w\$_\xa1-\uffff]/);var i=t.current();return x.propertyIsEnumerable(i)?("case"!=i&&"default"!=i||(h="case"),"keyword"):g.propertyIsEnumerable(i)?"atom":"variable"}function k(t,e){for(var n,r=!1;n=t.next();){if("/"==n&&r){e.tokenize=b;break}r="*"==n}return"comment"}function v(t,e,n,r,i){this.indented=t,this.column=e,this.type=n,this.align=r,this.prev=i}function j(t,e,n){return t.context=new v(t.indented,e,n,null,t.context)}function z(t){if(t.context.prev){var e=t.context.type;return")"!=e&&"]"!=e&&"}"!=e||(t.indented=t.context.indented),t.context=t.context.prev}}const _={startState:function(t){return{tokenize:null,context:new v(-t,0,"top",!1),indented:0,startOfLine:!0}},token:function(t,e){var n=e.context;if(t.sol()&&(null==n.align&&(n.align=!1),e.indented=t.indentation(),e.startOfLine=!0,"case"==n.type&&(n.type="}")),t.eatSpace())return null;h=null;var r=(e.tokenize||b)(t,e);return"comment"==r||(null==n.align&&(n.align=!0),"{"==h?j(e,t.column(),"}"):"["==h?j(e,t.column(),"]"):"("==h?j(e,t.column(),")"):"case"==h?n.type="case":("}"==h&&"}"==n.type||h==n.type)&&z(e),e.startOfLine=!1),r},indent:function(t,e,n){if(t.tokenize!=b&&null!=t.tokenize)return null;var r=t.context,i=e&&e.charAt(0);if("case"==r.type&&/^(?:case|default)\b/.test(e))return t.context.type="}",r.indented;var o=i==r.type;return r.align?r.column+(o?0:1):r.indented+(o?0:n.unit)},languageData:{indentOnInput:/^\s([{}]|case |default\s*:)$/,commentTokens:{line:"//",block:{open:"/*",close:"*/"}}}},w=Object.freeze(Object.defineProperty({__proto__:null,go:_},Symbol.toStringTag,{value:"Module"}));export{f as A,l as S,m as T,u as a,w as g,c as p,p as r,d as u};
