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WAAW,CAAC,IAAI,CAAC,CAAC;QAE/D,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACK,mCAAiB,GAAzB,UAA0B,IAAiB;QACzC,MAAM,CAAC,IAAI,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,yBAAyB,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACK,mCAAiB,GAAzB,UAA0B,IAAiB,EAAE,KAAmB;QAC9D,MAAM,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;IAtDF;QAAC,UAAU,EAAE;;eAAA;IAuDd,cAAC;AAAD,CAtDA,AAsDC,IAAA;AAED,yDAAyD;AACzD,OAAO,IAAM,iBAAiB,GAAG;IAC/B,aAAa;IACb,sBAAsB;IACtB,OAAO;IACP,gBAAgB;CACjB,CAAC","file":"core/overlay/overlay.js","sourcesContent":["import {\n ComponentFactoryResolver,\n Injectable,\n} from '@angular/core';\nimport {OverlayState} from './overlay-state';\nimport {DomPortalHost} from '../portal/dom-portal-host';\nimport {OverlayRef} from './overlay-ref';\n\nimport {OverlayPositionBuilder} from './position/overlay-position-builder';\nimport {ViewportRuler} from './position/viewport-ruler';\nimport {OverlayContainer} from './overlay-container';\n\n/** Next overlay unique ID. */\nlet nextUniqueId = 0;\n\n/** The default state for newly created overlays. */\nlet defaultState = new OverlayState();\n\n\n/**\n * Service to create Overlays. Overlays are dynamically added pieces of floating UI, meant to be\n * used as a low-level building building block for other components. Dialogs, tooltips, menus,\n * selects, etc. can all be built using overlays. The service should primarily be used by authors\n * of re-usable components rather than developers building end-user applications.\n *\n * An overlay *is* a PortalHost, so any kind of Portal can be loaded into one.\n */\n @Injectable()\nexport class Overlay {\n constructor(private _overlayContainer: OverlayContainer,\n private _componentFactoryResolver: ComponentFactoryResolver,\n private _positionBuilder: OverlayPositionBuilder) {}\n\n /**\n * Creates an overlay.\n * @param state State to apply to the overlay.\n * @returns A reference to the created overlay.\n */\n create(state: OverlayState = defaultState): OverlayRef {\n return this._createOverlayRef(this._createPaneElement(), state);\n }\n\n /**\n * Returns a position builder that can be used, via fluent API,\n * to construct and configure a position strategy.\n */\n position() {\n return this._positionBuilder;\n }\n\n /**\n * Creates the DOM element for an overlay and appends it to the overlay container.\n * @returns Promise resolving to the created element.\n */\n private _createPaneElement(): HTMLElement {\n var pane = document.createElement('div');\n pane.id = `md-overlay-${nextUniqueId++}`;\n pane.classList.add('md-overlay-pane');\n\n this._overlayContainer.getContainerElement().appendChild(pane);\n\n return pane;\n }\n\n /**\n * Create a DomPortalHost into which the overlay content can be loaded.\n * @param pane The DOM element to turn into a portal host.\n * @returns A portal host for the given DOM element.\n */\n private _createPortalHost(pane: HTMLElement): DomPortalHost {\n return new DomPortalHost(pane, this._componentFactoryResolver);\n }\n\n /**\n * Creates an OverlayRef for an overlay in the given DOM element.\n * @param pane DOM element for the overlay\n * @param state\n * @returns {OverlayRef}\n */\n private _createOverlayRef(pane: HTMLElement, state: OverlayState): OverlayRef {\n return new OverlayRef(this._createPortalHost(pane), pane, state);\n }\n}\n\n/** Providers for Overlay and its related injectables. */\nexport const OVERLAY_PROVIDERS = [\n ViewportRuler,\n OverlayPositionBuilder,\n Overlay,\n OverlayContainer,\n];\n"],"sourceRoot":"/source/"}
\No newline at end of file