@iamjariwala/react-doc-viewer 0.2.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/LICENSE +201 -0
- package/README.md +568 -0
- package/dist/DocViewer.d.ts +21 -0
- package/dist/components/DocumentNav.d.ts +3 -0
- package/dist/components/FileName.d.ts +3 -0
- package/dist/components/HeaderBar.d.ts +3 -0
- package/dist/components/LoadingTimout.d.ts +3 -0
- package/dist/components/ProxyRenderer.d.ts +3 -0
- package/dist/components/common/Button.d.ts +16 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/components/icons/index.d.ts +8 -0
- package/dist/cssStyles.d.ts +1 -0
- package/dist/defaultTheme.d.ts +3 -0
- package/dist/empty-DBAFSQIv.cjs +1 -0
- package/dist/empty-GlqisfcO.js +4 -0
- package/dist/features/annotations/components/AnnotationLayer.d.ts +10 -0
- package/dist/features/annotations/components/AnnotationToolbar.d.ts +3 -0
- package/dist/features/annotations/components/ColorPicker.d.ts +3 -0
- package/dist/features/annotations/components/CommentMarker.d.ts +8 -0
- package/dist/features/annotations/components/CommentPopover.d.ts +9 -0
- package/dist/features/annotations/components/TextHighlight.d.ts +8 -0
- package/dist/features/annotations/components/icons/index.d.ts +13 -0
- package/dist/features/annotations/hooks/useAnnotationExport.d.ts +9 -0
- package/dist/features/annotations/hooks/useDrawingCanvas.d.ts +15 -0
- package/dist/features/annotations/hooks/useTextSelection.d.ts +10 -0
- package/dist/features/annotations/index.d.ts +13 -0
- package/dist/features/annotations/state/actions.d.ts +52 -0
- package/dist/features/annotations/state/index.d.ts +17 -0
- package/dist/features/annotations/state/reducer.d.ts +17 -0
- package/dist/features/annotations/types/index.d.ts +44 -0
- package/dist/features/drag-drop/components/DropZoneOverlay.d.ts +9 -0
- package/dist/features/drag-drop/hooks/useDragDrop.d.ts +11 -0
- package/dist/features/drag-drop/hooks/useFileProcessor.d.ts +13 -0
- package/dist/features/drag-drop/index.d.ts +4 -0
- package/dist/features/drag-drop/types/index.d.ts +19 -0
- package/dist/features/thumbnail-sidebar/components/ThumbnailItem.d.ts +11 -0
- package/dist/features/thumbnail-sidebar/components/ThumbnailSidebar.d.ts +8 -0
- package/dist/features/thumbnail-sidebar/components/ThumbnailToggle.d.ts +7 -0
- package/dist/features/thumbnail-sidebar/hooks/useThumbnailGenerator.d.ts +13 -0
- package/dist/features/thumbnail-sidebar/index.d.ts +6 -0
- package/dist/features/thumbnail-sidebar/state/actions.d.ts +31 -0
- package/dist/features/thumbnail-sidebar/state/index.d.ts +15 -0
- package/dist/features/thumbnail-sidebar/state/reducer.d.ts +11 -0
- package/dist/hooks/useDocumentLoader.d.ts +13 -0
- package/dist/hooks/useRendererSelector.d.ts +5 -0
- package/dist/hooks/useTranslation.d.ts +3 -0
- package/dist/hooks/useWindowSize.d.ts +4 -0
- package/dist/i18n.d.ts +158 -0
- package/dist/index-BW6EMUiE.cjs +797 -0
- package/dist/index-CYjVmFQ0.cjs +10 -0
- package/dist/index-DHMTXjv6.cjs +1 -0
- package/dist/index-Dg8HfAtq.js +21246 -0
- package/dist/index-dGGNa2HA.js +3350 -0
- package/dist/index-nyGAOsVK.js +42 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/locales/ar.json.d.ts +13 -0
- package/dist/locales/de.json.d.ts +13 -0
- package/dist/locales/en.json.d.ts +26 -0
- package/dist/locales/es.json.d.ts +13 -0
- package/dist/locales/fr.json.d.ts +13 -0
- package/dist/locales/it.json.d.ts +13 -0
- package/dist/locales/ja.json.d.ts +13 -0
- package/dist/locales/pl.json.d.ts +13 -0
- package/dist/locales/pt.json.d.ts +13 -0
- package/dist/locales/ru.json.d.ts +13 -0
- package/dist/locales/se.json.d.ts +13 -0
- package/dist/locales/sr.json.d.ts +13 -0
- package/dist/locales/sr_cyr.json.d.ts +13 -0
- package/dist/locales/tr.json.d.ts +13 -0
- package/dist/models.d.ts +122 -0
- package/dist/react-doc-viewer.cjs +1 -0
- package/dist/react-doc-viewer.js +23 -0
- package/dist/renderers/bmp/index.d.ts +4 -0
- package/dist/renderers/csv/index.d.ts +4 -0
- package/dist/renderers/gif/index.d.ts +4 -0
- package/dist/renderers/html/index.d.ts +4 -0
- package/dist/renderers/image/index.d.ts +4 -0
- package/dist/renderers/index.d.ts +15 -0
- package/dist/renderers/jpg/index.d.ts +4 -0
- package/dist/renderers/msdoc/index.d.ts +4 -0
- package/dist/renderers/pdf/components/PDFControls.d.ts +4 -0
- package/dist/renderers/pdf/components/PDFPagination.d.ts +4 -0
- package/dist/renderers/pdf/components/PDFThumbnailGenerator.d.ts +3 -0
- package/dist/renderers/pdf/components/icons/index.d.ts +9 -0
- package/dist/renderers/pdf/components/pages/PDFAllPages.d.ts +7 -0
- package/dist/renderers/pdf/components/pages/PDFPages.d.ts +4 -0
- package/dist/renderers/pdf/components/pages/PDFSinglePage.d.ts +7 -0
- package/dist/renderers/pdf/index.d.ts +4 -0
- package/dist/renderers/pdf/state/actions.d.ts +32 -0
- package/dist/renderers/pdf/state/index.d.ts +13 -0
- package/dist/renderers/pdf/state/reducer.d.ts +15 -0
- package/dist/renderers/png/index.d.ts +4 -0
- package/dist/renderers/tiff/index.d.ts +4 -0
- package/dist/renderers/tiff/tiffToCanvas.d.ts +1 -0
- package/dist/renderers/txt/index.d.ts +4 -0
- package/dist/renderers/video/index.d.ts +4 -0
- package/dist/renderers/webp/index.d.ts +4 -0
- package/dist/store/DocViewerProvider.d.ts +22 -0
- package/dist/store/actions.d.ts +63 -0
- package/dist/store/mainStateReducer.d.ts +23 -0
- package/dist/url-BH2U_nez.cjs +3 -0
- package/dist/url-Dk8Xia2J.js +560 -0
- package/dist/utils/fileLoaders.d.ts +13 -0
- package/dist/utils/getFileName.d.ts +3 -0
- package/package.json +122 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { default as React, Dispatch, RefObject } from 'react';
|
|
2
|
+
import { DocViewerRef, IDragDropConfig, IDocument } from '..';
|
|
3
|
+
import { DocViewerProps } from '../DocViewer';
|
|
4
|
+
import { MainStateActions } from './actions';
|
|
5
|
+
import { IMainState } from './mainStateReducer';
|
|
6
|
+
|
|
7
|
+
export interface DocViewerProviderRef {
|
|
8
|
+
handleFilesDropped: (files: File[]) => Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
interface ExtendedDocViewerProps extends DocViewerProps {
|
|
11
|
+
dragDropConfig?: IDragDropConfig;
|
|
12
|
+
providerRef?: RefObject<DocViewerProviderRef>;
|
|
13
|
+
}
|
|
14
|
+
declare const DocViewerContext: React.Context<{
|
|
15
|
+
state: IMainState;
|
|
16
|
+
dispatch: Dispatch<MainStateActions>;
|
|
17
|
+
addDroppedDocuments?: ((documents: IDocument[]) => void) | undefined;
|
|
18
|
+
}>;
|
|
19
|
+
declare const DocViewerProvider: React.ForwardRefExoticComponent<ExtendedDocViewerProps & {
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
} & React.RefAttributes<DocViewerRef>>;
|
|
22
|
+
export { DocViewerContext, DocViewerProvider };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { IConfig, IDocument } from '../models';
|
|
2
|
+
|
|
3
|
+
export declare const SET_ALL_DOCUMENTS = "SET_ALL_DOCUMENTS";
|
|
4
|
+
export declare const SET_DOCUMENT_LOADING = "SET_DOCUMENT_LOADING";
|
|
5
|
+
export declare const NEXT_DOCUMENT = "NEXT_DOCUMENT";
|
|
6
|
+
export declare const PREVIOUS_DOCUMENT = "PREVIOUS_DOCUMENT";
|
|
7
|
+
export declare const UPDATE_CURRENT_DOCUMENT = "UPDATE_CURRENT_DOCUMENT";
|
|
8
|
+
export declare const SET_RENDERER_RECT = "SET_RENDERER_RECT";
|
|
9
|
+
export declare const SET_MAIN_CONFIG = "SET_MAIN_CONFIG";
|
|
10
|
+
export declare const ADD_DOCUMENTS_FROM_DROP = "ADD_DOCUMENTS_FROM_DROP";
|
|
11
|
+
export declare const SET_DRAG_STATE = "SET_DRAG_STATE";
|
|
12
|
+
export declare const GO_TO_PAGE = "GO_TO_PAGE";
|
|
13
|
+
export interface SetAllDocuments {
|
|
14
|
+
type: typeof SET_ALL_DOCUMENTS;
|
|
15
|
+
documents: IDocument[];
|
|
16
|
+
initialActiveDocument?: IDocument;
|
|
17
|
+
}
|
|
18
|
+
export interface SetDocumentLoading {
|
|
19
|
+
type: typeof SET_DOCUMENT_LOADING;
|
|
20
|
+
value: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface SetRendererRect {
|
|
23
|
+
type: typeof SET_RENDERER_RECT;
|
|
24
|
+
rect: DOMRect;
|
|
25
|
+
}
|
|
26
|
+
export interface SetMainConfig {
|
|
27
|
+
type: typeof SET_MAIN_CONFIG;
|
|
28
|
+
config: IConfig;
|
|
29
|
+
}
|
|
30
|
+
export interface NextDocument {
|
|
31
|
+
type: typeof NEXT_DOCUMENT;
|
|
32
|
+
}
|
|
33
|
+
export interface UpdateCurrentDocument {
|
|
34
|
+
type: typeof UPDATE_CURRENT_DOCUMENT;
|
|
35
|
+
document: IDocument;
|
|
36
|
+
}
|
|
37
|
+
export interface PreviousDocument {
|
|
38
|
+
type: typeof PREVIOUS_DOCUMENT;
|
|
39
|
+
}
|
|
40
|
+
export declare const setAllDocuments: (documents: IDocument[], initialActiveDocument?: IDocument) => SetAllDocuments;
|
|
41
|
+
export declare const setDocumentLoading: (value: boolean) => SetDocumentLoading;
|
|
42
|
+
export declare const nextDocument: () => NextDocument;
|
|
43
|
+
export declare const previousDocument: () => PreviousDocument;
|
|
44
|
+
export declare const updateCurrentDocument: (document: IDocument) => UpdateCurrentDocument;
|
|
45
|
+
export declare const setRendererRect: (rect: DOMRect) => SetRendererRect;
|
|
46
|
+
export declare const setMainConfig: (config: IConfig) => SetMainConfig;
|
|
47
|
+
export interface AddDocumentsFromDrop {
|
|
48
|
+
type: typeof ADD_DOCUMENTS_FROM_DROP;
|
|
49
|
+
documents: IDocument[];
|
|
50
|
+
behavior: "append" | "replace";
|
|
51
|
+
}
|
|
52
|
+
export declare const addDocumentsFromDrop: (documents: IDocument[], behavior?: "append" | "replace") => AddDocumentsFromDrop;
|
|
53
|
+
export interface SetDragState {
|
|
54
|
+
type: typeof SET_DRAG_STATE;
|
|
55
|
+
isDragging: boolean;
|
|
56
|
+
}
|
|
57
|
+
export declare const setDragState: (isDragging: boolean) => SetDragState;
|
|
58
|
+
export interface GoToPage {
|
|
59
|
+
type: typeof GO_TO_PAGE;
|
|
60
|
+
pageNumber: number;
|
|
61
|
+
}
|
|
62
|
+
export declare const goToPage: (pageNumber: number) => GoToPage;
|
|
63
|
+
export type MainStateActions = SetAllDocuments | SetDocumentLoading | NextDocument | PreviousDocument | UpdateCurrentDocument | SetRendererRect | SetMainConfig | AddDocumentsFromDrop | SetDragState | GoToPage;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DocRenderer, IConfig, IDocument } from '..';
|
|
2
|
+
import { MainStateActions } from './actions';
|
|
3
|
+
import { AvailableLanguages } from '../i18n';
|
|
4
|
+
|
|
5
|
+
export type IMainState = {
|
|
6
|
+
currentFileNo: number;
|
|
7
|
+
documents: IDocument[];
|
|
8
|
+
documentLoading?: boolean;
|
|
9
|
+
currentDocument?: IDocument;
|
|
10
|
+
rendererRect?: DOMRect;
|
|
11
|
+
config?: IConfig;
|
|
12
|
+
pluginRenderers?: DocRenderer[];
|
|
13
|
+
prefetchMethod?: string;
|
|
14
|
+
requestHeaders?: Record<string, string>;
|
|
15
|
+
language: AvailableLanguages;
|
|
16
|
+
activeDocument?: IDocument;
|
|
17
|
+
onDocumentChange?: (document: IDocument) => void;
|
|
18
|
+
isDragging?: boolean;
|
|
19
|
+
targetPage?: number;
|
|
20
|
+
};
|
|
21
|
+
export declare const initialState: IMainState;
|
|
22
|
+
export type MainStateReducer = (state: IMainState, action: MainStateActions) => IMainState;
|
|
23
|
+
export declare const mainStateReducer: MainStateReducer;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";const re=require("./index-BW6EMUiE.cjs");var ne={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */ne.exports;(function(e,r){(function(t){var o=r&&!r.nodeType&&r,a=e&&!e.nodeType&&e,p=typeof re.commonjsGlobal=="object"&&re.commonjsGlobal;(p.global===p||p.window===p||p.self===p)&&(t=p);var l,n=2147483647,m=36,c=1,x=26,_=38,g=700,u=72,w=128,N="-",A=/^xn--/,K=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},T=m-c,v=Math.floor,C=String.fromCharCode,z;function U(s){throw new RangeError(y[s])}function j(s,i){for(var f=s.length,d=[];f--;)d[f]=i(s[f]);return d}function M(s,i){var f=s.split("@"),d="";f.length>1&&(d=f[0]+"@",s=f[1]),s=s.replace(h,".");var b=s.split("."),I=j(b,i).join(".");return d+I}function J(s){for(var i=[],f=0,d=s.length,b,I;f<d;)b=s.charCodeAt(f++),b>=55296&&b<=56319&&f<d?(I=s.charCodeAt(f++),(I&64512)==56320?i.push(((b&1023)<<10)+(I&1023)+65536):(i.push(b),f--)):i.push(b);return i}function ee(s){return j(s,function(i){var f="";return i>65535&&(i-=65536,f+=C(i>>>10&1023|55296),i=56320|i&1023),f+=C(i),f}).join("")}function W(s){return s-48<10?s-22:s-65<26?s-65:s-97<26?s-97:m}function X(s,i){return s+22+75*(s<26)-((i!=0)<<5)}function Y(s,i,f){var d=0;for(s=f?v(s/g):s>>1,s+=v(s/i);s>T*x>>1;d+=m)s=v(s/T);return v(d+(T+1)*s/(s+_))}function Z(s){var i=[],f=s.length,d,b=0,I=w,R=u,F,S,$,D,O,L,q,B,V;for(F=s.lastIndexOf(N),F<0&&(F=0),S=0;S<F;++S)s.charCodeAt(S)>=128&&U("not-basic"),i.push(s.charCodeAt(S));for($=F>0?F+1:0;$<f;){for(D=b,O=1,L=m;$>=f&&U("invalid-input"),q=W(s.charCodeAt($++)),(q>=m||q>v((n-b)/O))&&U("overflow"),b+=q*O,B=L<=R?c:L>=R+x?x:L-R,!(q<B);L+=m)V=m-B,O>v(n/V)&&U("overflow"),O*=V;d=i.length+1,R=Y(b-D,d,D==0),v(b/d)>n-I&&U("overflow"),I+=v(b/d),b%=d,i.splice(b++,0,I)}return ee(i)}function te(s){var i,f,d,b,I,R,F,S,$,D,O,L=[],q,B,V,oe;for(s=J(s),q=s.length,i=w,f=0,I=u,R=0;R<q;++R)O=s[R],O<128&&L.push(C(O));for(d=b=L.length,b&&L.push(N);d<q;){for(F=n,R=0;R<q;++R)O=s[R],O>=i&&O<F&&(F=O);for(B=d+1,F-i>v((n-f)/B)&&U("overflow"),f+=(F-i)*B,i=F,R=0;R<q;++R)if(O=s[R],O<i&&++f>n&&U("overflow"),O==i){for(S=f,$=m;D=$<=I?c:$>=I+x?x:$-I,!(S<D);$+=m)oe=S-D,V=m-D,L.push(C(X(D+oe%V,0))),S=v(oe/V);L.push(C(X(S,0))),I=Y(f,B,d==b),f=0,++d}++f,++i}return L.join("")}function Ue(s){return M(s,function(i){return A.test(i)?Z(i.slice(4).toLowerCase()):i})}function Oe(s){return M(s,function(i){return K.test(i)?"xn--"+te(i):i})}if(l={version:"1.4.1",ucs2:{decode:J,encode:ee},decode:Z,encode:te,toASCII:Oe,toUnicode:Ue},o&&a)if(e.exports==o)a.exports=l;else for(z in l)l.hasOwnProperty(z)&&(o[z]=l[z]);else t.punycode=l})(re.commonjsGlobal)})(ne,ne.exports);var Ie=ne.exports;const Te=re.getDefaultExportFromCjs(Ie);function je(e,r){return Object.prototype.hasOwnProperty.call(e,r)}var Fe=function(e,r,t,o){r=r||"&",t=t||"=";var a={};if(typeof e!="string"||e.length===0)return a;var p=/\+/g;e=e.split(r);var l=1e3;o&&typeof o.maxKeys=="number"&&(l=o.maxKeys);var n=e.length;l>0&&n>l&&(n=l);for(var m=0;m<n;++m){var c=e[m].replace(p,"%20"),x=c.indexOf(t),_,g,u,w;x>=0?(_=c.substr(0,x),g=c.substr(x+1)):(_=c,g=""),u=decodeURIComponent(_),w=decodeURIComponent(g),je(a,u)?Le(a[u])?a[u].push(w):a[u]=[a[u],w]:a[u]=w}return a},Le=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},Q=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}},Pe=function(e,r,t,o){return r=r||"&",t=t||"=",e===null&&(e=void 0),typeof e=="object"?ie(Se(e),function(a){var p=encodeURIComponent(Q(a))+t;return _e(e[a])?ie(e[a],function(l){return p+encodeURIComponent(Q(l))}).join(r):p+encodeURIComponent(Q(e[a]))}).join(r):o?encodeURIComponent(Q(o))+t+encodeURIComponent(Q(e)):""},_e=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function ie(e,r){if(e.map)return e.map(r);for(var t=[],o=0;o<e.length;o++)t.push(r(e[o],o));return t}var Se=Object.keys||function(e){var r=[];for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r},le,pe,qe=pe=Fe,$e=le=Pe;function Ee(e){return encodeURIComponent(e)}function Me(e){return decodeURIComponent(e)}var De={decode:qe,encode:$e,parse:pe,stringify:le,escape:Ee,unescape:Me},Ne={isString:function(e){return typeof e=="string"},isObject:function(e){return typeof e=="object"&&e!==null},isNull:function(e){return e===null},isNullOrUndefined:function(e){return e==null}},ze=Te,E=Ne,Be=k,Ge=tt,me=rt,Ke=et,We=P;function P(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Ze=/^([a-z0-9.+-]+:)/i,Ve=/:[0-9]*$/,Je=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Xe=["<",">",'"',"`"," ","\r",`
|
|
2
|
+
`," "],Ye=["{","}","|","\\","^","`"].concat(Xe),se=["'"].concat(Ye),fe=["%","/","?",";","#"].concat(se),ue=["/","?","#"],He=255,ce=/^[+a-z0-9A-Z_-]{0,63}$/,Qe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ke={javascript:!0,"javascript:":!0},ae={javascript:!0,"javascript:":!0},H={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},he=De;function k(e,r,t){if(e&&E.isObject(e)&&e instanceof P)return e;var o=new P;return o.parse(e,r,t),o}P.prototype.parse=function(e,r,t){if(!E.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var o=e.indexOf("?"),a=o!==-1&&o<e.indexOf("#")?"?":"#",p=e.split(a),l=/\\/g;p[0]=p[0].replace(l,"/"),e=p.join(a);var n=e;if(n=n.trim(),!t&&e.split("#").length===1){var m=Je.exec(n);if(m)return this.path=n,this.href=n,this.pathname=m[1],m[2]?(this.search=m[2],r?this.query=he.parse(this.search.substr(1)):this.query=this.search.substr(1)):r&&(this.search="",this.query={}),this}var c=Ze.exec(n);if(c){c=c[0];var x=c.toLowerCase();this.protocol=x,n=n.substr(c.length)}if(t||c||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var _=n.substr(0,2)==="//";_&&!(c&&ae[c])&&(n=n.substr(2),this.slashes=!0)}if(!ae[c]&&(_||c&&!H[c])){for(var g=-1,u=0;u<ue.length;u++){var w=n.indexOf(ue[u]);w!==-1&&(g===-1||w<g)&&(g=w)}var N,A;g===-1?A=n.lastIndexOf("@"):A=n.lastIndexOf("@",g),A!==-1&&(N=n.slice(0,A),n=n.slice(A+1),this.auth=decodeURIComponent(N)),g=-1;for(var u=0;u<fe.length;u++){var w=n.indexOf(fe[u]);w!==-1&&(g===-1||w<g)&&(g=w)}g===-1&&(g=n.length),this.host=n.slice(0,g),n=n.slice(g),this.parseHost(),this.hostname=this.hostname||"";var K=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!K)for(var h=this.hostname.split(/\./),u=0,y=h.length;u<y;u++){var T=h[u];if(T&&!T.match(ce)){for(var v="",C=0,z=T.length;C<z;C++)T.charCodeAt(C)>127?v+="x":v+=T[C];if(!v.match(ce)){var U=h.slice(0,u),j=h.slice(u+1),M=T.match(Qe);M&&(U.push(M[1]),j.unshift(M[2])),j.length&&(n="/"+j.join(".")+n),this.hostname=U.join(".");break}}}this.hostname.length>He?this.hostname="":this.hostname=this.hostname.toLowerCase(),K||(this.hostname=ze.toASCII(this.hostname));var J=this.port?":"+this.port:"",ee=this.hostname||"";this.host=ee+J,this.href+=this.host,K&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),n[0]!=="/"&&(n="/"+n))}if(!ke[x])for(var u=0,y=se.length;u<y;u++){var W=se[u];if(n.indexOf(W)!==-1){var X=encodeURIComponent(W);X===W&&(X=escape(W)),n=n.split(W).join(X)}}var Y=n.indexOf("#");Y!==-1&&(this.hash=n.substr(Y),n=n.slice(0,Y));var Z=n.indexOf("?");if(Z!==-1?(this.search=n.substr(Z),this.query=n.substr(Z+1),r&&(this.query=he.parse(this.query)),n=n.slice(0,Z)):r&&(this.search="",this.query={}),n&&(this.pathname=n),H[x]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var J=this.pathname||"",te=this.search||"";this.path=J+te}return this.href=this.format(),this};function et(e){return E.isString(e)&&(e=k(e)),e instanceof P?e.format():P.prototype.format.call(e)}P.prototype.format=function(){var e=this.auth||"";e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,":"),e+="@");var r=this.protocol||"",t=this.pathname||"",o=this.hash||"",a=!1,p="";this.host?a=e+this.host:this.hostname&&(a=e+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(a+=":"+this.port)),this.query&&E.isObject(this.query)&&Object.keys(this.query).length&&(p=he.stringify(this.query));var l=this.search||p&&"?"+p||"";return r&&r.substr(-1)!==":"&&(r+=":"),this.slashes||(!r||H[r])&&a!==!1?(a="//"+(a||""),t&&t.charAt(0)!=="/"&&(t="/"+t)):a||(a=""),o&&o.charAt(0)!=="#"&&(o="#"+o),l&&l.charAt(0)!=="?"&&(l="?"+l),t=t.replace(/[?#]/g,function(n){return encodeURIComponent(n)}),l=l.replace("#","%23"),r+a+t+l+o};function tt(e,r){return k(e,!1,!0).resolve(r)}P.prototype.resolve=function(e){return this.resolveObject(k(e,!1,!0)).format()};function rt(e,r){return e?k(e,!1,!0).resolveObject(r):r}P.prototype.resolveObject=function(e){if(E.isString(e)){var r=new P;r.parse(e,!1,!0),e=r}for(var t=new P,o=Object.keys(this),a=0;a<o.length;a++){var p=o[a];t[p]=this[p]}if(t.hash=e.hash,e.href==="")return t.href=t.format(),t;if(e.slashes&&!e.protocol){for(var l=Object.keys(e),n=0;n<l.length;n++){var m=l[n];m!=="protocol"&&(t[m]=e[m])}return H[t.protocol]&&t.hostname&&!t.pathname&&(t.path=t.pathname="/"),t.href=t.format(),t}if(e.protocol&&e.protocol!==t.protocol){if(!H[e.protocol]){for(var c=Object.keys(e),x=0;x<c.length;x++){var _=c[x];t[_]=e[_]}return t.href=t.format(),t}if(t.protocol=e.protocol,!e.host&&!ae[e.protocol]){for(var y=(e.pathname||"").split("/");y.length&&!(e.host=y.shift()););e.host||(e.host=""),e.hostname||(e.hostname=""),y[0]!==""&&y.unshift(""),y.length<2&&y.unshift(""),t.pathname=y.join("/")}else t.pathname=e.pathname;if(t.search=e.search,t.query=e.query,t.host=e.host||"",t.auth=e.auth,t.hostname=e.hostname||e.host,t.port=e.port,t.pathname||t.search){var g=t.pathname||"",u=t.search||"";t.path=g+u}return t.slashes=t.slashes||e.slashes,t.href=t.format(),t}var w=t.pathname&&t.pathname.charAt(0)==="/",N=e.host||e.pathname&&e.pathname.charAt(0)==="/",A=N||w||t.host&&e.pathname,K=A,h=t.pathname&&t.pathname.split("/")||[],y=e.pathname&&e.pathname.split("/")||[],T=t.protocol&&!H[t.protocol];if(T&&(t.hostname="",t.port=null,t.host&&(h[0]===""?h[0]=t.host:h.unshift(t.host)),t.host="",e.protocol&&(e.hostname=null,e.port=null,e.host&&(y[0]===""?y[0]=e.host:y.unshift(e.host)),e.host=null),A=A&&(y[0]===""||h[0]==="")),N)t.host=e.host||e.host===""?e.host:t.host,t.hostname=e.hostname||e.hostname===""?e.hostname:t.hostname,t.search=e.search,t.query=e.query,h=y;else if(y.length)h||(h=[]),h.pop(),h=h.concat(y),t.search=e.search,t.query=e.query;else if(!E.isNullOrUndefined(e.search)){if(T){t.hostname=t.host=h.shift();var v=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;v&&(t.auth=v.shift(),t.host=t.hostname=v.shift())}return t.search=e.search,t.query=e.query,(!E.isNull(t.pathname)||!E.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.href=t.format(),t}if(!h.length)return t.pathname=null,t.search?t.path="/"+t.search:t.path=null,t.href=t.format(),t;for(var C=h.slice(-1)[0],z=(t.host||e.host||h.length>1)&&(C==="."||C==="..")||C==="",U=0,j=h.length;j>=0;j--)C=h[j],C==="."?h.splice(j,1):C===".."?(h.splice(j,1),U++):U&&(h.splice(j,1),U--);if(!A&&!K)for(;U--;U)h.unshift("..");A&&h[0]!==""&&(!h[0]||h[0].charAt(0)!=="/")&&h.unshift(""),z&&h.join("/").substr(-1)!=="/"&&h.push("");var M=h[0]===""||h[0]&&h[0].charAt(0)==="/";if(T){t.hostname=t.host=M?"":h.length?h.shift():"";var v=t.host&&t.host.indexOf("@")>0?t.host.split("@"):!1;v&&(t.auth=v.shift(),t.host=t.hostname=v.shift())}return A=A||t.host&&h.length,A&&!M&&h.unshift(""),h.length?t.pathname=h.join("/"):(t.pathname=null,t.path=null),(!E.isNull(t.pathname)||!E.isNull(t.search))&&(t.path=(t.pathname?t.pathname:"")+(t.search?t.search:"")),t.auth=e.auth||t.auth,t.slashes=t.slashes||e.slashes,t.href=t.format(),t};P.prototype.parseHost=function(){var e=this.host,r=Ve.exec(e);r&&(r=r[0],r!==":"&&(this.port=r.substr(1)),e=e.substr(0,e.length-r.length)),e&&(this.hostname=e)};function nt(e,r){for(var t=0,o=e.length-1;o>=0;o--){var a=e[o];a==="."?e.splice(o,1):a===".."?(e.splice(o,1),t++):t&&(e.splice(o,1),t--)}if(r)for(;t--;t)e.unshift("..");return e}function ot(){for(var e="",r=!1,t=arguments.length-1;t>=-1&&!r;t--){var o=t>=0?arguments[t]:"/";if(typeof o!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!o)continue;e=o+"/"+e,r=o.charAt(0)==="/"}return e=nt(st(e.split("/"),function(a){return!!a}),!r).join("/"),(r?"/":"")+e||"."}function st(e,r){if(e.filter)return e.filter(r);for(var t=[],o=0;o<e.length;o++)r(e[o],o,e)&&t.push(e[o]);return t}var de=function(e){function r(){var o=this||self;return delete e.prototype.__magic__,o}if(typeof globalThis=="object")return globalThis;if(this)return r();e.defineProperty(e.prototype,"__magic__",{configurable:!0,get:r});var t=__magic__;return t}(Object),at=Ke,ve=Be,ge=Ge,ye=We,G=de.URL,be=de.URLSearchParams,ht=/%/g,it=/\\/g,ft=/\n/g,ut=/\r/g,ct=/\t/g,lt=47;function pt(e){var r=e??null;return!!(r!==null&&(r!=null&&r.href)&&(r!=null&&r.origin))}function mt(e){if(e.hostname!=="")throw new TypeError('File URL host must be "localhost" or empty on browser');for(var r=e.pathname,t=0;t<r.length;t++)if(r[t]==="%"){var o=r.codePointAt(t+2)|32;if(r[t+1]==="2"&&o===102)throw new TypeError("File URL path must not include encoded / characters")}return decodeURIComponent(r)}function dt(e){return e.includes("%")&&(e=e.replace(ht,"%25")),e.includes("\\")&&(e=e.replace(it,"%5C")),e.includes(`
|
|
3
|
+
`)&&(e=e.replace(ft,"%0A")),e.includes("\r")&&(e=e.replace(ut,"%0D")),e.includes(" ")&&(e=e.replace(ct,"%09")),e}var xe=function(r){if(typeof r>"u")throw new TypeError('The "domain" argument must be specified');return new G("http://"+r).hostname},we=function(r){if(typeof r>"u")throw new TypeError('The "domain" argument must be specified');return new G("http://"+r).hostname},Ce=function(r){var t=new G("file://"),o=ot(r),a=r.charCodeAt(r.length-1);return a===lt&&o[o.length-1]!=="/"&&(o+="/"),t.pathname=dt(o),t},Re=function(r){if(!pt(r)&&typeof r!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof r+" ("+r+")");var t=new G(r);if(t.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return mt(t)},Ae=function(r,t){var o,a,p;if(t===void 0&&(t={}),!(r instanceof G))return at(r);if(typeof t!="object"||t===null)throw new TypeError('The "options" argument must be of type object.');var l=(o=t.auth)!=null?o:!0,n=(a=t.fragment)!=null?a:!0,m=(p=t.search)!=null?p:!0,c=new G(r.toString());return l||(c.username="",c.password=""),n||(c.hash=""),m||(c.search=""),c.toString()},vt={format:Ae,parse:ve,resolve:ge,resolveObject:me,Url:ye,URL:G,URLSearchParams:be,domainToASCII:xe,domainToUnicode:we,pathToFileURL:Ce,fileURLToPath:Re};const gt=Object.freeze(Object.defineProperty({__proto__:null,URL:G,URLSearchParams:be,Url:ye,default:vt,domainToASCII:xe,domainToUnicode:we,fileURLToPath:Re,format:Ae,parse:ve,pathToFileURL:Ce,resolve:ge,resolveObject:me},Symbol.toStringTag,{value:"Module"}));exports.url=gt;
|