inital commit

This commit is contained in:
2026-01-01 15:25:19 +05:30
commit f0ae49465a
36361 changed files with 4894111 additions and 0 deletions

29
node_modules/jodit/esm/core/request/ajax.d.ts generated vendored Normal file
View File

@@ -0,0 +1,29 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* [[include:core/request/README.md]]
* @packageDocumentation
* @module request
*/
import type { AjaxOptions, IAjax, IRequest, IResponse, RejectablePromise } from "../../types/index";
import "./config";
export declare class Ajax<T extends object = any> implements IAjax<T> {
className(): string;
private __async;
constructor(options: Partial<AjaxOptions>, defaultAjaxOptions?: AjaxOptions);
static log: IRequest[];
private readonly xhr;
private __buildParams;
options: AjaxOptions;
get o(): this['options'];
abort(): Ajax;
private __isFulfilled;
private __activated;
send(): RejectablePromise<IResponse<T>>;
prepareRequest(): IRequest;
private __isDestructed;
destruct(): void;
}

175
node_modules/jodit/esm/core/request/ajax.js generated vendored Normal file
View File

@@ -0,0 +1,175 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
r = Reflect.decorate(decorators, target, key, desc);
else
for (var i = decorators.length - 1; i >= 0; i--)
if (d = decorators[i])
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Async } from "../async/index.js";
import { globalWindow } from "../constants.js";
import { autobind } from "../decorators/autobind/autobind.js";
import { buildQuery, ConfigProto, isFunction, isPlainObject, isString, parseQuery } from "../helpers/index.js";
import * as error from "../helpers/utils/error/index.js";
import { Config } from "../../config.js";
import "./config.js";
import { Response } from "./response.js";
export class Ajax {
className() {
return 'Ajax';
}
constructor(options, defaultAjaxOptions = Config.prototype.defaultAjaxOptions) {
this.__async = new Async();
this.__isFulfilled = false;
this.__activated = false;
this.__isDestructed = false;
this.options = ConfigProto(options || {}, defaultAjaxOptions);
this.xhr = this.o.xhr ? this.o.xhr() : new XMLHttpRequest();
}
__buildParams(obj, prefix) {
if (isPlainObject(obj) &&
this.options.contentType &&
this.options.contentType.includes('application/json')) {
return JSON.stringify(obj);
}
if (isFunction(this.o.queryBuild)) {
return this.o.queryBuild.call(this, obj, prefix);
}
if (isString(obj) ||
obj instanceof globalWindow.FormData ||
(typeof obj === 'object' && obj != null && isFunction(obj.append))) {
return obj;
}
return buildQuery(obj);
}
get o() {
return this.options;
}
abort() {
if (this.__isFulfilled) {
return this;
}
try {
this.__isFulfilled = true;
this.xhr.abort();
}
catch (_a) { }
return this;
}
send() {
this.__activated = true;
const { xhr, o } = this;
const request = this.prepareRequest();
return this.__async.promise(async (resolve, reject) => {
var _a;
const onReject = () => {
this.__isFulfilled = true;
reject(error.connection('Connection error'));
};
const onResolve = () => {
this.__isFulfilled = true;
resolve(new Response(request, xhr.status, xhr.statusText, !xhr.responseType ? xhr.responseText : xhr.response));
};
xhr.onload = onResolve;
xhr.onabort = () => {
this.__isFulfilled = true;
reject(error.abort('Abort connection'));
};
xhr.onerror = onReject;
xhr.ontimeout = onReject;
if (o.responseType) {
xhr.responseType = o.responseType;
}
xhr.onprogress = (e) => {
var _a, _b;
let percentComplete = 0;
if (e.lengthComputable) {
percentComplete = (e.loaded / e.total) * 100;
}
(_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, percentComplete);
};
xhr.onreadystatechange = () => {
var _a, _b;
(_b = (_a = this.options).onProgress) === null || _b === void 0 ? void 0 : _b.call(_a, 10);
if (xhr.readyState === XMLHttpRequest.DONE) {
if (o.successStatuses.includes(xhr.status)) {
onResolve();
}
else if (xhr.statusText) {
this.__isFulfilled = true;
reject(error.connection(xhr.statusText));
}
}
};
xhr.withCredentials = (_a = o.withCredentials) !== null && _a !== void 0 ? _a : false;
const { url, data, method } = request;
xhr.open(method, url, true);
if (o.contentType && xhr.setRequestHeader) {
xhr.setRequestHeader('Content-type', o.contentType);
}
let { headers } = o;
if (isFunction(headers)) {
headers = await headers.call(this);
}
if (headers && xhr.setRequestHeader) {
Object.keys(headers).forEach(key => {
xhr.setRequestHeader(key, headers[key]);
});
}
// IE
this.__async.setTimeout(() => {
xhr.send(data ? this.__buildParams(data) : undefined);
}, 0);
});
}
prepareRequest() {
if (!this.o.url) {
throw error.error('Need URL for AJAX request');
}
let url = this.o.url;
const data = this.o.data;
const method = (this.o.method || 'get').toLowerCase();
if (method === 'get' && data && isPlainObject(data)) {
const qIndex = url.indexOf('?');
if (qIndex !== -1) {
const urlData = parseQuery(url);
url =
url.substring(0, qIndex) +
'?' +
buildQuery({ ...urlData, ...data });
}
else {
url += '?' + buildQuery(this.o.data);
}
}
const request = {
url,
method,
data
};
Ajax.log.splice(100);
Ajax.log.push(request);
return request;
}
destruct() {
if (!this.__isDestructed) {
this.__isDestructed = true;
if (this.__activated && !this.__isFulfilled) {
this.abort();
this.__isFulfilled = true;
}
this.__async.destruct();
}
}
}
Ajax.log = [];
__decorate([
autobind
], Ajax.prototype, "destruct", null);

