/**
 *	Image Map Editor (imgmap) - in-browser imagemap editor
 *	Copyright (C) 2006 - 2008 Adam Maschek (adam.maschek @ gmail.com)
 *
 *	This program is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU General Public License
 *	as published by the Free Software Foundation; either version 2
 *	of the License, or (at your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program; if not, write to the Free Software
 *	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
/**
 *	@fileoverview
 *	Online Image Map Editor - main script file.
 *	This is the main script file of the Online Image Map Editor.
 *
 *	@date	26-02-2007 2:24:50
 *	@author	Adam Maschek (adam.maschek(at)gmail.com)
 *	@copyright
 *	@version 2.2
 *
 */
/**
 *	@author	Adam Maschek
 *	@constructor
 *	@param config	The config object.
 */
interface IImageMapConfig {
    custom_callbacks: object;
    CL_DRAW_SHAPE: string;
    CL_DRAW_BG: string;
    CL_NORM_SHAPE: string;
    CL_NORM_BG: string;
    CL_HIGHLIGHT_SHAPE: string;
    CL_HIGHLIGHT_BG: string;
    CL_KNOB: string;
    bounding_box: boolean;
    label: string;
    label_class: string;
    label_style: string;
    hint: string;
    draw_opacity: string;
    norm_opacity: string;
    highlight_opacity: string;
    cursor_default: string;
}
export interface IImageMapOptions {
    imageElement: HTMLElement;
    custom_callbacks: Object;
    bounding_box: boolean;
    CL_DRAW_SHAPE: string;
    CL_NORM_SHAPE: string;
    CL_HIGHLIGHT_SHAPE: string;
    strings: Object;
}
export interface IImageMapData {
    name: string;
    id?: string;
    areas: IImageMapArea[];
    imageWidth?: number;
    imageHeight?: number;
}
export interface IImageMapArea {
    shape: "rect" | "circle" | "poly" | "";
    coords: string;
    href: string;
    target: string;
    alt: string;
}
export declare class QMSCKEditorImageMapLib {
    /** Version string of imgmap */
    version: string;
    /** Build date of imgmap */
    buildDate: string;
    /** Sequential build number of imgmap */
    buildNumber: string;
    /** Config object of the imgmap instance */
    config: IImageMapConfig;
    /** Status flag to indicate current drawing mode */
    is_drawing: number;
    /**	Array to hold language strings */
    strings: any[];
    /** Helper array for some drawing operations */
    memory: any[];
    /**	Array to hold reference to all areas (canvases) */
    areas: any[];
    imageElement: HTMLElement;
    parentImageElement: HTMLElement;
    /**	Associative array to hold bound event handlers */
    eventHandlers: {};
    currentid: number;
    draggedId: any;
    selectedId: any;
    nextShape: string;
    /**	Callback events that you can handle in your GUI. */
    event_types: string[];
    isLoaded: boolean;
    /**	holds the name of the actively edited map, use getMapName to read it */
    mapname: string;
    /**	holds the id of the actively edited map, use getMapIdto read it */
    mapid: string;
    /** global scale of areas (1-normal, 2-doubled, 0.5-half, etc.) */
    globalscale: number;
    /** is_drawing draw mode constant */
    DM_RECTANGLE_DRAW: number;
    /** is_drawing draw mode constant */
    DM_RECTANGLE_MOVE: number;
    /** is_drawing draw mode constant */
    DM_RECTANGLE_RESIZE_TOP: number;
    /** is_drawing draw mode constant */
    DM_RECTANGLE_RESIZE_RIGHT: number;
    /** is_drawing draw mode constant */
    DM_RECTANGLE_RESIZE_BOTTOM: number;
    /** is_drawing draw mode constant */
    DM_RECTANGLE_RESIZE_LEFT: number;
    /** is_drawing draw mode constant */
    DM_SQUARE_DRAW: number;
    /** is_drawing draw mode constant */
    DM_SQUARE_MOVE: number;
    /** is_drawing draw mode constant */
    DM_SQUARE_RESIZE_TOP: number;
    /** is_drawing draw mode constant */
    DM_SQUARE_RESIZE_RIGHT: number;
    /** is_drawing draw mode constant */
    DM_SQUARE_RESIZE_BOTTOM: number;
    /** is_drawing draw mode constant */
    DM_SQUARE_RESIZE_LEFT: number;
    /** is_drawing draw mode constant */
    DM_POLYGON_DRAW: number;
    /** is_drawing draw mode constant */
    DM_POLYGON_LASTDRAW: number;
    /** is_drawing draw mode constant */
    DM_POLYGON_MOVE: number;
    isMSIE: boolean;
    isSafari: boolean;
    constructor(options: IImageMapOptions);
    /**
     *	Main setup function.
     *	Can be called manually or constructor will call it.
     *	@date	22-02-2007 0:15:42
     *	@author	Adam Maschek (adam.maschek(at)gmail.com)
     *	@param	config	config object
     *	@return	True if all went ok.
     */
    setup: (options: IImageMapOptions) => boolean;
    /**
    *	Attach new 'evt' event handler 'callback' to 'obj'
    *	@date	24-02-2007 21:16:20
    *	@param	obj	The object on which the handler is defined.
    *	@param	evt	The name of the event, like mousedown.
    *	@param	callback	The callback function (named if you want it to be removed).
    */
    addEvent: (obj: any, evt: any, callback: any) => any;
    /**
    *	Detach 'evt' event handled by 'callback' from 'obj' object.
    *	Callback must be a non anonymous function, see eventHandlers.
    *	@see	#eventHandlers
    *	Example: myimgmap.removeEvent(myimgmap.pic, 'mousedown', myimgmap.eventHandlers.img_mousedown);
    *	@date	24-11-2007 15:22:17
    *	@param	obj	The object on which the handler is defined.
    *	@param	evt	The name of the event, like mousedown.
    *	@param	callback	The named callback function.
    */
    removeEvent: (obj: any, evt: any, callback: any) => any;
    /**
    *	Fires custom hook onStatusMessage, passing the status string.
    *	Use this to update your GUI.
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@date	26-07-2008 13:22:54
    *	@param	str	The status string
    */
    statusMessage: (str: any) => void;
    /**
    *	Adds basic logging functionality using firebug console object if available.
    *	@date	20-02-2007 17:55:18
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@param	obj	The object or string you want to debug/echo.
    */
    log: (obj: any, level: any) => void;
    /**
    *	Get the map name of the current imagemap.
    *	If doesnt exist, nor map id, generate a new name based on timestamp.
    *	The most portable solution is to use the same value for id and name.
    *	This also conforms the HTML 5 specification, that says:
    *	"If the id  attribute is also specified, both attributes must have the same value."
    *	@link	http://www.w3.org/html/wg/html5/#the-map-element
    *	@author	adam
    *	@see	#getMapId
    *	@return The name of the map.
    */
    getMapName: () => any;
    /**
    *	Get the map id of the current imagemap.
    *	If doesnt exist, use map name.
    *	@author	adam
    *	@see	#getMapName
    *	@return	The id of the map.
    */
    getMapId: () => any;
    getMapJson: () => IImageMapData;
    /**
    *	Convert wild shape names to normal ones.
    *	@date	25-12-2008 19:27:06
    *	@param	shape	The name of the shape to convert.
    *	@return	The normalized shape name, rect as default.
    */
    _normShape: (shape: any) => "circle" | "rect" | "poly";
    /**
    *	Try to normalize coordinates that came from:
    *	1. html textarea
    *	2. user input in the active area's input field
    *	3. from the html source in case of plugins or highlighter
    *	Example of inputs that need to be handled:
    *		035,035 075,062
    *		150,217, 190,257, 150,297,110,257
    *	@author	adam
    *	@param	coords	The coordinates in a string.
    *	@param	shape	The shape of the object (rect, circle, poly).
    *	@param	flag	Flags that modify the operation. (fromcircle, frompoly, fromrect, preserve)
    *	@returns The normalized coordinates.
    */
    _normCoords: (coords: any, shape: any, flag: any) => any;
    /**
     *	Sets the coordinates according to the given JSON map code or DOM object.
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@date	2006-06-07 11:47:16
    *	@param	map	DOM object or string of a map you want to apply.
    *	@return	True on success
    */
    setMapJson: (map: IImageMapData) => void;
    /**
    *	Adds a new area. It will later become a canvas.
    *	GUI should use the onAddArea callback to act accordingly.
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@date	2006-06-06 16:49:25
    *	@see	#initArea
    */
    addNewArea: () => any;
    /**
    *	Initialize a new area.
    *	Create the canvas, initialize it.
    *	Reset area parameters.
    *	@param	id	The id of the area (already existing with undefined shape)
    *	@param	shape	The shape the area will have (rect, circle, poly)
    */
    initArea: (id: any, shape: any) => void;
    /**
    *	Resets area border and opacity to a normal state after drawing.
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@date	15-02-2007 22:07:28
    *	@param	id	The id of the area.

    */
    relaxArea: (id: any) => void;
    /**
    *	Set border of a given area according to style flag.
    *	Possible values of style: NORM, HIGHLIGHT, DRAW.
    *	Non-rectangle shapes wont get a border if config.bounding_box is false.
    *	@date	26-12-2008 22:34:41
    *	@param	id	The id of the area to set the border on.
    *	@param	style	Coloring style (NORM, HIGHLIGHT, DRAW), see relevant colors in config.
    *	@since	2.1
    */
    _setBorder: (area: any, style: any) => void;
    /**
    *	Set opacity of area to the given percentage, as well as set the background color.
    *	If percentage contains a dash(-), the setting of the opacity will be gradual.
    *	@param	area	The area object.
    *	@param	bgcolor	New background color
    *	@param	pct		Percentage of the opacity.
    */
    _setopacity: (area: any, bgcolor: any, pct: any) => void;
    /**
    *	Get the currently set opacity of a given area.
    *	@author	adam
    *	@param	area	The area (canvas) you want to get opacity info from.
    *	@return	Opacity value in a range of 0-100.
    */
    _getopacity: (area: any) => number;
    /**
    *	Removes the area marked by id.
    *	Callback will call the GUI code to remove GUI elements.
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@date	11-02-2007 20:40:58
    *	@param	id	The id of the area to remove.
    *	@see	#removeAllAreas
    */
    removeArea: (id: any) => void;
    /**
    *	Removes all areas.
    *	Will call removeArea on all areas.
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@date	2006-06-07 11:55:34
    *	@see	#removeArea
    */
    removeAllAreas: () => void;
    /**
    *	Scales all areas.
    *	Will store scale parameter in globalscale property.
    *	This is needed to know how to draw new areas on an already scaled canvas.
    *	@author	adam
    *	@date	02-11-2008 14:13:14
    *	@param scale	Scale factor (1-original, 0.5-half, 2-double, etc.)
    */
    scaleAllAreas: (scale: any) => void;
    /**
    *	Scales one area.
    *	@author	adam
    *	@date	02-11-2008 14:13:14
    *	@param rscale	Relative scale factor (1-keep, 0.5-half, 2-double, etc.)
    */
    scaleArea: (id: any, rscale: any) => void;
    /**
    *	Put label in the top left corner according to label config.
    *	By default it will contain the number of the area (area.aid)
    *	@param	id	The id of the area to add label to.
    */
    _putlabel: (id: any) => void;
    /**
    *	Set area title and alt (for IE) according to the hint configuration.
    *	This will show up in the usual yellow box when you hover over with the mouse.
    *	@param	id	The id of the area to set hint at.
    */
    _puthint: (id: any) => void;
    /**
    *	Will call repaint on all areas.
    *	Useful when you change labeling or hint config on the GUI.
    *	@see #_repaint
    */
    _repaintAll: () => void;
    /**
    *	Repaints the actual canvas content.
    *	This is the only canvas drawing magic that is happening.
    *	In fact rectangles will not have any canvas content, just a normal css border.
    *	After repainting the canvas, it will call putlabel and puthint methods.
    *	@param	area	The area object.
    *	@param	color	Color of the line to draw on the canvas.
    *	@param	x	Only used for polygons as the newest control point x.
    *	@param	y	Only used for polygons as the newest control point y.
    */
    _repaint: (area: any, color: any, x: any, y: any) => void;
    /**
    *	Updates Area coordinates.
    *	Called when needed, eg. on mousemove, mousedown.
    *	Also updates html container value (thru hook).
    *	Calls callback onAreaChanged so that GUI can follow.
    *	This is an important hook to your GUI.
    *	Uses globalscale to scale real coordinates to area coordinates.
    *	@date	2006.10.24. 22:39:27
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@param	id	The id of the area.
    */
    _updatecoords: (id: any) => void;
    /**
    *	Updates the visual representation of the area with the given id according
    *	to the new coordinates that typically come from an input on the GUI.
    *	Uses globalscale to scale area coordinates to real coordinates.
    *	@date	2006.10.24. 22:46:55
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@param	id	The id of the area.
    *	@param	coords	The new coords, they will be normalized.
    */
    _recalculate: (id: any, coords: any) => void;
    /**
    *	Grow polygon area to be able to contain the given new coordinates.
    *	@author	adam
    *	@param	area	The area to grow.
    *	@param	newx	The new coordinate x.
    *	@param	newy	The new coordinate y.
    *	@see	#_polygonshrink
    */
    _polygongrow: (area: any, newx: any, newy: any) => void;
    /**
    *	Shrink the polygon bounding area to the necessary size, by first reducing it
    *	to the minimum, and then gradually growing it.
    *	We need this because while we were drawing the polygon, it might have expanded
    *	the canvas more than needed.
    *	Will repaint the area.
    *	@author	adam
    *	@param	area	The area to shrink.
    *	@see	#_polygongrow
    */
    _polygonshrink: (area: any) => void;
    /**
    *	EVENT HANDLER: Handles mousemove on the image.
    *	This is the main drawing routine.
    *	Depending on the current shape, will draw the rect/circle/poly to the new position.
    *	@param	e	The event object.
    */
    img_mousemove: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles mouseup on the image.
    *	Handles dragging and resizing.
    *	@param	e	The event object.
    */
    img_mouseup: (e: any) => void;
    img_dragstart: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles mousedown on the image.
    *	Handles beggining or end of draw, or polygon point set.
    *	@param	e	The event object.
    */
    img_mousedown: (e: any) => void;
    /**
    *	Highlights a given area.
    *	Sets opacity and repaints.
    *	@date	2007.12.28. 18:23:00
    *	@param	id	The id of the area to blur.

    */
    highlightArea: (id: any) => void;
    /**
    *	Blurs a given area.
    *	Sets opacity and repaints.
    *	@date	2007.12.28. 18:23:26
    *	@param	id	The id of the area to blur.

    */
    blurArea: (id: any) => void;
    /**
    *	EVENT HANDLER: Handles event of mousemove on imgmap areas.
    *	- changes cursor depending where we are inside the area (buggy in opera)
    *	- handles area resize
    *	- handles area move
    *	@url	http://evolt.org/article/Mission_Impossible_mouse_position/17/23335/index.html
    *	@url	http://my.opera.com/community/forums/topic.dml?id=239498&t=1217158015&page=1
    *	@author	adam
    *	@param	e	The event object.
    */
    area_mousemove: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles event of mouseup on imgmap areas.
    *	Basically clears draggedId.
    *	@author	adam
    *	@param	e	The event object
    */
    area_mouseup: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles event of mouseover on imgmap areas.
    *	Calls gradual highlight on the given area.
    *	@author	adam
    *	@param	e	The event object
    */
    area_mouseover: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles event of mouseout on imgmap areas.
    *	Calls gradient blur on the given area.
    *	@author	adam
    *	@param	e	The event object
    */
    area_mouseout: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles event of mousedown on imgmap areas.
    *	Sets the variables draggedid, selectedid and currentid to the given area.
    *	@author	adam
    *	@param	e	The event object
    */
    area_mousedown: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles event 'keydown' on document.
    *	Handles SHIFT hold while drawing.
    *	Note: Safari doesn't generate keyboard events for modifiers:
    *	@url	http://bugs.webkit.org/show_bug.cgi?id=11696
    *	@author	adam
    *	@param	e	The event object
    */
    doc_keydown: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles event 'keyup' on document.
    *	Handles SHIFT release while drawing.
    *	@author	adam
    *	@param	e	The event object
    */
    doc_keyup: (e: any) => void;
    /**
    *	EVENT HANDLER: Handles event 'mousedown' on document.
    *	@author	adam
    *	@param	e	The event object
    */
    doc_mousedown: (e: any) => void;
    /**
    *	Get the real position of the element.
    *	Deal with browser differences when trying to get the position of an area.
    *	@param	element	The element you want the position of.
    *	@return	An object with x and y members.
    */
    _getPos: (element: any) => {
        x: any;
        y: any;
    };
    /**
    *	Gets the last (visible and editable) area.
    *	@author	Adam Maschek (adam.maschek(at)gmail.com)
    *	@date	2006-06-15 16:34:51
    *	@returns	The last area object or null.
    */
    _getLastArea: () => any;
    /**
    *	Parses cssText to single style declarations.
    *	@author	adam
    *	@date	25-09-2007 18:19:51
    *	@param obj	The DOM object to apply styles on.
    *	@param cssText	The css declarations to apply.
    */
    assignCSS: (obj: any, cssText: any) => void;
    /**
    *	To fire callback hooks on custom events, passing them the object of the event.
    *	@author	adam
    *	@date	13-10-2007 15:24:49
    *	@param evt	The type of event
    *	@param obj	The object of the event. (can be an id, a string, an object, whatever is most relevant)
    */
    fireEvent: (evt: any, obj: any) => any;
    /**
    *	To set area dimensions.
    *	This is needed to achieve the same result in all browsers.
    *	@author	adam
    *	@date	10-12-2007 22:29:41
    *	@param	id	The id of the area (canvas) to resize.
    *	@param	w	The desired width in pixels.
    *	@param	h	The desired height in pixels.
    */
    setAreaSize: (id: any, w: any, h: any) => void;
    /**
    *	Disable selection on a given object.
    *	This is especially useful in Safari, where dragging around areas
    *	keeps selecting all sorts of things.
    *	@author	Bret Taylor
    *	@url	http://ajaxcookbook.org/disable-text-selection/
    *	@date	27-07-2008 1:57:45
    *	@param	element	The DOM element on which you want to disable selection.
    */
    disableSelection: (element: any) => boolean;
}
export {};
