Files
ijmuv-blog-release/frontend/assets/pug-DRx7Ny1k.js
2026-05-08 13:39:01 +08:00

1 line
6.5 KiB
JavaScript

import{javascript as e}from"./javascript-B-fbnPRa.js";var t={"{":`}`,"(":`)`,"[":`]`};function n(e){if(typeof e!=`object`)return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}var r=class t{constructor(t){this.indentUnit=t,this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=e.startState(t),this.restOfLine=``,this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag=``,this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue=``,this.indentOf=1/0,this.indentToken=``}copy(){var r=new t(this.indentUnit);return r.javaScriptLine=this.javaScriptLine,r.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,r.javaScriptArguments=this.javaScriptArguments,r.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,r.isInterpolating=this.isInterpolating,r.interpolationNesting=this.interpolationNesting,r.jsState=(e.copyState||n)(this.jsState),r.restOfLine=this.restOfLine,r.isIncludeFiltered=this.isIncludeFiltered,r.isEach=this.isEach,r.lastTag=this.lastTag,r.isAttrs=this.isAttrs,r.attrsNest=this.attrsNest.slice(),r.inAttributeName=this.inAttributeName,r.attributeIsType=this.attributeIsType,r.attrValue=this.attrValue,r.indentOf=this.indentOf,r.indentToken=this.indentToken,r}};function i(t,n){if(t.sol()&&(n.javaScriptLine=!1,n.javaScriptLineExcludesColon=!1),n.javaScriptLine){if(n.javaScriptLineExcludesColon&&t.peek()===`:`){n.javaScriptLine=!1,n.javaScriptLineExcludesColon=!1;return}var r=e.token(t,n.jsState);return t.eol()&&(n.javaScriptLine=!1),r||!0}}function a(t,n){if(n.javaScriptArguments){if(n.javaScriptArgumentsDepth===0&&t.peek()!==`(`){n.javaScriptArguments=!1;return}if(t.peek()===`(`?n.javaScriptArgumentsDepth++:t.peek()===`)`&&n.javaScriptArgumentsDepth--,n.javaScriptArgumentsDepth===0){n.javaScriptArguments=!1;return}return e.token(t,n.jsState)||!0}}function o(e){if(e.match(/^yield\b/))return`keyword`}function s(e){if(e.match(/^(?:doctype) *([^\n]+)?/))return`meta`}function c(e,t){if(e.match(`#{`))return t.isInterpolating=!0,t.interpolationNesting=0,`punctuation`}function l(t,n){if(n.isInterpolating){if(t.peek()===`}`){if(n.interpolationNesting--,n.interpolationNesting<0)return t.next(),n.isInterpolating=!1,`punctuation`}else t.peek()===`{`&&n.interpolationNesting++;return e.token(t,n.jsState)||!0}}function u(e,t){if(e.match(/^case\b/))return t.javaScriptLine=!0,`keyword`}function d(e,t){if(e.match(/^when\b/))return t.javaScriptLine=!0,t.javaScriptLineExcludesColon=!0,`keyword`}function f(e){if(e.match(/^default\b/))return`keyword`}function p(e,t){if(e.match(/^extends?\b/))return t.restOfLine=`string`,`keyword`}function m(e,t){if(e.match(/^append\b/))return t.restOfLine=`variable`,`keyword`}function h(e,t){if(e.match(/^prepend\b/))return t.restOfLine=`variable`,`keyword`}function g(e,t){if(e.match(/^block\b *(?:(prepend|append)\b)?/))return t.restOfLine=`variable`,`keyword`}function _(e,t){if(e.match(/^include\b/))return t.restOfLine=`string`,`keyword`}function v(e,t){if(e.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&e.match(`include`))return t.isIncludeFiltered=!0,`keyword`}function y(e,t){if(t.isIncludeFiltered){var n=O(e,t);return t.isIncludeFiltered=!1,t.restOfLine=`string`,n}}function b(e,t){if(e.match(/^mixin\b/))return t.javaScriptLine=!0,`keyword`}function x(e,t){if(e.match(/^\+([-\w]+)/))return e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),`variable`;if(e.match(`+#{`,!1))return e.next(),t.mixinCallAfter=!0,c(e,t)}function S(e,t){if(t.mixinCallAfter)return t.mixinCallAfter=!1,e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),!0}function C(e,t){if(e.match(/^(if|unless|else if|else)\b/))return t.javaScriptLine=!0,`keyword`}function w(e,t){if(e.match(/^(- *)?(each|for)\b/))return t.isEach=!0,`keyword`}function T(e,t){if(t.isEach){if(e.match(/^ in\b/))return t.javaScriptLine=!0,t.isEach=!1,`keyword`;if(e.sol()||e.eol())t.isEach=!1;else if(e.next()){for(;!e.match(/^ in\b/,!1)&&e.next(););return`variable`}}}function E(e,t){if(e.match(/^while\b/))return t.javaScriptLine=!0,`keyword`}function D(e,t){var n;if(n=e.match(/^(\w(?:[-:\w]*\w)?)\/?/))return t.lastTag=n[1].toLowerCase(),`tag`}function O(e,t){if(e.match(/^:([\w\-]+)/))return V(e,t),`atom`}function k(e,t){if(e.match(/^(!?=|-)/))return t.javaScriptLine=!0,`punctuation`}function A(e){if(e.match(/^#([\w-]+)/))return`builtin`}function j(e){if(e.match(/^\.([\w-]+)/))return`className`}function M(e,t){if(e.peek()==`(`)return e.next(),t.isAttrs=!0,t.attrsNest=[],t.inAttributeName=!0,t.attrValue=``,t.attributeIsType=!1,`punctuation`}function N(n,r){if(r.isAttrs){if(t[n.peek()]&&r.attrsNest.push(t[n.peek()]),r.attrsNest[r.attrsNest.length-1]===n.peek())r.attrsNest.pop();else if(n.eat(`)`))return r.isAttrs=!1,`punctuation`;if(r.inAttributeName&&n.match(/^[^=,\)!]+/))return(n.peek()===`=`||n.peek()===`!`)&&(r.inAttributeName=!1,r.jsState=e.startState(2),r.lastTag===`script`&&n.current().trim().toLowerCase()===`type`?r.attributeIsType=!0:r.attributeIsType=!1),`attribute`;var i=e.token(n,r.jsState);if(r.attrsNest.length===0&&(i===`string`||i===`variable`||i===`keyword`))try{return Function(``,`var x `+r.attrValue.replace(/,\s*$/,``).replace(/^!/,``)),r.inAttributeName=!0,r.attrValue=``,n.backUp(n.current().length),N(n,r)}catch{}return r.attrValue+=n.current(),i||!0}}function P(e,t){if(e.match(/^&attributes\b/))return t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0,`keyword`}function F(e){if(e.sol()&&e.eatSpace())return`indent`}function I(e,t){if(e.match(/^ *\/\/(-)?([^\n]*)/))return t.indentOf=e.indentation(),t.indentToken=`comment`,`comment`}function L(e){if(e.match(/^: */))return`colon`}function R(e,t){if(e.match(/^(?:\| ?| )([^\n]+)/))return`string`;if(e.match(/^(<[^\n]*)/,!1))return V(e,t),e.skipToEnd(),t.indentToken}function z(e,t){if(e.eat(`.`))return V(e,t),`dot`}function B(e){return e.next(),null}function V(e,t){t.indentOf=e.indentation(),t.indentToken=`string`}function H(e,t){if(e.sol()&&(t.restOfLine=``),t.restOfLine){e.skipToEnd();var n=t.restOfLine;return t.restOfLine=``,n}}function U(e){return new r(e)}function W(e){return e.copy()}function G(e,t){var n=H(e,t)||l(e,t)||y(e,t)||T(e,t)||N(e,t)||i(e,t)||a(e,t)||S(e,t)||o(e)||s(e)||c(e,t)||u(e,t)||d(e,t)||f(e)||p(e,t)||m(e,t)||h(e,t)||g(e,t)||_(e,t)||v(e,t)||b(e,t)||x(e,t)||C(e,t)||w(e,t)||E(e,t)||D(e,t)||O(e,t)||k(e,t)||A(e)||j(e)||M(e,t)||P(e,t)||F(e)||R(e,t)||I(e,t)||L(e)||z(e,t)||B(e);return n===!0?null:n}var K={startState:U,copyState:W,token:G};export{K as pug};