17
node_modules/jodit/esm/core/request/config.d.ts generated vendored Normal file
View File

@@ -0,0 +1,17 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module request
*/
import type { AjaxOptions } from "../../types/index";
declare module 'jodit/config' {
interface Config {
/**
* A set of key/value pairs that configure the Ajax request. All settings are optional
*/
defaultAjaxOptions: AjaxOptions;
}
}

20
node_modules/jodit/esm/core/request/config.js generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
import { Config } from "../../config.js";
Config.prototype.defaultAjaxOptions = {
successStatuses: [200, 201, 202],
method: 'GET',
url: '',
data: null,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
headers: {
'X-REQUESTED-WITH': 'XMLHttpRequest' // compatible with jQuery
},
withCredentials: false,
xhr() {
return new XMLHttpRequest();
}
};

10
node_modules/jodit/esm/core/request/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module request
*/
export * from "./ajax";
export * from "./response";

10
node_modules/jodit/esm/core/request/index.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module request
*/
export * from "./ajax.js";
export * from "./response.js";

20
node_modules/jodit/esm/core/request/response.d.ts generated vendored Normal file
View File

@@ -0,0 +1,20 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
/**
* @module request
*/
import type { IRequest, IResponse } from "../../types/index";
export declare class Response<T> implements IResponse<T> {
readonly status: number;
readonly statusText: string;
readonly request: IRequest;
get url(): string;
private readonly body;
constructor(request: IRequest, status: number, statusText: string, body: string | Blob);
json(): Promise<T>;
text(): Promise<string>;
blob(): Promise<Blob>;
}

25
node_modules/jodit/esm/core/request/response.js generated vendored Normal file
View File

@@ -0,0 +1,25 @@
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2025 Valeriy Chupurnov. All rights reserved. https://xdsoft.net
*/
export class Response {
get url() {
return this.request.url;
}
constructor(request, status, statusText, body) {
this.request = request;
this.status = status;
this.statusText = statusText;
this.body = body;
}
async json() {
return JSON.parse(this.body);
}
text() {
return Promise.resolve(this.body);
}
async blob() {
return this.body;
}
}