@genai-fi/nanogpt 1.6.1 → 1.7.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.
- package/dist/{binary_op_util-WY9YIl0q.js → Reshape-CqftURg0.js} +75 -60
- package/dist/TeachableLLM.d.ts +12 -12
- package/dist/api/beamer.d.ts +4 -4
- package/dist/api/responses.d.ts +4 -4
- package/dist/api/training.d.ts +9 -9
- package/dist/backend.d.ts +1 -1
- package/dist/backend_util-DZIc6pyV.js +1081 -0
- package/dist/checks/index.d.ts +11 -11
- package/dist/checks/weights.d.ts +1 -1
- package/dist/data/docx.d.ts +1 -1
- package/dist/data/pdf.d.ts +1 -1
- package/dist/data/stream.d.ts +1 -1
- package/dist/data/textLoader.d.ts +1 -1
- package/dist/data.d.ts +3 -3
- package/dist/device-CZPGtQBU.js +9 -0
- package/dist/device.d.ts +2 -0
- package/dist/{dist-DeVH1nGn.js → dist-DiszGjH-.js} +1833 -1844
- package/dist/{dist-CMMLi-qO.js → dist-JOPw9zTN.js} +69 -11
- package/dist/inference/Beamer.d.ts +3 -3
- package/dist/inference/Generator.d.ts +4 -4
- package/dist/inference/tokenisePrompt.d.ts +2 -2
- package/dist/inference/types.d.ts +1 -1
- package/dist/inference/utilities.d.ts +1 -1
- package/dist/layers/BaseLayer.d.ts +5 -4
- package/dist/layers/GQA.d.ts +24 -26
- package/dist/layers/HeadLayer.d.ts +2 -2
- package/dist/layers/LoRA.d.ts +1 -1
- package/dist/layers/MHA.d.ts +3 -4
- package/dist/layers/MLP.d.ts +2 -2
- package/dist/layers/PositionEmbedding.d.ts +3 -3
- package/dist/layers/RMSNorm.d.ts +2 -2
- package/dist/layers/RoPECache.d.ts +2 -1
- package/dist/layers/TiedEmbedding.d.ts +2 -2
- package/dist/layers/TransformerBlock.d.ts +9 -6
- package/dist/layers.d.ts +4 -4
- package/dist/loader/load.d.ts +1 -1
- package/dist/loader/loadHF.d.ts +3 -3
- package/dist/loader/loadTransformers.d.ts +2 -2
- package/dist/loader/loadZipMeta.d.ts +2 -2
- package/dist/loader/newZipLoad.d.ts +2 -2
- package/dist/loader/oldZipLoad.d.ts +4 -4
- package/dist/loader/save.d.ts +5 -5
- package/dist/loader/types.d.ts +23 -10
- package/dist/main.d.ts +40 -24
- package/dist/matMul16-CiMKJM8v.js +2610 -0
- package/dist/models/Llama.d.ts +2 -2
- package/dist/models/LoopNano.d.ts +16 -0
- package/dist/models/NanoGPTV1.d.ts +2 -2
- package/dist/models/NanoGPTV2.d.ts +2 -2
- package/dist/models/Qwen3.d.ts +2 -2
- package/dist/models/config.d.ts +11 -1
- package/dist/models/factory.d.ts +2 -2
- package/dist/models/model.d.ts +6 -6
- package/dist/models.d.ts +4 -4
- package/dist/nanogpt.js +37041 -0
- package/dist/ops/adamAdjust.d.ts +2 -0
- package/dist/ops/adamMoments.d.ts +2 -0
- package/dist/ops/adamW.d.ts +2 -0
- package/dist/ops/add16.d.ts +1 -0
- package/dist/ops/appendCache.d.ts +2 -0
- package/dist/ops/attentionMask.d.ts +11 -1
- package/dist/ops/dropout16.d.ts +2 -0
- package/dist/ops/gatherSub.d.ts +2 -0
- package/dist/ops/gelu.d.ts +3 -0
- package/dist/ops/log.d.ts +1 -0
- package/dist/ops/matMul16.d.ts +4 -0
- package/dist/ops/matMulGelu.d.ts +3 -0
- package/dist/ops/matMulMul.d.ts +2 -0
- package/dist/ops/mul16.d.ts +1 -0
- package/dist/ops/mulDrop.d.ts +2 -0
- package/dist/ops/normRMS.d.ts +3 -0
- package/dist/ops/pack16.d.ts +1 -0
- package/dist/ops/qkv.d.ts +13 -1
- package/dist/ops/rope.d.ts +4 -1
- package/dist/ops/scatterSub.d.ts +4 -1
- package/dist/ops/silu.d.ts +1 -0
- package/dist/ops/softmax16.d.ts +1 -0
- package/dist/ops/sparseCrossEntropy.d.ts +15 -0
- package/dist/ops/unpack16.d.ts +1 -0
- package/dist/ops/webgl/sparseCrossEntropy.d.ts +1 -0
- package/dist/ops/webgpu/adamW.d.ts +1 -0
- package/dist/ops/webgpu/concat16.d.ts +16 -0
- package/dist/ops/webgpu/index.d.ts +29 -0
- package/dist/ops/webgpu/normRMS16_program.d.ts +2 -2
- package/dist/ops/webgpu/normRMS32_program.d.ts +2 -2
- package/dist/ops/webgpu/pack16_program.d.ts +1 -1
- package/dist/ops/webgpu/softmax16_program.d.ts +16 -0
- package/dist/ops/webgpu/sparseCrossEntropy.d.ts +1 -0
- package/dist/ops/webgpu/utils/binary_op.d.ts +16 -0
- package/dist/ops/webgpu/utils/deviceInfo.d.ts +1 -1
- package/dist/ops/webgpu/utils/reductions.d.ts +1 -1
- package/dist/patches/webgpu_backend.d.ts +2 -1
- package/dist/patches/webgpu_base.d.ts +0 -1
- package/dist/patches/webgpu_program.d.ts +21 -0
- package/dist/{shared-BIDMUBCs.js → shared-BARkvvG4.js} +587 -505
- package/dist/tokenise.d.ts +4 -4
- package/dist/tokeniser/BaseTokeniser.d.ts +3 -3
- package/dist/tokeniser/CharTokeniser.d.ts +2 -2
- package/dist/tokeniser/bpe.d.ts +2 -2
- package/dist/tokeniser/type.d.ts +2 -2
- package/dist/training/AdamW.d.ts +19 -2
- package/dist/training/BasicTrainer.d.ts +5 -5
- package/dist/training/DatasetBuilder.d.ts +2 -2
- package/dist/training/Evaluator.d.ts +1 -1
- package/dist/training/LRScheduler.d.ts +1 -1
- package/dist/training/PreTrainer.d.ts +6 -6
- package/dist/training/SFTTrainer.d.ts +6 -6
- package/dist/training/configure.d.ts +2 -2
- package/dist/training/factory.d.ts +6 -5
- package/dist/training/prepareData.d.ts +6 -6
- package/dist/training/tasks/tokenStream.d.ts +3 -3
- package/dist/training/types.d.ts +6 -5
- package/dist/training/validateOptions.d.ts +1 -1
- package/dist/training/validation.d.ts +3 -3
- package/dist/utilities/datasetID.d.ts +1 -1
- package/dist/utilities/dummy.d.ts +1 -1
- package/dist/utilities/packed.d.ts +1 -1
- package/dist/utilities/parameters.d.ts +1 -1
- package/dist/utilities/sentences.d.ts +1 -1
- package/dist/utilities/waitForModel.d.ts +1 -1
- package/dist/webgpu-D4syGmzo.js +3221 -0
- package/dist/webgpu-wUCQopBN.js +1007 -0
- package/dist/{webgpu_program-DvkFqRlR.js → webgpu_backend-CzY9TzvA.js} +174 -223
- package/dist/{patches/webgpu_base.js → webgpu_base-Bjg7okYf.js} +6 -9
- package/package.json +12 -9
- package/dist/DatasetBuilder-DRDW8tcM.js +0 -731
- package/dist/Generator-8IK28IWR.js +0 -316
- package/dist/RealDiv-Cl8k3YTx.js +0 -354
- package/dist/Reshape-CKxKPKqi.js +0 -91
- package/dist/Reshape-H5zZRgr9.js +0 -16
- package/dist/RoPECache-dYscFINl.js +0 -722
- package/dist/TeachableLLM.js +0 -220
- package/dist/api/beamer.js +0 -61
- package/dist/api/responses.js +0 -177
- package/dist/api/training.js +0 -215
- package/dist/axis_util-rF9RnwKE.js +0 -37
- package/dist/backend.js +0 -12
- package/dist/backend_util-Cpp0Gwlp.js +0 -394
- package/dist/broadcast_to-CGvLNiQ0.js +0 -20
- package/dist/checks/appendCache.js +0 -55
- package/dist/checks/attentionMask.js +0 -57
- package/dist/checks/check.js +0 -31
- package/dist/checks/gelu.js +0 -46
- package/dist/checks/index.js +0 -27
- package/dist/checks/matMulGelu.js +0 -84
- package/dist/checks/normRMS.js +0 -30
- package/dist/checks/normRMSGrad.js +0 -23
- package/dist/checks/packUnpack.js +0 -46
- package/dist/checks/qkv.js +0 -1
- package/dist/checks/rope.js +0 -30
- package/dist/checks/weights.js +0 -26
- package/dist/clip_by_value-D-UX9am5.js +0 -13
- package/dist/complex-Cl904TqN.js +0 -13
- package/dist/complex_util-BBlPAm-s.js +0 -59
- package/dist/concat-Oip5acVY.js +0 -14
- package/dist/concat_util-CY45Hf4F.js +0 -18
- package/dist/data/docx.js +0 -17
- package/dist/data/pdf.js +0 -14
- package/dist/data/stream.js +0 -1
- package/dist/data/textLoader.js +0 -575
- package/dist/data-CV_i_H6B.js +0 -11
- package/dist/data.js +0 -5
- package/dist/dist-DyL7qSLJ.js +0 -7809
- package/dist/dropout16-CA31Ud5a.js +0 -20
- package/dist/dropout_util-SiFMbFXz.js +0 -22
- package/dist/eventemitter3-wmfmOP_f.js +0 -90
- package/dist/expand_dims-Dh3Fulyn.js +0 -10
- package/dist/floor-BwjmUb7X.js +0 -8
- package/dist/gather-B5Z1RFt5.js +0 -14
- package/dist/gatherSub-CRUfUzBa.js +0 -22
- package/dist/gelu-Xx9-ohH9.js +0 -25
- package/dist/gpgpu_math-48m8q3jI.js +0 -1591
- package/dist/inference/Beamer.js +0 -215
- package/dist/inference/Generator.js +0 -1
- package/dist/inference/tokenisePrompt.js +0 -17
- package/dist/inference/types.js +0 -0
- package/dist/inference/utilities.js +0 -31
- package/dist/jszip.min-Btv48m44.js +0 -3037
- package/dist/kernel_funcs_utils-BYRpSfV_.js +0 -229
- package/dist/layers/BaseLayer.js +0 -75
- package/dist/layers/GQA.js +0 -102
- package/dist/layers/HeadLayer.js +0 -28
- package/dist/layers/LoRA.js +0 -45
- package/dist/layers/MHA.js +0 -102
- package/dist/layers/MLP.js +0 -47
- package/dist/layers/PositionEmbedding.js +0 -28
- package/dist/layers/RMSNorm.js +0 -25
- package/dist/layers/RoPECache.js +0 -1
- package/dist/layers/TiedEmbedding.js +0 -33
- package/dist/layers/TransformerBlock.js +0 -50
- package/dist/layers/WeightStore.js +0 -68
- package/dist/layers-CFqEip3s.js +0 -13
- package/dist/layers.js +0 -6
- package/dist/loader/load.js +0 -63
- package/dist/loader/loadHF.js +0 -17
- package/dist/loader/loadTransformers.js +0 -61
- package/dist/loader/loadZipMeta.js +0 -15
- package/dist/loader/newZipLoad.js +0 -24
- package/dist/loader/oldZipLoad.js +0 -36
- package/dist/loader/save.js +0 -89
- package/dist/loader/types.js +0 -0
- package/dist/main.js +0 -12145
- package/dist/matMul16-tE26fnhf.js +0 -87
- package/dist/matMulGelu-ASUWlKqu.js +0 -162
- package/dist/mat_mul-R9_DWmIT.js +0 -16
- package/dist/models/Llama.js +0 -88
- package/dist/models/NanoGPTV1.js +0 -94
- package/dist/models/NanoGPTV2.js +0 -85
- package/dist/models/Qwen3.js +0 -88
- package/dist/models/config.js +0 -32
- package/dist/models/factory.js +0 -16
- package/dist/models/model.js +0 -75
- package/dist/models-DyBpJJwM.js +0 -13
- package/dist/models.js +0 -6
- package/dist/mul16-C7sqgqik.js +0 -41
- package/dist/non_max_suppression_impl-B0H318rb.js +0 -72
- package/dist/not_equal-Bu3O8rh_.js +0 -67
- package/dist/one_hot-TEMPumJj.js +0 -14
- package/dist/ones-DpPXWa6A.js +0 -13
- package/dist/ops/adamAdjust.js +0 -17
- package/dist/ops/adamMoments.js +0 -15
- package/dist/ops/add16.js +0 -11
- package/dist/ops/appendCache.js +0 -26
- package/dist/ops/attentionMask.js +0 -19
- package/dist/ops/concat16.js +0 -8
- package/dist/ops/cpu/adamAdjust.js +0 -15
- package/dist/ops/cpu/adamMoments.js +0 -16
- package/dist/ops/cpu/appendCache.js +0 -65
- package/dist/ops/cpu/attentionMask.js +0 -20
- package/dist/ops/cpu/fusedSoftmax.js +0 -22
- package/dist/ops/cpu/gatherSub.js +0 -1
- package/dist/ops/cpu/gelu.js +0 -35
- package/dist/ops/cpu/matMul16.js +0 -14
- package/dist/ops/cpu/matMulGelu.js +0 -44
- package/dist/ops/cpu/matMulMul.js +0 -19
- package/dist/ops/cpu/mulDropout.js +0 -19
- package/dist/ops/cpu/normRMS.js +0 -34
- package/dist/ops/cpu/qkv.js +0 -74
- package/dist/ops/cpu/rope.js +0 -84
- package/dist/ops/cpu/scatterSub.js +0 -1
- package/dist/ops/dot16.js +0 -28
- package/dist/ops/dropout.js +0 -12
- package/dist/ops/dropout16.js +0 -1
- package/dist/ops/gatherSub.js +0 -12
- package/dist/ops/gelu.js +0 -1
- package/dist/ops/globalNorm.js +0 -19
- package/dist/ops/grads/add16.js +0 -26
- package/dist/ops/grads/attentionMask.js +0 -25
- package/dist/ops/grads/dropout16.js +0 -1
- package/dist/ops/grads/gelu.js +0 -1
- package/dist/ops/grads/matMul16.js +0 -1
- package/dist/ops/grads/matMulGelu.js +0 -21
- package/dist/ops/grads/mul16.js +0 -1
- package/dist/ops/grads/normRMS.js +0 -36
- package/dist/ops/grads/pack16.js +0 -1
- package/dist/ops/grads/qkv.js +0 -46
- package/dist/ops/grads/rope.js +0 -1
- package/dist/ops/grads/silu.js +0 -1
- package/dist/ops/grads/softmax16.js +0 -22
- package/dist/ops/grads/unpack16.js +0 -1
- package/dist/ops/grads/utils.js +0 -11
- package/dist/ops/log.js +0 -1
- package/dist/ops/matMul16.js +0 -1
- package/dist/ops/matMulGelu.js +0 -19
- package/dist/ops/matMulMul.js +0 -15
- package/dist/ops/mul16.js +0 -1
- package/dist/ops/mulDrop.js +0 -14
- package/dist/ops/normRMS.js +0 -21
- package/dist/ops/pack16.js +0 -1
- package/dist/ops/qkv.js +0 -15
- package/dist/ops/reshape16.js +0 -33
- package/dist/ops/rope.js +0 -1
- package/dist/ops/scatterSub.js +0 -12
- package/dist/ops/silu.js +0 -1
- package/dist/ops/slice16.js +0 -11
- package/dist/ops/softmax16.js +0 -8
- package/dist/ops/sub16.js +0 -10
- package/dist/ops/sum16.js +0 -13
- package/dist/ops/transpose16.js +0 -33
- package/dist/ops/unpack16.js +0 -1
- package/dist/ops/webgl/adamAdjust.js +0 -81
- package/dist/ops/webgl/adamMoments.js +0 -43
- package/dist/ops/webgl/appendCache.js +0 -52
- package/dist/ops/webgl/attentionMask.js +0 -63
- package/dist/ops/webgl/dropout16.js +0 -11
- package/dist/ops/webgl/fusedSoftmax.js +0 -70
- package/dist/ops/webgl/gatherSub.js +0 -27
- package/dist/ops/webgl/gelu.js +0 -47
- package/dist/ops/webgl/log.js +0 -14
- package/dist/ops/webgl/matMul16.js +0 -48
- package/dist/ops/webgl/matMulGelu.js +0 -1
- package/dist/ops/webgl/matMulMul.js +0 -23
- package/dist/ops/webgl/mulDropout.js +0 -31
- package/dist/ops/webgl/normRMS.js +0 -115
- package/dist/ops/webgl/qkv.js +0 -53
- package/dist/ops/webgl/rope.js +0 -73
- package/dist/ops/webgl/scatterSub.js +0 -27
- package/dist/ops/webgpu/adamAdjust.js +0 -76
- package/dist/ops/webgpu/adamMoments.js +0 -75
- package/dist/ops/webgpu/add16.js +0 -13
- package/dist/ops/webgpu/appendCache.js +0 -129
- package/dist/ops/webgpu/attentionMask.js +0 -41
- package/dist/ops/webgpu/attentionMask32_program.js +0 -61
- package/dist/ops/webgpu/clipScale.js +0 -44
- package/dist/ops/webgpu/concat16.js +0 -110
- package/dist/ops/webgpu/dropout16.js +0 -58
- package/dist/ops/webgpu/gatherSub.js +0 -51
- package/dist/ops/webgpu/gelu.js +0 -146
- package/dist/ops/webgpu/index.js +0 -27
- package/dist/ops/webgpu/matMul16.js +0 -91
- package/dist/ops/webgpu/matMul16_program.js +0 -311
- package/dist/ops/webgpu/mul16.js +0 -13
- package/dist/ops/webgpu/norm2.js +0 -45
- package/dist/ops/webgpu/normRMS.js +0 -25
- package/dist/ops/webgpu/normRMS16_program.js +0 -28
- package/dist/ops/webgpu/normRMS32_program.js +0 -28
- package/dist/ops/webgpu/normRMSGrad.js +0 -225
- package/dist/ops/webgpu/pack16.js +0 -20
- package/dist/ops/webgpu/pack16_program.js +0 -92
- package/dist/ops/webgpu/qkv.js +0 -63
- package/dist/ops/webgpu/rope.js +0 -227
- package/dist/ops/webgpu/scatterSub.js +0 -52
- package/dist/ops/webgpu/silu.js +0 -117
- package/dist/ops/webgpu/slice16.js +0 -73
- package/dist/ops/webgpu/softmax16.js +0 -18
- package/dist/ops/webgpu/softmax16_program.js +0 -88
- package/dist/ops/webgpu/softmax16_subgroup_program.js +0 -69
- package/dist/ops/webgpu/softmax16grad.js +0 -30
- package/dist/ops/webgpu/sub16.js +0 -13
- package/dist/ops/webgpu/sum16.js +0 -30
- package/dist/ops/webgpu/transpose16.js +0 -38
- package/dist/ops/webgpu/transpose16_program.js +0 -50
- package/dist/ops/webgpu/transpose16_shared_program.js +0 -78
- package/dist/ops/webgpu/unpack16.js +0 -59
- package/dist/ops/webgpu/utils/binary_op.js +0 -140
- package/dist/ops/webgpu/utils/deviceInfo.js +0 -10
- package/dist/ops/webgpu/utils/reductions.js +0 -264
- package/dist/ops-Be5ACU5R.js +0 -13
- package/dist/ops-C1UpdEYM.js +0 -509
- package/dist/pack16-BHO4t1-M.js +0 -36
- package/dist/pad-Dy-1IP3A.js +0 -13
- package/dist/patches/webgpu_backend.js +0 -42
- package/dist/patches/webgpu_program.js +0 -292
- package/dist/picomatch--TW6gyBJ.js +0 -999
- package/dist/qkv-BQfNPucX.js +0 -42
- package/dist/rand_util-_vCY93Uw.js +0 -44
- package/dist/random_normal-DUIT8kyC.js +0 -11
- package/dist/range-CYvQC3fW.js +0 -13
- package/dist/relu-C4XULT8A.js +0 -8
- package/dist/reshape-DJb1jgMt.js +0 -8
- package/dist/resize_nearest_neighbor-DAqcTYUe.js +0 -188
- package/dist/rope-JjBVufF_.js +0 -24
- package/dist/scatterSub-BOnqk-uY.js +0 -27
- package/dist/scatter_nd_util-BepMCpLY.js +0 -34
- package/dist/seedrandom-SHEGFK6H.js +0 -282
- package/dist/selu_util-DeOTf-sc.js +0 -27
- package/dist/shared-CX_iPI5K.js +0 -4
- package/dist/silu-DsAE2cJ5.js +0 -23
- package/dist/slice-Dlb1FlzG.js +0 -13
- package/dist/slice_util-BVgPRoij.js +0 -207
- package/dist/softmax-Dpav_dWw.js +0 -10
- package/dist/split-DYnT8chz.js +0 -11
- package/dist/squeeze-B3XYGAlg.js +0 -9
- package/dist/stack-Dbbt9mIk.js +0 -10
- package/dist/step-DA-5DNu9.js +0 -348
- package/dist/stream-BBe2apn4.js +0 -2280
- package/dist/sum-C8qNbFNp.js +0 -13
- package/dist/tensor-ALxWZfmz.js +0 -7
- package/dist/tensor1d-BHgkkhTE.js +0 -9
- package/dist/tensor2d-ARItvqVn.js +0 -10
- package/dist/tensor4d-D1zRBipJ.js +0 -10
- package/dist/tfjs_backend-CsXOum0h.js +0 -685
- package/dist/tile-DfyQ0KX-.js +0 -10
- package/dist/tokenise-DbS2Ea-T.js +0 -14
- package/dist/tokenise.js +0 -6
- package/dist/tokeniser/BaseTokeniser.js +0 -137
- package/dist/tokeniser/CharTokeniser.js +0 -85
- package/dist/tokeniser/bpe.js +0 -156
- package/dist/tokeniser/messages.js +0 -0
- package/dist/tokeniser/type.js +0 -0
- package/dist/topk-BrU2pkrR.js +0 -19
- package/dist/training/AdamW.js +0 -132
- package/dist/training/BasicTrainer.js +0 -274
- package/dist/training/DatasetBuilder.js +0 -1
- package/dist/training/Evaluator.js +0 -51
- package/dist/training/LRScheduler.js +0 -37
- package/dist/training/PreTrainer.js +0 -21
- package/dist/training/SFTTrainer.js +0 -23
- package/dist/training/configure.js +0 -33
- package/dist/training/factory.js +0 -7
- package/dist/training/loss.js +0 -18
- package/dist/training/orthoGrad.js +0 -9
- package/dist/training/prepareData.js +0 -51
- package/dist/training/sparseCrossEntropy.js +0 -53
- package/dist/training/tasks/TokenStore.js +0 -217
- package/dist/training/tasks/tokenStream.js +0 -45
- package/dist/training/types.js +0 -0
- package/dist/training/validateOptions.js +0 -18
- package/dist/training/validation.js +0 -30
- package/dist/transpose-BC-M_OoT.js +0 -34
- package/dist/unsorted_segment_sum-BelC7R-q.js +0 -408
- package/dist/utilities/arrayClose.js +0 -29
- package/dist/utilities/arrayShape.js +0 -7
- package/dist/utilities/datasetID.js +0 -17
- package/dist/utilities/dummy.js +0 -36
- package/dist/utilities/float16.js +0 -46
- package/dist/utilities/maxHeap.js +0 -54
- package/dist/utilities/multinomialCPU.js +0 -7
- package/dist/utilities/naming.js +0 -0
- package/dist/utilities/packed.js +0 -12
- package/dist/utilities/parameters.js +0 -53
- package/dist/utilities/performance.js +0 -15
- package/dist/utilities/profile.js +0 -32
- package/dist/utilities/random.js +0 -18
- package/dist/utilities/safetensors.js +0 -63
- package/dist/utilities/sentences.js +0 -35
- package/dist/utilities/tokenParse.js +0 -16
- package/dist/utilities/tokens.js +0 -39
- package/dist/utilities/topP.js +0 -25
- package/dist/utilities/waitForModel.js +0 -11
- package/dist/utilities/weights.js +0 -40
- package/dist/utilities/yielder.js +0 -6
- package/dist/v4-YCkfo8OR.js +0 -27
- package/dist/webgpu-BHX-uBym.js +0 -518
- package/dist/webgpu_util-5QTyovaf.js +0 -105
- package/dist/zeros-hxKGkRfl.js +0 -12
|
@@ -1,999 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-CwxnZyOB.js";
|
|
2
|
-
import { rt as t } from "./dist-CMMLi-qO.js";
|
|
3
|
-
// node_modules/@tensorflow/tfjs-core/dist/ops/variable.js
|
|
4
|
-
function n(e, n = !0, r, i) {
|
|
5
|
-
return t.makeVariable(e, n, r, i);
|
|
6
|
-
}
|
|
7
|
-
// node_modules/picomatch/lib/constants.js
|
|
8
|
-
var r = /* @__PURE__ */ e(((e, t) => {
|
|
9
|
-
var n = "\\\\/", r = `[^${n}]`, i = 0, a = "\\.", o = "\\+", s = "\\?", c = "\\/", l = "(?=.)", u = "[^/]", d = `(?:${c}|$)`, f = `(?:^|${c})`, p = `${a}{1,2}${d}`, m = {
|
|
10
|
-
DOT_LITERAL: a,
|
|
11
|
-
PLUS_LITERAL: o,
|
|
12
|
-
QMARK_LITERAL: s,
|
|
13
|
-
SLASH_LITERAL: c,
|
|
14
|
-
ONE_CHAR: l,
|
|
15
|
-
QMARK: u,
|
|
16
|
-
END_ANCHOR: d,
|
|
17
|
-
DOTS_SLASH: p,
|
|
18
|
-
NO_DOT: `(?!${a})`,
|
|
19
|
-
NO_DOTS: `(?!${f}${p})`,
|
|
20
|
-
NO_DOT_SLASH: `(?!${a}{0,1}${d})`,
|
|
21
|
-
NO_DOTS_SLASH: `(?!${p})`,
|
|
22
|
-
QMARK_NO_DOT: `[^.${c}]`,
|
|
23
|
-
STAR: `${u}*?`,
|
|
24
|
-
START_ANCHOR: f,
|
|
25
|
-
SEP: "/"
|
|
26
|
-
}, h = {
|
|
27
|
-
...m,
|
|
28
|
-
SLASH_LITERAL: `[${n}]`,
|
|
29
|
-
QMARK: r,
|
|
30
|
-
STAR: `${r}*?`,
|
|
31
|
-
DOTS_SLASH: `${a}{1,2}(?:[${n}]|$)`,
|
|
32
|
-
NO_DOT: `(?!${a})`,
|
|
33
|
-
NO_DOTS: `(?!(?:^|[${n}])${a}{1,2}(?:[${n}]|$))`,
|
|
34
|
-
NO_DOT_SLASH: `(?!${a}{0,1}(?:[${n}]|$))`,
|
|
35
|
-
NO_DOTS_SLASH: `(?!${a}{1,2}(?:[${n}]|$))`,
|
|
36
|
-
QMARK_NO_DOT: `[^.${n}]`,
|
|
37
|
-
START_ANCHOR: `(?:^|[${n}])`,
|
|
38
|
-
END_ANCHOR: `(?:[${n}]|$)`,
|
|
39
|
-
SEP: "\\"
|
|
40
|
-
};
|
|
41
|
-
t.exports = {
|
|
42
|
-
DEFAULT_MAX_EXTGLOB_RECURSION: i,
|
|
43
|
-
MAX_LENGTH: 65536,
|
|
44
|
-
POSIX_REGEX_SOURCE: {
|
|
45
|
-
__proto__: null,
|
|
46
|
-
alnum: "a-zA-Z0-9",
|
|
47
|
-
alpha: "a-zA-Z",
|
|
48
|
-
ascii: "\\x00-\\x7F",
|
|
49
|
-
blank: " \\t",
|
|
50
|
-
cntrl: "\\x00-\\x1F\\x7F",
|
|
51
|
-
digit: "0-9",
|
|
52
|
-
graph: "\\x21-\\x7E",
|
|
53
|
-
lower: "a-z",
|
|
54
|
-
print: "\\x20-\\x7E ",
|
|
55
|
-
punct: "\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",
|
|
56
|
-
space: " \\t\\r\\n\\v\\f",
|
|
57
|
-
upper: "A-Z",
|
|
58
|
-
word: "A-Za-z0-9_",
|
|
59
|
-
xdigit: "A-Fa-f0-9"
|
|
60
|
-
},
|
|
61
|
-
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
|
|
62
|
-
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
|
|
63
|
-
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
|
|
64
|
-
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
|
|
65
|
-
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
|
|
66
|
-
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
|
|
67
|
-
REPLACEMENTS: {
|
|
68
|
-
__proto__: null,
|
|
69
|
-
"***": "*",
|
|
70
|
-
"**/**": "**",
|
|
71
|
-
"**/**/**": "**"
|
|
72
|
-
},
|
|
73
|
-
CHAR_0: 48,
|
|
74
|
-
CHAR_9: 57,
|
|
75
|
-
CHAR_UPPERCASE_A: 65,
|
|
76
|
-
CHAR_LOWERCASE_A: 97,
|
|
77
|
-
CHAR_UPPERCASE_Z: 90,
|
|
78
|
-
CHAR_LOWERCASE_Z: 122,
|
|
79
|
-
CHAR_LEFT_PARENTHESES: 40,
|
|
80
|
-
CHAR_RIGHT_PARENTHESES: 41,
|
|
81
|
-
CHAR_ASTERISK: 42,
|
|
82
|
-
CHAR_AMPERSAND: 38,
|
|
83
|
-
CHAR_AT: 64,
|
|
84
|
-
CHAR_BACKWARD_SLASH: 92,
|
|
85
|
-
CHAR_CARRIAGE_RETURN: 13,
|
|
86
|
-
CHAR_CIRCUMFLEX_ACCENT: 94,
|
|
87
|
-
CHAR_COLON: 58,
|
|
88
|
-
CHAR_COMMA: 44,
|
|
89
|
-
CHAR_DOT: 46,
|
|
90
|
-
CHAR_DOUBLE_QUOTE: 34,
|
|
91
|
-
CHAR_EQUAL: 61,
|
|
92
|
-
CHAR_EXCLAMATION_MARK: 33,
|
|
93
|
-
CHAR_FORM_FEED: 12,
|
|
94
|
-
CHAR_FORWARD_SLASH: 47,
|
|
95
|
-
CHAR_GRAVE_ACCENT: 96,
|
|
96
|
-
CHAR_HASH: 35,
|
|
97
|
-
CHAR_HYPHEN_MINUS: 45,
|
|
98
|
-
CHAR_LEFT_ANGLE_BRACKET: 60,
|
|
99
|
-
CHAR_LEFT_CURLY_BRACE: 123,
|
|
100
|
-
CHAR_LEFT_SQUARE_BRACKET: 91,
|
|
101
|
-
CHAR_LINE_FEED: 10,
|
|
102
|
-
CHAR_NO_BREAK_SPACE: 160,
|
|
103
|
-
CHAR_PERCENT: 37,
|
|
104
|
-
CHAR_PLUS: 43,
|
|
105
|
-
CHAR_QUESTION_MARK: 63,
|
|
106
|
-
CHAR_RIGHT_ANGLE_BRACKET: 62,
|
|
107
|
-
CHAR_RIGHT_CURLY_BRACE: 125,
|
|
108
|
-
CHAR_RIGHT_SQUARE_BRACKET: 93,
|
|
109
|
-
CHAR_SEMICOLON: 59,
|
|
110
|
-
CHAR_SINGLE_QUOTE: 39,
|
|
111
|
-
CHAR_SPACE: 32,
|
|
112
|
-
CHAR_TAB: 9,
|
|
113
|
-
CHAR_UNDERSCORE: 95,
|
|
114
|
-
CHAR_VERTICAL_LINE: 124,
|
|
115
|
-
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
|
|
116
|
-
extglobChars(e) {
|
|
117
|
-
return {
|
|
118
|
-
"!": {
|
|
119
|
-
type: "negate",
|
|
120
|
-
open: "(?:(?!(?:",
|
|
121
|
-
close: `))${e.STAR})`
|
|
122
|
-
},
|
|
123
|
-
"?": {
|
|
124
|
-
type: "qmark",
|
|
125
|
-
open: "(?:",
|
|
126
|
-
close: ")?"
|
|
127
|
-
},
|
|
128
|
-
"+": {
|
|
129
|
-
type: "plus",
|
|
130
|
-
open: "(?:",
|
|
131
|
-
close: ")+"
|
|
132
|
-
},
|
|
133
|
-
"*": {
|
|
134
|
-
type: "star",
|
|
135
|
-
open: "(?:",
|
|
136
|
-
close: ")*"
|
|
137
|
-
},
|
|
138
|
-
"@": {
|
|
139
|
-
type: "at",
|
|
140
|
-
open: "(?:",
|
|
141
|
-
close: ")"
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
},
|
|
145
|
-
globChars(e) {
|
|
146
|
-
return e === !0 ? h : m;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
})), i = /* @__PURE__ */ e(((e) => {
|
|
150
|
-
var { REGEX_BACKSLASH: t, REGEX_REMOVE_BACKSLASH: n, REGEX_SPECIAL_CHARS: i, REGEX_SPECIAL_CHARS_GLOBAL: a } = r();
|
|
151
|
-
e.isObject = (e) => typeof e == "object" && !!e && !Array.isArray(e), e.hasRegexChars = (e) => i.test(e), e.isRegexChar = (t) => t.length === 1 && e.hasRegexChars(t), e.escapeRegex = (e) => e.replace(a, "\\$1"), e.toPosixSlashes = (e) => e.replace(t, "/"), e.isWindows = () => {
|
|
152
|
-
if (typeof navigator < "u" && navigator.platform) {
|
|
153
|
-
let e = navigator.platform.toLowerCase();
|
|
154
|
-
return e === "win32" || e === "windows";
|
|
155
|
-
}
|
|
156
|
-
return typeof process < "u" && process.platform ? process.platform === "win32" : !1;
|
|
157
|
-
}, e.removeBackslashes = (e) => e.replace(n, (e) => e === "\\" ? "" : e), e.escapeLast = (t, n, r) => {
|
|
158
|
-
let i = t.lastIndexOf(n, r);
|
|
159
|
-
return i === -1 ? t : t[i - 1] === "\\" ? e.escapeLast(t, n, i - 1) : `${t.slice(0, i)}\\${t.slice(i)}`;
|
|
160
|
-
}, e.removePrefix = (e, t = {}) => {
|
|
161
|
-
let n = e;
|
|
162
|
-
return n.startsWith("./") && (n = n.slice(2), t.prefix = "./"), n;
|
|
163
|
-
}, e.wrapOutput = (e, t = {}, n = {}) => {
|
|
164
|
-
let r = `${n.contains ? "" : "^"}(?:${e})${n.contains ? "" : "$"}`;
|
|
165
|
-
return t.negated === !0 && (r = `(?:^(?!${r}).*$)`), r;
|
|
166
|
-
}, e.basename = (e, { windows: t } = {}) => {
|
|
167
|
-
let n = e.split(t ? /[\\/]/ : "/"), r = n[n.length - 1];
|
|
168
|
-
return r === "" ? n[n.length - 2] : r;
|
|
169
|
-
};
|
|
170
|
-
})), a = /* @__PURE__ */ e(((e, t) => {
|
|
171
|
-
var n = i(), { CHAR_ASTERISK: a, CHAR_AT: o, CHAR_BACKWARD_SLASH: s, CHAR_COMMA: c, CHAR_DOT: l, CHAR_EXCLAMATION_MARK: u, CHAR_FORWARD_SLASH: d, CHAR_LEFT_CURLY_BRACE: f, CHAR_LEFT_PARENTHESES: p, CHAR_LEFT_SQUARE_BRACKET: m, CHAR_PLUS: h, CHAR_QUESTION_MARK: g, CHAR_RIGHT_CURLY_BRACE: _, CHAR_RIGHT_PARENTHESES: v, CHAR_RIGHT_SQUARE_BRACKET: y } = r(), b = (e) => e === d || e === s, x = (e) => {
|
|
172
|
-
e.isPrefix !== !0 && (e.depth = e.isGlobstar ? Infinity : 1);
|
|
173
|
-
};
|
|
174
|
-
t.exports = (e, t) => {
|
|
175
|
-
let r = t || {}, i = e.length - 1, S = r.parts === !0 || r.tokens === !0 || r.scanToEnd === !0, C = [], w = [], T = [], E = e, D = -1, O = 0, k = 0, A = !1, j = !1, M = !1, N = !1, P = !1, F = !1, I = !1, L = !1, R = !1, z = !1, B = 0, V, H, U = {
|
|
176
|
-
value: "",
|
|
177
|
-
depth: 0,
|
|
178
|
-
isGlob: !1
|
|
179
|
-
}, W = () => D >= i, G = () => E.charCodeAt(D + 1), K = () => (V = H, E.charCodeAt(++D));
|
|
180
|
-
for (; D < i;) {
|
|
181
|
-
H = K();
|
|
182
|
-
let e;
|
|
183
|
-
if (H === s) I = U.backslashes = !0, H = K(), H === f && (F = !0);
|
|
184
|
-
else {
|
|
185
|
-
if (F === !0 || H === f) {
|
|
186
|
-
for (B++; W() !== !0 && (H = K());) if (H === s) I = U.backslashes = !0, K();
|
|
187
|
-
else if (H === f) B++;
|
|
188
|
-
else {
|
|
189
|
-
if (F !== !0 && H === l && (H = K()) === l || F !== !0 && H === c) {
|
|
190
|
-
if (A = U.isBrace = !0, M = U.isGlob = !0, z = !0, S === !0) continue;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
if (H === _ && (B--, B === 0)) {
|
|
194
|
-
F = !1, A = U.isBrace = !0, z = !0;
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
if (S === !0) continue;
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
if (H === d) {
|
|
202
|
-
if (C.push(D), w.push(U), U = {
|
|
203
|
-
value: "",
|
|
204
|
-
depth: 0,
|
|
205
|
-
isGlob: !1
|
|
206
|
-
}, z === !0) continue;
|
|
207
|
-
if (V === l && D === O + 1) {
|
|
208
|
-
O += 2;
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
k = D + 1;
|
|
212
|
-
} else {
|
|
213
|
-
if (r.noext !== !0 && (H === h || H === o || H === a || H === g || H === u) && G() === p) {
|
|
214
|
-
if (M = U.isGlob = !0, N = U.isExtglob = !0, z = !0, H === u && D === O && (R = !0), S === !0) {
|
|
215
|
-
let e = 0;
|
|
216
|
-
for (; W() !== !0 && (H = K());) if (H === s) I = U.backslashes = !0, K();
|
|
217
|
-
else if (H === p) e++;
|
|
218
|
-
else if (H === v && --e === 0) {
|
|
219
|
-
z = !0;
|
|
220
|
-
break;
|
|
221
|
-
}
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
if (H === a) {
|
|
227
|
-
if (V === a && (P = U.isGlobstar = !0), M = U.isGlob = !0, z = !0, S === !0) continue;
|
|
228
|
-
break;
|
|
229
|
-
}
|
|
230
|
-
if (H === g) {
|
|
231
|
-
if (M = U.isGlob = !0, z = !0, S === !0) continue;
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
if (H === m) {
|
|
235
|
-
for (; W() !== !0 && (e = K());) if (e === s) I = U.backslashes = !0, K();
|
|
236
|
-
else if (e === y) {
|
|
237
|
-
j = U.isBracket = !0, M = U.isGlob = !0, z = !0;
|
|
238
|
-
break;
|
|
239
|
-
}
|
|
240
|
-
if (S === !0) continue;
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
if (r.nonegate !== !0 && H === u && D === O) L = U.negated = !0, O++;
|
|
244
|
-
else {
|
|
245
|
-
if (r.noparen !== !0 && H === p) {
|
|
246
|
-
if (M = U.isGlob = !0, S === !0) {
|
|
247
|
-
let e = 1;
|
|
248
|
-
for (; W() !== !0 && (H = K());) if (H === s) I = U.backslashes = !0, K();
|
|
249
|
-
else if (H === p) e++;
|
|
250
|
-
else if (H === v && --e === 0) {
|
|
251
|
-
z = !0;
|
|
252
|
-
break;
|
|
253
|
-
}
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
break;
|
|
257
|
-
}
|
|
258
|
-
if (M === !0) {
|
|
259
|
-
if (z = !0, S === !0) continue;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
r.noext === !0 && (N = !1, M = !1);
|
|
267
|
-
let q = E, J = "", Y = "";
|
|
268
|
-
O > 0 && (J = E.slice(0, O), E = E.slice(O), k -= O), q && M === !0 && k > 0 ? (q = E.slice(0, k), Y = E.slice(k)) : M === !0 ? (q = "", Y = E) : q = E, q && q !== "" && q !== "/" && q !== E && b(q.charCodeAt(q.length - 1)) && (q = q.slice(0, -1)), r.unescape === !0 && (Y &&= n.removeBackslashes(Y), q && I === !0 && (q = n.removeBackslashes(q)));
|
|
269
|
-
let X = {
|
|
270
|
-
prefix: J,
|
|
271
|
-
input: e,
|
|
272
|
-
start: O,
|
|
273
|
-
base: q,
|
|
274
|
-
glob: Y,
|
|
275
|
-
isBrace: A,
|
|
276
|
-
isBracket: j,
|
|
277
|
-
isGlob: M,
|
|
278
|
-
isExtglob: N,
|
|
279
|
-
isGlobstar: P,
|
|
280
|
-
negated: L,
|
|
281
|
-
negatedExtglob: R
|
|
282
|
-
};
|
|
283
|
-
if (r.tokens === !0 && (X.maxDepth = 0, b(H) || w.push(U), X.tokens = w), r.parts === !0 || r.tokens === !0) {
|
|
284
|
-
let t;
|
|
285
|
-
for (let n = 0; n < C.length; n++) {
|
|
286
|
-
let i = t === void 0 ? O : t + 1, a = C[n], o = e.slice(i, a);
|
|
287
|
-
r.tokens && (n === 0 && O !== 0 ? (w[n].isPrefix = !0, w[n].value = J) : w[n].value = o, x(w[n]), X.maxDepth += w[n].depth), a >= O && (T.push(o), t = a);
|
|
288
|
-
}
|
|
289
|
-
let n = t === void 0 ? O : t + 1, i = e.slice(n);
|
|
290
|
-
T.push(i), r.tokens && t && t + 1 < e.length && (w[w.length - 1].value = i, x(w[w.length - 1]), X.maxDepth += w[w.length - 1].depth), X.slashes = C, X.parts = T;
|
|
291
|
-
}
|
|
292
|
-
return X;
|
|
293
|
-
};
|
|
294
|
-
})), o = /* @__PURE__ */ e(((e, t) => {
|
|
295
|
-
var n = r(), a = i(), { MAX_LENGTH: o, POSIX_REGEX_SOURCE: s, REGEX_NON_SPECIAL_CHARS: c, REGEX_SPECIAL_CHARS_BACKREF: l, REPLACEMENTS: u } = n, d = (e, t) => {
|
|
296
|
-
if (typeof t.expandRange == "function") return t.expandRange(...e, t);
|
|
297
|
-
e.sort();
|
|
298
|
-
let n = `[${e.join("-")}]`;
|
|
299
|
-
try {
|
|
300
|
-
new RegExp(n);
|
|
301
|
-
} catch {
|
|
302
|
-
return e.map((e) => a.escapeRegex(e)).join("..");
|
|
303
|
-
}
|
|
304
|
-
return n;
|
|
305
|
-
}, f = (e, t) => `Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`, p = (e) => {
|
|
306
|
-
let t = [], n = 0, r = 0, i = 0, a = "", o = !1;
|
|
307
|
-
for (let s of e) if (o === !0) a += s, o = !1;
|
|
308
|
-
else if (s === "\\") a += s, o = !0;
|
|
309
|
-
else if (s === "\"") i = i === 1 ? 0 : 1, a += s;
|
|
310
|
-
else {
|
|
311
|
-
if (i === 0) {
|
|
312
|
-
if (s === "[") n++;
|
|
313
|
-
else if (s === "]" && n > 0) n--;
|
|
314
|
-
else if (n === 0) {
|
|
315
|
-
if (s === "(") r++;
|
|
316
|
-
else if (s === ")" && r > 0) r--;
|
|
317
|
-
else if (s === "|" && r === 0) {
|
|
318
|
-
t.push(a), a = "";
|
|
319
|
-
continue;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
a += s;
|
|
324
|
-
}
|
|
325
|
-
return t.push(a), t;
|
|
326
|
-
}, m = (e) => {
|
|
327
|
-
let t = !1;
|
|
328
|
-
for (let n of e) if (t === !0) t = !1;
|
|
329
|
-
else if (n === "\\") t = !0;
|
|
330
|
-
else if (/[?*+@!()[\]{}]/.test(n)) return !1;
|
|
331
|
-
return !0;
|
|
332
|
-
}, h = (e) => {
|
|
333
|
-
let t = e.trim(), n = !0;
|
|
334
|
-
for (; n === !0;) n = !1, /^@\([^\\()[\]{}|]+\)$/.test(t) && (t = t.slice(2, -1), n = !0);
|
|
335
|
-
if (m(t)) return t.replace(/\\(.)/g, "$1");
|
|
336
|
-
}, g = (e) => {
|
|
337
|
-
let t = e.map(h).filter(Boolean);
|
|
338
|
-
for (let e = 0; e < t.length; e++) for (let n = e + 1; n < t.length; n++) {
|
|
339
|
-
let r = t[e], i = t[n], a = r[0];
|
|
340
|
-
if (a && r === a.repeat(r.length) && i === a.repeat(i.length) && (r === i || r.startsWith(i) || i.startsWith(r))) return !0;
|
|
341
|
-
}
|
|
342
|
-
return !1;
|
|
343
|
-
}, _ = (e, t = !0) => {
|
|
344
|
-
if (e[0] !== "+" && e[0] !== "*" || e[1] !== "(") return;
|
|
345
|
-
let n = 0, r = 0, i = 0, a = !1;
|
|
346
|
-
for (let o = 1; o < e.length; o++) {
|
|
347
|
-
let s = e[o];
|
|
348
|
-
if (a === !0) a = !1;
|
|
349
|
-
else if (s === "\\") a = !0;
|
|
350
|
-
else if (s === "\"") i = i === 1 ? 0 : 1;
|
|
351
|
-
else if (i !== 1) {
|
|
352
|
-
if (s === "[") n++;
|
|
353
|
-
else if (s === "]" && n > 0) n--;
|
|
354
|
-
else if (!(n > 0)) {
|
|
355
|
-
if (s === "(") r++;
|
|
356
|
-
else if (s === ")" && (r--, r === 0)) return t === !0 && o !== e.length - 1 ? void 0 : {
|
|
357
|
-
type: e[0],
|
|
358
|
-
body: e.slice(2, o),
|
|
359
|
-
end: o
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}, v = (e) => `${e.length === 1 ? a.escapeRegex(e[0]) : `[${e.map((e) => a.escapeRegex(e)).join("")}]`}*`, y = (e) => {
|
|
365
|
-
let t = 0, n = [];
|
|
366
|
-
for (; t < e.length;) {
|
|
367
|
-
let r = _(e.slice(t), !1);
|
|
368
|
-
if (!r || r.type !== "*") return;
|
|
369
|
-
let i = p(r.body).map((e) => e.trim());
|
|
370
|
-
if (i.length !== 1) return;
|
|
371
|
-
let a = h(i[0]);
|
|
372
|
-
if (!a || a.length !== 1) return;
|
|
373
|
-
n.push(a), t += r.end + 1;
|
|
374
|
-
}
|
|
375
|
-
if (!(n.length < 1)) return n;
|
|
376
|
-
}, b = (e) => {
|
|
377
|
-
let t = 0, n = e.trim(), r = _(n);
|
|
378
|
-
for (; r;) t++, n = r.body.trim(), r = _(n);
|
|
379
|
-
return t;
|
|
380
|
-
}, x = (e, t) => {
|
|
381
|
-
if (t.maxExtglobRecursion === !1) return { risky: !1 };
|
|
382
|
-
let r = typeof t.maxExtglobRecursion == "number" ? t.maxExtglobRecursion : n.DEFAULT_MAX_EXTGLOB_RECURSION, i = p(e).map((e) => e.trim());
|
|
383
|
-
if (i.length > 1 && (i.some((e) => e === "") || i.some((e) => /^[*?]+$/.test(e)) || g(i))) return { risky: !0 };
|
|
384
|
-
let a = [], o = !1, s = !0;
|
|
385
|
-
for (let e of i) {
|
|
386
|
-
let t = y(e);
|
|
387
|
-
if (t) {
|
|
388
|
-
o = !0, a.push(...t);
|
|
389
|
-
continue;
|
|
390
|
-
}
|
|
391
|
-
let n = h(e);
|
|
392
|
-
if (n && n.length === 1) a.push(n);
|
|
393
|
-
else if (s = !1, b(e) > r) return { risky: !0 };
|
|
394
|
-
}
|
|
395
|
-
return o ? s ? {
|
|
396
|
-
risky: !0,
|
|
397
|
-
safeOutput: v([...new Set(a)])
|
|
398
|
-
} : { risky: !0 } : { risky: !1 };
|
|
399
|
-
}, S = (e, t) => {
|
|
400
|
-
if (typeof e != "string") throw TypeError("Expected a string");
|
|
401
|
-
e = u[e] || e;
|
|
402
|
-
let r = { ...t }, i = typeof r.maxLength == "number" ? Math.min(o, r.maxLength) : o, p = e.length;
|
|
403
|
-
if (p > i) throw SyntaxError(`Input length: ${p}, exceeds maximum allowed length: ${i}`);
|
|
404
|
-
let m = {
|
|
405
|
-
type: "bos",
|
|
406
|
-
value: "",
|
|
407
|
-
output: r.prepend || ""
|
|
408
|
-
}, h = [m], g = r.capture ? "" : "?:", _ = n.globChars(r.windows), v = n.extglobChars(_), { DOT_LITERAL: y, PLUS_LITERAL: b, SLASH_LITERAL: C, ONE_CHAR: w, DOTS_SLASH: T, NO_DOT: E, NO_DOT_SLASH: D, NO_DOTS_SLASH: O, QMARK: k, QMARK_NO_DOT: A, STAR: j, START_ANCHOR: M } = _, N = (e) => `(${g}(?:(?!${M}${e.dot ? T : y}).)*?)`, P = r.dot ? "" : E, F = r.dot ? k : A, I = r.bash === !0 ? N(r) : j;
|
|
409
|
-
r.capture && (I = `(${I})`), typeof r.noext == "boolean" && (r.noextglob = r.noext);
|
|
410
|
-
let L = {
|
|
411
|
-
input: e,
|
|
412
|
-
index: -1,
|
|
413
|
-
start: 0,
|
|
414
|
-
dot: r.dot === !0,
|
|
415
|
-
consumed: "",
|
|
416
|
-
output: "",
|
|
417
|
-
prefix: "",
|
|
418
|
-
backtrack: !1,
|
|
419
|
-
negated: !1,
|
|
420
|
-
brackets: 0,
|
|
421
|
-
braces: 0,
|
|
422
|
-
parens: 0,
|
|
423
|
-
quotes: 0,
|
|
424
|
-
globstar: !1,
|
|
425
|
-
tokens: h
|
|
426
|
-
};
|
|
427
|
-
e = a.removePrefix(e, L), p = e.length;
|
|
428
|
-
let R = [], z = [], B = [], V = m, H, U = () => L.index === p - 1, W = L.peek = (t = 1) => e[L.index + t], G = L.advance = () => e[++L.index] || "", K = () => e.slice(L.index + 1), q = (e = "", t = 0) => {
|
|
429
|
-
L.consumed += e, L.index += t;
|
|
430
|
-
}, J = (e) => {
|
|
431
|
-
L.output += e.output == null ? e.value : e.output, q(e.value);
|
|
432
|
-
}, Y = () => {
|
|
433
|
-
let e = 1;
|
|
434
|
-
for (; W() === "!" && (W(2) !== "(" || W(3) === "?");) G(), L.start++, e++;
|
|
435
|
-
return e % 2 != 0 && (L.negated = !0, L.start++, !0);
|
|
436
|
-
}, X = (e) => {
|
|
437
|
-
L[e]++, B.push(e);
|
|
438
|
-
}, Z = (e) => {
|
|
439
|
-
L[e]--, B.pop();
|
|
440
|
-
}, Q = (e) => {
|
|
441
|
-
if (V.type === "globstar") {
|
|
442
|
-
let t = L.braces > 0 && (e.type === "comma" || e.type === "brace"), n = e.extglob === !0 || R.length && (e.type === "pipe" || e.type === "paren");
|
|
443
|
-
e.type !== "slash" && e.type !== "paren" && !t && !n && (L.output = L.output.slice(0, -V.output.length), V.type = "star", V.value = "*", V.output = I, L.output += V.output);
|
|
444
|
-
}
|
|
445
|
-
R.length && e.type !== "paren" && (R[R.length - 1].inner += e.value), (e.value || e.output) && J(e), V && V.type === "text" && e.type === "text" ? (V.output = (V.output || V.value) + e.value, V.value += e.value) : (e.prev = V, h.push(e), V = e);
|
|
446
|
-
}, $ = (e, t) => {
|
|
447
|
-
let n = {
|
|
448
|
-
...v[t],
|
|
449
|
-
conditions: 1,
|
|
450
|
-
inner: ""
|
|
451
|
-
};
|
|
452
|
-
n.prev = V, n.parens = L.parens, n.output = L.output, n.startIndex = L.index, n.tokensIndex = h.length;
|
|
453
|
-
let i = (r.capture ? "(" : "") + n.open;
|
|
454
|
-
X("parens"), Q({
|
|
455
|
-
type: e,
|
|
456
|
-
value: t,
|
|
457
|
-
output: L.output ? "" : w
|
|
458
|
-
}), Q({
|
|
459
|
-
type: "paren",
|
|
460
|
-
extglob: !0,
|
|
461
|
-
value: G(),
|
|
462
|
-
output: i
|
|
463
|
-
}), R.push(n);
|
|
464
|
-
}, ee = (n) => {
|
|
465
|
-
let i = e.slice(n.startIndex, L.index + 1), o = x(e.slice(n.startIndex + 2, L.index), r);
|
|
466
|
-
if ((n.type === "plus" || n.type === "star") && o.risky) {
|
|
467
|
-
let e = o.safeOutput ? (n.output ? "" : w) + (r.capture ? `(${o.safeOutput})` : o.safeOutput) : void 0, t = h[n.tokensIndex];
|
|
468
|
-
t.type = "text", t.value = i, t.output = e || a.escapeRegex(i);
|
|
469
|
-
for (let e = n.tokensIndex + 1; e < h.length; e++) h[e].value = "", h[e].output = "", delete h[e].suffix;
|
|
470
|
-
L.output = n.output + t.output, L.backtrack = !0, Q({
|
|
471
|
-
type: "paren",
|
|
472
|
-
extglob: !0,
|
|
473
|
-
value: H,
|
|
474
|
-
output: ""
|
|
475
|
-
}), Z("parens");
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
let s = n.close + (r.capture ? ")" : ""), c;
|
|
479
|
-
if (n.type === "negate") {
|
|
480
|
-
let e = I;
|
|
481
|
-
n.inner && n.inner.length > 1 && n.inner.includes("/") && (e = N(r)), (e !== I || U() || /^\)+$/.test(K())) && (s = n.close = `)$))${e}`), n.inner.includes("*") && (c = K()) && /^\.[^\\/.]+$/.test(c) && (s = n.close = `)${S(c, {
|
|
482
|
-
...t,
|
|
483
|
-
fastpaths: !1
|
|
484
|
-
}).output})${e})`), n.prev.type === "bos" && (L.negatedExtglob = !0);
|
|
485
|
-
}
|
|
486
|
-
Q({
|
|
487
|
-
type: "paren",
|
|
488
|
-
extglob: !0,
|
|
489
|
-
value: H,
|
|
490
|
-
output: s
|
|
491
|
-
}), Z("parens");
|
|
492
|
-
};
|
|
493
|
-
if (r.fastpaths !== !1 && !/(^[*!]|[/()[\]{}"])/.test(e)) {
|
|
494
|
-
let n = !1, i = e.replace(l, (e, t, r, i, a, o) => i === "\\" ? (n = !0, e) : i === "?" ? t ? t + i + (a ? k.repeat(a.length) : "") : o === 0 ? F + (a ? k.repeat(a.length) : "") : k.repeat(r.length) : i === "." ? y.repeat(r.length) : i === "*" ? t ? t + i + (a ? I : "") : I : t ? e : `\\${e}`);
|
|
495
|
-
return n === !0 && (i = r.unescape === !0 ? i.replace(/\\/g, "") : i.replace(/\\+/g, (e) => e.length % 2 == 0 ? "\\\\" : e ? "\\" : "")), i === e && r.contains === !0 ? (L.output = e, L) : (L.output = a.wrapOutput(i, L, t), L);
|
|
496
|
-
}
|
|
497
|
-
for (; !U();) {
|
|
498
|
-
if (H = G(), H === "\0") continue;
|
|
499
|
-
if (H === "\\") {
|
|
500
|
-
let e = W();
|
|
501
|
-
if (e === "/" && r.bash !== !0 || e === "." || e === ";") continue;
|
|
502
|
-
if (!e) {
|
|
503
|
-
H += "\\", Q({
|
|
504
|
-
type: "text",
|
|
505
|
-
value: H
|
|
506
|
-
});
|
|
507
|
-
continue;
|
|
508
|
-
}
|
|
509
|
-
let t = /^\\+/.exec(K()), n = 0;
|
|
510
|
-
if (t && t[0].length > 2 && (n = t[0].length, L.index += n, n % 2 != 0 && (H += "\\")), r.unescape === !0 ? H = G() : H += G(), L.brackets === 0) {
|
|
511
|
-
Q({
|
|
512
|
-
type: "text",
|
|
513
|
-
value: H
|
|
514
|
-
});
|
|
515
|
-
continue;
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
if (L.brackets > 0 && (H !== "]" || V.value === "[" || V.value === "[^")) {
|
|
519
|
-
if (r.posix !== !1 && H === ":") {
|
|
520
|
-
let e = V.value.slice(1);
|
|
521
|
-
if (e.includes("[") && (V.posix = !0, e.includes(":"))) {
|
|
522
|
-
let e = V.value.lastIndexOf("["), t = V.value.slice(0, e), n = s[V.value.slice(e + 2)];
|
|
523
|
-
if (n) {
|
|
524
|
-
V.value = t + n, L.backtrack = !0, G(), !m.output && h.indexOf(V) === 1 && (m.output = w);
|
|
525
|
-
continue;
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
(H === "[" && W() !== ":" || H === "-" && W() === "]") && (H = `\\${H}`), H === "]" && (V.value === "[" || V.value === "[^") && (H = `\\${H}`), r.posix === !0 && H === "!" && V.value === "[" && (H = "^"), V.value += H, J({ value: H });
|
|
530
|
-
continue;
|
|
531
|
-
}
|
|
532
|
-
if (L.quotes === 1 && H !== "\"") {
|
|
533
|
-
H = a.escapeRegex(H), V.value += H, J({ value: H });
|
|
534
|
-
continue;
|
|
535
|
-
}
|
|
536
|
-
if (H === "\"") {
|
|
537
|
-
L.quotes = L.quotes === 1 ? 0 : 1, r.keepQuotes === !0 && Q({
|
|
538
|
-
type: "text",
|
|
539
|
-
value: H
|
|
540
|
-
});
|
|
541
|
-
continue;
|
|
542
|
-
}
|
|
543
|
-
if (H === "(") {
|
|
544
|
-
X("parens"), Q({
|
|
545
|
-
type: "paren",
|
|
546
|
-
value: H
|
|
547
|
-
});
|
|
548
|
-
continue;
|
|
549
|
-
}
|
|
550
|
-
if (H === ")") {
|
|
551
|
-
if (L.parens === 0 && r.strictBrackets === !0) throw SyntaxError(f("opening", "("));
|
|
552
|
-
let e = R[R.length - 1];
|
|
553
|
-
if (e && L.parens === e.parens + 1) {
|
|
554
|
-
ee(R.pop());
|
|
555
|
-
continue;
|
|
556
|
-
}
|
|
557
|
-
Q({
|
|
558
|
-
type: "paren",
|
|
559
|
-
value: H,
|
|
560
|
-
output: L.parens ? ")" : "\\)"
|
|
561
|
-
}), Z("parens");
|
|
562
|
-
continue;
|
|
563
|
-
}
|
|
564
|
-
if (H === "[") {
|
|
565
|
-
if (r.nobracket === !0 || !K().includes("]")) {
|
|
566
|
-
if (r.nobracket !== !0 && r.strictBrackets === !0) throw SyntaxError(f("closing", "]"));
|
|
567
|
-
H = `\\${H}`;
|
|
568
|
-
} else X("brackets");
|
|
569
|
-
Q({
|
|
570
|
-
type: "bracket",
|
|
571
|
-
value: H
|
|
572
|
-
});
|
|
573
|
-
continue;
|
|
574
|
-
}
|
|
575
|
-
if (H === "]") {
|
|
576
|
-
if (r.nobracket === !0 || V && V.type === "bracket" && V.value.length === 1) {
|
|
577
|
-
Q({
|
|
578
|
-
type: "text",
|
|
579
|
-
value: H,
|
|
580
|
-
output: `\\${H}`
|
|
581
|
-
});
|
|
582
|
-
continue;
|
|
583
|
-
}
|
|
584
|
-
if (L.brackets === 0) {
|
|
585
|
-
if (r.strictBrackets === !0) throw SyntaxError(f("opening", "["));
|
|
586
|
-
Q({
|
|
587
|
-
type: "text",
|
|
588
|
-
value: H,
|
|
589
|
-
output: `\\${H}`
|
|
590
|
-
});
|
|
591
|
-
continue;
|
|
592
|
-
}
|
|
593
|
-
Z("brackets");
|
|
594
|
-
let e = V.value.slice(1);
|
|
595
|
-
if (V.posix !== !0 && e[0] === "^" && !e.includes("/") && (H = `/${H}`), V.value += H, J({ value: H }), r.literalBrackets === !1 || a.hasRegexChars(e)) continue;
|
|
596
|
-
let t = a.escapeRegex(V.value);
|
|
597
|
-
if (L.output = L.output.slice(0, -V.value.length), r.literalBrackets === !0) {
|
|
598
|
-
L.output += t, V.value = t;
|
|
599
|
-
continue;
|
|
600
|
-
}
|
|
601
|
-
V.value = `(${g}${t}|${V.value})`, L.output += V.value;
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
if (H === "{" && r.nobrace !== !0) {
|
|
605
|
-
X("braces");
|
|
606
|
-
let e = {
|
|
607
|
-
type: "brace",
|
|
608
|
-
value: H,
|
|
609
|
-
output: "(",
|
|
610
|
-
outputIndex: L.output.length,
|
|
611
|
-
tokensIndex: L.tokens.length
|
|
612
|
-
};
|
|
613
|
-
z.push(e), Q(e);
|
|
614
|
-
continue;
|
|
615
|
-
}
|
|
616
|
-
if (H === "}") {
|
|
617
|
-
let e = z[z.length - 1];
|
|
618
|
-
if (r.nobrace === !0 || !e) {
|
|
619
|
-
Q({
|
|
620
|
-
type: "text",
|
|
621
|
-
value: H,
|
|
622
|
-
output: H
|
|
623
|
-
});
|
|
624
|
-
continue;
|
|
625
|
-
}
|
|
626
|
-
let t = ")";
|
|
627
|
-
if (e.dots === !0) {
|
|
628
|
-
let e = h.slice(), n = [];
|
|
629
|
-
for (let t = e.length - 1; t >= 0 && (h.pop(), e[t].type !== "brace"); t--) e[t].type !== "dots" && n.unshift(e[t].value);
|
|
630
|
-
t = d(n, r), L.backtrack = !0;
|
|
631
|
-
}
|
|
632
|
-
if (e.comma !== !0 && e.dots !== !0) {
|
|
633
|
-
let n = L.output.slice(0, e.outputIndex), r = L.tokens.slice(e.tokensIndex);
|
|
634
|
-
e.value = e.output = "\\{", H = t = "\\}", L.output = n;
|
|
635
|
-
for (let e of r) L.output += e.output || e.value;
|
|
636
|
-
}
|
|
637
|
-
Q({
|
|
638
|
-
type: "brace",
|
|
639
|
-
value: H,
|
|
640
|
-
output: t
|
|
641
|
-
}), Z("braces"), z.pop();
|
|
642
|
-
continue;
|
|
643
|
-
}
|
|
644
|
-
if (H === "|") {
|
|
645
|
-
R.length > 0 && R[R.length - 1].conditions++, Q({
|
|
646
|
-
type: "text",
|
|
647
|
-
value: H
|
|
648
|
-
});
|
|
649
|
-
continue;
|
|
650
|
-
}
|
|
651
|
-
if (H === ",") {
|
|
652
|
-
let e = H, t = z[z.length - 1];
|
|
653
|
-
t && B[B.length - 1] === "braces" && (t.comma = !0, e = "|"), Q({
|
|
654
|
-
type: "comma",
|
|
655
|
-
value: H,
|
|
656
|
-
output: e
|
|
657
|
-
});
|
|
658
|
-
continue;
|
|
659
|
-
}
|
|
660
|
-
if (H === "/") {
|
|
661
|
-
if (V.type === "dot" && L.index === L.start + 1) {
|
|
662
|
-
L.start = L.index + 1, L.consumed = "", L.output = "", h.pop(), V = m;
|
|
663
|
-
continue;
|
|
664
|
-
}
|
|
665
|
-
Q({
|
|
666
|
-
type: "slash",
|
|
667
|
-
value: H,
|
|
668
|
-
output: C
|
|
669
|
-
});
|
|
670
|
-
continue;
|
|
671
|
-
}
|
|
672
|
-
if (H === ".") {
|
|
673
|
-
if (L.braces > 0 && V.type === "dot") {
|
|
674
|
-
V.value === "." && (V.output = y);
|
|
675
|
-
let e = z[z.length - 1];
|
|
676
|
-
V.type = "dots", V.output += H, V.value += H, e.dots = !0;
|
|
677
|
-
continue;
|
|
678
|
-
}
|
|
679
|
-
if (L.braces + L.parens === 0 && V.type !== "bos" && V.type !== "slash") {
|
|
680
|
-
Q({
|
|
681
|
-
type: "text",
|
|
682
|
-
value: H,
|
|
683
|
-
output: y
|
|
684
|
-
});
|
|
685
|
-
continue;
|
|
686
|
-
}
|
|
687
|
-
Q({
|
|
688
|
-
type: "dot",
|
|
689
|
-
value: H,
|
|
690
|
-
output: y
|
|
691
|
-
});
|
|
692
|
-
continue;
|
|
693
|
-
}
|
|
694
|
-
if (H === "?") {
|
|
695
|
-
if (!(V && V.value === "(") && r.noextglob !== !0 && W() === "(" && W(2) !== "?") {
|
|
696
|
-
$("qmark", H);
|
|
697
|
-
continue;
|
|
698
|
-
}
|
|
699
|
-
if (V && V.type === "paren") {
|
|
700
|
-
let e = W(), t = H;
|
|
701
|
-
(V.value === "(" && !/[!=<:]/.test(e) || e === "<" && !/<([!=]|\w+>)/.test(K())) && (t = `\\${H}`), Q({
|
|
702
|
-
type: "text",
|
|
703
|
-
value: H,
|
|
704
|
-
output: t
|
|
705
|
-
});
|
|
706
|
-
continue;
|
|
707
|
-
}
|
|
708
|
-
if (r.dot !== !0 && (V.type === "slash" || V.type === "bos")) {
|
|
709
|
-
Q({
|
|
710
|
-
type: "qmark",
|
|
711
|
-
value: H,
|
|
712
|
-
output: A
|
|
713
|
-
});
|
|
714
|
-
continue;
|
|
715
|
-
}
|
|
716
|
-
Q({
|
|
717
|
-
type: "qmark",
|
|
718
|
-
value: H,
|
|
719
|
-
output: k
|
|
720
|
-
});
|
|
721
|
-
continue;
|
|
722
|
-
}
|
|
723
|
-
if (H === "!") {
|
|
724
|
-
if (r.noextglob !== !0 && W() === "(" && (W(2) !== "?" || !/[!=<:]/.test(W(3)))) {
|
|
725
|
-
$("negate", H);
|
|
726
|
-
continue;
|
|
727
|
-
}
|
|
728
|
-
if (r.nonegate !== !0 && L.index === 0) {
|
|
729
|
-
Y();
|
|
730
|
-
continue;
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
if (H === "+") {
|
|
734
|
-
if (r.noextglob !== !0 && W() === "(" && W(2) !== "?") {
|
|
735
|
-
$("plus", H);
|
|
736
|
-
continue;
|
|
737
|
-
}
|
|
738
|
-
if (V && V.value === "(" || r.regex === !1) {
|
|
739
|
-
Q({
|
|
740
|
-
type: "plus",
|
|
741
|
-
value: H,
|
|
742
|
-
output: b
|
|
743
|
-
});
|
|
744
|
-
continue;
|
|
745
|
-
}
|
|
746
|
-
if (V && (V.type === "bracket" || V.type === "paren" || V.type === "brace") || L.parens > 0) {
|
|
747
|
-
Q({
|
|
748
|
-
type: "plus",
|
|
749
|
-
value: H
|
|
750
|
-
});
|
|
751
|
-
continue;
|
|
752
|
-
}
|
|
753
|
-
Q({
|
|
754
|
-
type: "plus",
|
|
755
|
-
value: b
|
|
756
|
-
});
|
|
757
|
-
continue;
|
|
758
|
-
}
|
|
759
|
-
if (H === "@") {
|
|
760
|
-
if (r.noextglob !== !0 && W() === "(" && W(2) !== "?") {
|
|
761
|
-
Q({
|
|
762
|
-
type: "at",
|
|
763
|
-
extglob: !0,
|
|
764
|
-
value: H,
|
|
765
|
-
output: ""
|
|
766
|
-
});
|
|
767
|
-
continue;
|
|
768
|
-
}
|
|
769
|
-
Q({
|
|
770
|
-
type: "text",
|
|
771
|
-
value: H
|
|
772
|
-
});
|
|
773
|
-
continue;
|
|
774
|
-
}
|
|
775
|
-
if (H !== "*") {
|
|
776
|
-
(H === "$" || H === "^") && (H = `\\${H}`);
|
|
777
|
-
let e = c.exec(K());
|
|
778
|
-
e && (H += e[0], L.index += e[0].length), Q({
|
|
779
|
-
type: "text",
|
|
780
|
-
value: H
|
|
781
|
-
});
|
|
782
|
-
continue;
|
|
783
|
-
}
|
|
784
|
-
if (V && (V.type === "globstar" || V.star === !0)) {
|
|
785
|
-
V.type = "star", V.star = !0, V.value += H, V.output = I, L.backtrack = !0, L.globstar = !0, q(H);
|
|
786
|
-
continue;
|
|
787
|
-
}
|
|
788
|
-
let t = K();
|
|
789
|
-
if (r.noextglob !== !0 && /^\([^?]/.test(t)) {
|
|
790
|
-
$("star", H);
|
|
791
|
-
continue;
|
|
792
|
-
}
|
|
793
|
-
if (V.type === "star") {
|
|
794
|
-
if (r.noglobstar === !0) {
|
|
795
|
-
q(H);
|
|
796
|
-
continue;
|
|
797
|
-
}
|
|
798
|
-
let n = V.prev, i = n.prev, a = n.type === "slash" || n.type === "bos", o = i && (i.type === "star" || i.type === "globstar");
|
|
799
|
-
if (r.bash === !0 && (!a || t[0] && t[0] !== "/")) {
|
|
800
|
-
Q({
|
|
801
|
-
type: "star",
|
|
802
|
-
value: H,
|
|
803
|
-
output: ""
|
|
804
|
-
});
|
|
805
|
-
continue;
|
|
806
|
-
}
|
|
807
|
-
let s = L.braces > 0 && (n.type === "comma" || n.type === "brace"), c = R.length && (n.type === "pipe" || n.type === "paren");
|
|
808
|
-
if (!a && n.type !== "paren" && !s && !c) {
|
|
809
|
-
Q({
|
|
810
|
-
type: "star",
|
|
811
|
-
value: H,
|
|
812
|
-
output: ""
|
|
813
|
-
});
|
|
814
|
-
continue;
|
|
815
|
-
}
|
|
816
|
-
for (; t.slice(0, 3) === "/**";) {
|
|
817
|
-
let n = e[L.index + 4];
|
|
818
|
-
if (n && n !== "/") break;
|
|
819
|
-
t = t.slice(3), q("/**", 3);
|
|
820
|
-
}
|
|
821
|
-
let l = U() || L.parens > 0 && t === ")".repeat(L.parens) && !R.some((e) => e.type === "negate");
|
|
822
|
-
if (n.type === "bos" && U()) {
|
|
823
|
-
V.type = "globstar", V.value += H, V.output = N(r), L.output = V.output, L.globstar = !0, q(H);
|
|
824
|
-
continue;
|
|
825
|
-
}
|
|
826
|
-
if (n.type === "slash" && n.prev.type !== "bos" && !o && l) {
|
|
827
|
-
L.output = L.output.slice(0, -(n.output + V.output).length), n.output = `(?:${n.output}`, V.type = "globstar", V.output = N(r) + (r.strictSlashes ? ")" : "|$)"), V.value += H, L.globstar = !0, L.output += n.output + V.output, q(H);
|
|
828
|
-
continue;
|
|
829
|
-
}
|
|
830
|
-
if (n.type === "slash" && n.prev.type !== "bos" && t[0] === "/") {
|
|
831
|
-
let e = t[1] === void 0 ? "" : "|$";
|
|
832
|
-
L.output = L.output.slice(0, -(n.output + V.output).length), n.output = `(?:${n.output}`, V.type = "globstar", V.output = `${N(r)}${C}|${C}${e})`, V.value += H, L.output += n.output + V.output, L.globstar = !0, q(H + G()), Q({
|
|
833
|
-
type: "slash",
|
|
834
|
-
value: "/",
|
|
835
|
-
output: ""
|
|
836
|
-
});
|
|
837
|
-
continue;
|
|
838
|
-
}
|
|
839
|
-
if (n.type === "bos" && t[0] === "/") {
|
|
840
|
-
V.type = "globstar", V.value += H, V.output = `(?:^|${C}|${N(r)}${C})`, L.output = V.output, L.globstar = !0, q(H + G()), Q({
|
|
841
|
-
type: "slash",
|
|
842
|
-
value: "/",
|
|
843
|
-
output: ""
|
|
844
|
-
});
|
|
845
|
-
continue;
|
|
846
|
-
}
|
|
847
|
-
L.output = L.output.slice(0, -V.output.length), V.type = "globstar", V.output = N(r), V.value += H, L.output += V.output, L.globstar = !0, q(H);
|
|
848
|
-
continue;
|
|
849
|
-
}
|
|
850
|
-
let n = {
|
|
851
|
-
type: "star",
|
|
852
|
-
value: H,
|
|
853
|
-
output: I
|
|
854
|
-
};
|
|
855
|
-
r.bash === !0 ? (n.output = ".*?", (V.type === "bos" || V.type === "slash") && (n.output = P + n.output), Q(n)) : V && (V.type === "bracket" || V.type === "paren") && r.regex === !0 ? (n.output = H, Q(n)) : ((L.index === L.start || V.type === "slash" || V.type === "dot") && (V.type === "dot" ? (L.output += D, V.output += D) : r.dot === !0 ? (L.output += O, V.output += O) : (L.output += P, V.output += P), W() !== "*" && (L.output += w, V.output += w)), Q(n));
|
|
856
|
-
}
|
|
857
|
-
for (; L.brackets > 0;) {
|
|
858
|
-
if (r.strictBrackets === !0) throw SyntaxError(f("closing", "]"));
|
|
859
|
-
L.output = a.escapeLast(L.output, "["), Z("brackets");
|
|
860
|
-
}
|
|
861
|
-
for (; L.parens > 0;) {
|
|
862
|
-
if (r.strictBrackets === !0) throw SyntaxError(f("closing", ")"));
|
|
863
|
-
L.output = a.escapeLast(L.output, "("), Z("parens");
|
|
864
|
-
}
|
|
865
|
-
for (; L.braces > 0;) {
|
|
866
|
-
if (r.strictBrackets === !0) throw SyntaxError(f("closing", "}"));
|
|
867
|
-
L.output = a.escapeLast(L.output, "{"), Z("braces");
|
|
868
|
-
}
|
|
869
|
-
if (r.strictSlashes !== !0 && (V.type === "star" || V.type === "bracket") && Q({
|
|
870
|
-
type: "maybe_slash",
|
|
871
|
-
value: "",
|
|
872
|
-
output: `${C}?`
|
|
873
|
-
}), L.backtrack === !0) {
|
|
874
|
-
L.output = "";
|
|
875
|
-
for (let e of L.tokens) L.output += e.output == null ? e.value : e.output, e.suffix && (L.output += e.suffix);
|
|
876
|
-
}
|
|
877
|
-
return L;
|
|
878
|
-
};
|
|
879
|
-
S.fastpaths = (e, t) => {
|
|
880
|
-
let r = { ...t }, i = typeof r.maxLength == "number" ? Math.min(o, r.maxLength) : o, s = e.length;
|
|
881
|
-
if (s > i) throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${i}`);
|
|
882
|
-
e = u[e] || e;
|
|
883
|
-
let { DOT_LITERAL: c, SLASH_LITERAL: l, ONE_CHAR: d, DOTS_SLASH: f, NO_DOT: p, NO_DOTS: m, NO_DOTS_SLASH: h, STAR: g, START_ANCHOR: _ } = n.globChars(r.windows), v = r.dot ? m : p, y = r.dot ? h : p, b = r.capture ? "" : "?:", x = {
|
|
884
|
-
negated: !1,
|
|
885
|
-
prefix: ""
|
|
886
|
-
}, S = r.bash === !0 ? ".*?" : g;
|
|
887
|
-
r.capture && (S = `(${S})`);
|
|
888
|
-
let C = (e) => e.noglobstar === !0 ? S : `(${b}(?:(?!${_}${e.dot ? f : c}).)*?)`, w = (e) => {
|
|
889
|
-
switch (e) {
|
|
890
|
-
case "*": return `${v}${d}${S}`;
|
|
891
|
-
case ".*": return `${c}${d}${S}`;
|
|
892
|
-
case "*.*": return `${v}${S}${c}${d}${S}`;
|
|
893
|
-
case "*/*": return `${v}${S}${l}${d}${y}${S}`;
|
|
894
|
-
case "**": return v + C(r);
|
|
895
|
-
case "**/*": return `(?:${v}${C(r)}${l})?${y}${d}${S}`;
|
|
896
|
-
case "**/*.*": return `(?:${v}${C(r)}${l})?${y}${S}${c}${d}${S}`;
|
|
897
|
-
case "**/.*": return `(?:${v}${C(r)}${l})?${c}${d}${S}`;
|
|
898
|
-
default: {
|
|
899
|
-
let t = /^(.*?)\.(\w+)$/.exec(e);
|
|
900
|
-
if (!t) return;
|
|
901
|
-
let n = w(t[1]);
|
|
902
|
-
return n ? n + c + t[2] : void 0;
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
}, T = w(a.removePrefix(e, x));
|
|
906
|
-
return T && r.strictSlashes !== !0 && (T += `${l}?`), T;
|
|
907
|
-
}, t.exports = S;
|
|
908
|
-
})), s = /* @__PURE__ */ e(((e, t) => {
|
|
909
|
-
var n = a(), s = o(), c = i(), l = r(), u = (e) => e && typeof e == "object" && !Array.isArray(e), d = (e, t, n = !1) => {
|
|
910
|
-
if (Array.isArray(e)) {
|
|
911
|
-
let r = e.map((e) => d(e, t, n));
|
|
912
|
-
return (e) => {
|
|
913
|
-
for (let t of r) {
|
|
914
|
-
let n = t(e);
|
|
915
|
-
if (n) return n;
|
|
916
|
-
}
|
|
917
|
-
return !1;
|
|
918
|
-
};
|
|
919
|
-
}
|
|
920
|
-
let r = u(e) && e.tokens && e.input;
|
|
921
|
-
if (e === "" || typeof e != "string" && !r) throw TypeError("Expected pattern to be a non-empty string");
|
|
922
|
-
let i = t || {}, a = i.windows, o = r ? d.compileRe(e, t) : d.makeRe(e, t, !1, !0), s = o.state;
|
|
923
|
-
delete o.state;
|
|
924
|
-
let c = () => !1;
|
|
925
|
-
if (i.ignore) {
|
|
926
|
-
let e = {
|
|
927
|
-
...t,
|
|
928
|
-
ignore: null,
|
|
929
|
-
onMatch: null,
|
|
930
|
-
onResult: null
|
|
931
|
-
};
|
|
932
|
-
c = d(i.ignore, e, n);
|
|
933
|
-
}
|
|
934
|
-
let l = (n, r = !1) => {
|
|
935
|
-
let { isMatch: l, match: u, output: f } = d.test(n, o, t, {
|
|
936
|
-
glob: e,
|
|
937
|
-
posix: a
|
|
938
|
-
}), p = {
|
|
939
|
-
glob: e,
|
|
940
|
-
state: s,
|
|
941
|
-
regex: o,
|
|
942
|
-
posix: a,
|
|
943
|
-
input: n,
|
|
944
|
-
output: f,
|
|
945
|
-
match: u,
|
|
946
|
-
isMatch: l
|
|
947
|
-
};
|
|
948
|
-
return typeof i.onResult == "function" && i.onResult(p), l === !1 ? (p.isMatch = !1, r ? p : !1) : c(n) ? (typeof i.onIgnore == "function" && i.onIgnore(p), p.isMatch = !1, r ? p : !1) : (typeof i.onMatch == "function" && i.onMatch(p), !r || p);
|
|
949
|
-
};
|
|
950
|
-
return n && (l.state = s), l;
|
|
951
|
-
};
|
|
952
|
-
d.test = (e, t, n, { glob: r, posix: i } = {}) => {
|
|
953
|
-
if (typeof e != "string") throw TypeError("Expected input to be a string");
|
|
954
|
-
if (e === "") return {
|
|
955
|
-
isMatch: !1,
|
|
956
|
-
output: ""
|
|
957
|
-
};
|
|
958
|
-
let a = n || {}, o = a.format || (i ? c.toPosixSlashes : null), s = e === r, l = s && o ? o(e) : e;
|
|
959
|
-
return s === !1 && (l = o ? o(e) : e, s = l === r), (s === !1 || a.capture === !0) && (s = a.matchBase === !0 || a.basename === !0 ? d.matchBase(e, t, n, i) : t.exec(l)), {
|
|
960
|
-
isMatch: !!s,
|
|
961
|
-
match: s,
|
|
962
|
-
output: l
|
|
963
|
-
};
|
|
964
|
-
}, d.matchBase = (e, t, n, r = n && n.windows) => (t instanceof RegExp ? t : d.makeRe(t, n)).test(c.basename(e, { windows: r })), d.isMatch = (e, t, n) => d(t, n)(e), d.parse = (e, t) => Array.isArray(e) ? e.map((e) => d.parse(e, t)) : s(e, {
|
|
965
|
-
...t,
|
|
966
|
-
fastpaths: !1
|
|
967
|
-
}), d.scan = (e, t) => n(e, t), d.compileRe = (e, t, n = !1, r = !1) => {
|
|
968
|
-
if (n === !0) return e.output;
|
|
969
|
-
let i = t || {}, a = i.contains ? "" : "^", o = i.contains ? "" : "$", s = `${a}(?:${e.output})${o}`;
|
|
970
|
-
e && e.negated === !0 && (s = `^(?!${s}).*$`);
|
|
971
|
-
let c = d.toRegex(s, t);
|
|
972
|
-
return r === !0 && (c.state = e), c;
|
|
973
|
-
}, d.makeRe = (e, t = {}, n = !1, r = !1) => {
|
|
974
|
-
if (!e || typeof e != "string") throw TypeError("Expected a non-empty string");
|
|
975
|
-
let i = {
|
|
976
|
-
negated: !1,
|
|
977
|
-
fastpaths: !0
|
|
978
|
-
};
|
|
979
|
-
return t.fastpaths !== !1 && (e[0] === "." || e[0] === "*") && (i.output = s.fastpaths(e, t)), i.output || (i = s(e, t)), d.compileRe(i, t, n, r);
|
|
980
|
-
}, d.toRegex = (e, t) => {
|
|
981
|
-
try {
|
|
982
|
-
let n = t || {};
|
|
983
|
-
return new RegExp(e, n.flags || (n.nocase ? "i" : ""));
|
|
984
|
-
} catch (e) {
|
|
985
|
-
if (t && t.debug === !0) throw e;
|
|
986
|
-
return /$^/;
|
|
987
|
-
}
|
|
988
|
-
}, d.constants = l, t.exports = d;
|
|
989
|
-
})), c = /* @__PURE__ */ e(((e, t) => {
|
|
990
|
-
var n = s(), r = i();
|
|
991
|
-
function a(e, t, i = !1) {
|
|
992
|
-
return t && (t.windows === null || t.windows === void 0) && (t = {
|
|
993
|
-
...t,
|
|
994
|
-
windows: r.isWindows()
|
|
995
|
-
}), n(e, t, i);
|
|
996
|
-
}
|
|
997
|
-
Object.assign(a, n), t.exports = a;
|
|
998
|
-
}));
|
|
999
|
-
export { n, c as t };
|